本文整理汇总了C++中MidiTrack::InsertExpression方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiTrack::InsertExpression方法的具体用法?C++ MidiTrack::InsertExpression怎么用?C++ MidiTrack::InsertExpression使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiTrack
的用法示例。
在下文中一共展示了MidiTrack::InsertExpression方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostLoad
//.........这里部分代码省略.........
//double centsPerMidiTick = vibrato / midiTicksPerPhase;
double lfoRatePerMidiTick = (numLfoPhases * 0x20000) / (double)segmentDurTicks;
const uint8_t tickRes = 16;
uint32_t lfoRatePerLoop = (uint32_t)((tickRes * lfoRatePerMidiTick) * 256);
for (int t = 0; t < segmentDurTicks; t += tickRes)
{
lfoVal += lfoRatePerLoop;
if (lfoVal > 0xFFFFFF)
{
lfoVal -= 0x1000000;
lfoStage = (lfoStage+1) % 4;
}
effectiveLfoVal = lfoVal;
if (lfoStage == 1)
effectiveLfoVal = 0x1000000 - lfoVal;
else if (lfoStage == 2)
effectiveLfoVal = -((long)lfoVal);
else if (lfoStage == 3)
effectiveLfoVal = -0x1000000 + lfoVal;
double lfoPercent = (effectiveLfoVal / (double)0x1000000);
if (vibrato > 0)
{
lfoCents = (short)(lfoPercent * vibrato);
track->InsertPitchBend(channel, (short)(((lfoCents + pitchbend) / (double)pitchbendRange) * 8192), startAbsTicks + t);
}
if (tremelo > 0)
{
uint8_t expression = ConvertPercentAmpToStdMidiVal((0x10000 - (tremelo*abs(lfoPercent))) / (double)0x10000);
track->InsertExpression(channel, expression, startAbsTicks + t);
}
}
// TODO add adjustment for segmentDurTicks % tickRes
}
switch(event->GetEventType())
{
case MIDIEVENT_TEMPO:
{
TempoEvent* tempoevent = (TempoEvent*)event;
mpqn = tempoevent->microSecs;
mpt = mpqn / ppqn;
}
break;
case MIDIEVENT_ENDOFTRACK:
break;
case MIDIEVENT_MARKER:
{
MarkerEvent* marker = (MarkerEvent*)event;
if (marker->name == "vibrato")
{
vibrato = vibrato_depth_table[marker->databyte1] * (100/256.0);
//pitchbendRange = max(200, (vibrato + 50)); //50 cents to allow for pitchbend values, which range -50/+50
pitchbendRange = (int)max(200, ceil((vibrato+50)/100.0)*100); //+50 cents to allow for pitchbend values, which range -50/+50
track->InsertPitchBendRange(channel, pitchbendRange/100, pitchbendRange%100, curTicks);
lfoCents = (short)((effectiveLfoVal / (double)0x1000000) * vibrato);
if (curTicks > 0)
track->InsertPitchBend(channel, (short)(((lfoCents + pitchbend) / (double)pitchbendRange) * 8192), curTicks);