本文整理汇总了C++中CEvent::Start方法的典型用法代码示例。如果您正苦于以下问题:C++ CEvent::Start方法的具体用法?C++ CEvent::Start怎么用?C++ CEvent::Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEvent
的用法示例。
在下文中一共展示了CEvent::Start方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: point
void
CPitchBendEventRenderer::Draw(
const CEvent &ev,
bool shadowed) const
{
CDestination *dest = Editor()->TrackWindow()->Document()->FindDestination(ev.GetVChannel());
BRect r;
if (shadowed)
Editor()->SetDrawingMode( B_OP_BLEND );
Editor()->SetHighColor(dest->Color());
if ((ev.Duration() > 0) && (ev.pitchBend.updatePeriod > 0))
{
Editor()->BeginLineArray(ev.Duration() / ev.pitchBend.updatePeriod);
for (int i = ev.pitchBend.updatePeriod; i < ev.Duration(); i += ev.pitchBend.updatePeriod)
{
long v = ev.pitchBend.startBend - 0x2000
+ ((ev.pitchBend.targetBend - ev.pitchBend.startBend)
* i / ev.Duration());
BPoint point(Editor()->TimeToViewCoords(ev.Start() + i),
Editor()->ValueToViewCoords(v));
Editor()->AddLine(point, point, Editor()->HighColor());
}
Editor()->EndLineArray();
r.left = Editor()->TimeToViewCoords(ev.Stop() ) - 2.0;
r.top = Editor()->ValueToViewCoords(ev.pitchBend.targetBend - 0x2000) - 2.0;
r.right = r.left + 4.0;
r.bottom = r.top + 4.0;
Editor()->FillEllipse(r);
r.InsetBy(-1.0, -1.0);
if (ev.IsSelected() && !shadowed && Editor()->IsSelectionVisible())
Editor()->SetHighColor(0, 0, 255);
else
Editor()->SetHighColor(0, 0, 0);
Editor()->StrokeEllipse(r);
}
r.left = Editor()->TimeToViewCoords(ev.Start()) - 2.0;
r.top = Editor()->ValueToViewCoords(ev.pitchBend.startBend - 0x2000) - 2.0;
r.right = r.left + 4.0;
r.bottom = r.top + 4.0;
Editor()->SetHighColor(dest->Color());
Editor()->FillEllipse(r);
if (ev.IsSelected() && !shadowed && Editor()->IsSelectionVisible())
Editor()->SetHighColor(0, 0, 255);
else
Editor()->SetHighColor(0, 0, 0);
r.InsetBy(-1.0, -1.0);
Editor()->StrokeEllipse(r);
}
示例2: start
long
CPitchBendEventRenderer::Pick(
const CEvent &ev,
BPoint pickPt,
short &partCode) const
{
if (ev.Duration() > 0)
{
BPoint start(Editor()->TimeToViewCoords(ev.Start()),
Editor()->ValueToViewCoords(ev.pitchBend.startBend - 0x2000));
BPoint stop(Editor()->TimeToViewCoords(ev.Stop()),
Editor()->ValueToViewCoords(ev.pitchBend.targetBend - 0x2000));
float best = MAX(fabs(pickPt.x - stop.x), fabs(pickPt.y - stop.y));
float dist = MAX(fabs(pickPt.x - start.x), fabs(pickPt.y - start.y));
partCode = Part_End;
if (dist < best)
{
best = dist;
partCode = Part_Start;
}
if (best > 3.0)
{
dist = MathUtils::DistanceFromPointToLine(pickPt, start, stop);
if (dist < best)
{
best = dist + 2.0;
partCode = Part_Whole;
}
}
if (best > 8.0)
return LONG_MAX;
return static_cast<long>(best);
}
else
{
BPoint diff(pickPt.x - Editor()->TimeToViewCoords(ev.Start()),
pickPt.y - Editor()->ValueToViewCoords(ev.pitchBend.startBend - 0x2000));
if ((diff.y > 8) || (diff.y < -8) || (diff.x > 10) || (diff.x < -8))
return LONG_MAX;
if (diff.x >= 3.0)
partCode = Part_End;
else
partCode = Part_Whole;
return static_cast<long>(MAX(fabs(diff.x), fabs(diff.y)));
}
}
示例3: Editor
BRect
CPitchBendEventRenderer::Extent(
const CEvent &ev) const
{
float yStart = Editor()->ValueToViewCoords(ev.pitchBend.startBend - 0x2000);
float yStop = Editor()->ValueToViewCoords(ev.pitchBend.targetBend - 0x2000);
BRect r;
r.left = Editor()->TimeToViewCoords(ev.Start()) - 5.0;
r.right = Editor()->TimeToViewCoords(ev.Stop()) + 5.0;
r.bottom = MAX(yStart, yStop) + 5.0;
r.top = MIN(yStart, yStop) - 5.0;
return r;
}
示例4: message
void
CPlaybackTaskGroup::_executeEvent(
CEvent &ev,
TimeState &tState)
{
D_INTERNAL(("CPlaybackTaskGroup::_executeEvent(%s)\n",
ev.NameText()));
switch (ev.Command())
{
case EvtType_TaskMarker:
{
if (ev.task.taskPtr->flags & CPlaybackTask::Task_Finished)
{
delete ev.task.taskPtr;
if (tasks.Empty())
{
BMessage message(Player_ChangeTransportState);
be_app->PostMessage(&message);
}
}
else
{
ev.task.taskPtr->Play();
}
return;
}
case EvtType_Interpolate:
{
// I was originally supposed to have executed at ev.Start() + timeStep,
// but I may be a bit later than that -- take the difference into account.
// Here's how much time has elapsed since I was dispatched...
int32 elapsed = tState.time - ev.Start()
+ ev.interpolate.timeStep;
// If we went past the end, then clip the time.
if ((unsigned long)elapsed > ev.interpolate.duration)
elapsed = ev.interpolate.duration;
CDestination *dest = ev.common.destination;
if (dest != NULL)
{
if (dest->ReadLock(500))
{
dest->Interpolate(ev, tState.stack, system_time(),
elapsed);
dest->ReadUnlock();
}
}
return;
}
}
CDestination *dest = ev.common.destination;
if (dest != NULL)
{
if (dest->ReadLock(500))
{
dest->Execute(ev, system_time());
dest->ReadUnlock();
}
}
}