本文整理汇总了C++中CEvent::Duration方法的典型用法代码示例。如果您正苦于以下问题:C++ CEvent::Duration方法的具体用法?C++ CEvent::Duration怎么用?C++ CEvent::Duration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEvent
的用法示例。
在下文中一共展示了CEvent::Duration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:
void
DualBendOffsetOp::operator()(
CEvent &ev,
TClockType clockType)
{
if (ev.Command() == EvtType_PitchBend)
{
if (ev.Duration() > 0)
{
ev.pitchBend.startBend =
(uint16)CLAMP(0, ((int16)ev.pitchBend.startBend) + delta,
0x3fff );
ev.pitchBend.targetBend =
(uint16)CLAMP(0, ((int16)ev.pitchBend.targetBend) + delta,
0x3fff);
}
else
{
ev.pitchBend.startBend = ev.pitchBend.targetBend =
(uint16)CLAMP(0, ((int16)ev.pitchBend.targetBend) + delta,
0x3fff );
}
}
}