本文整理汇总了C++中MidiTrack::InsertPitchBendRange方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiTrack::InsertPitchBendRange方法的具体用法?C++ MidiTrack::InsertPitchBendRange怎么用?C++ MidiTrack::InsertPitchBendRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiTrack
的用法示例。
在下文中一共展示了MidiTrack::InsertPitchBendRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostLoad
//.........这里部分代码省略.........
{
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);
}
else if (marker->name == "tremelo")
{
tremelo = tremelo_depth_table[marker->databyte1];
if (tremelo == 0)
track->InsertExpression(channel, 127, curTicks);
}
else if (marker->name == "lfo")
{
lfoRate = lfo_rate_table[marker->databyte1];
}
else if (marker->name == "resetlfo")
{
if (marker->databyte1 != 1)
break;
lfoVal = 0;
effectiveLfoVal = 0;
lfoStage = 0;
lfoCents = 0;
if (vibrato > 0)
track->InsertPitchBend(channel, (short)(((0 + pitchbend) / (double)pitchbendRange) * 8192), curTicks);
if (tremelo > 0)
track->InsertExpression(channel, 127, curTicks);
}
else if (marker->name == "pitchbend")
{
pitchbend = (short)(((char)marker->databyte1 / 256.0) * 100);
//stringstream stream;
//stream << "cents: " << cents << " finalval: " << (cents / (double)pitchbendRange) * 8192 << "\n";
//ATLTRACE(stream.str().c_str());
track->InsertPitchBend(channel, (short)(((lfoCents + pitchbend) / (double)pitchbendRange) * 8192), curTicks);
}
}
break;
}
startAbsTicks = curTicks;
}
}
return VGMSeq::PostLoad();
}