本文整理汇总了C++中TrackInfo::ReadVarLen方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackInfo::ReadVarLen方法的具体用法?C++ TrackInfo::ReadVarLen怎么用?C++ TrackInfo::ReadVarLen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackInfo
的用法示例。
在下文中一共展示了TrackInfo::ReadVarLen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VolumeControllerChange
//.........这里部分代码省略.........
else
{
data1 = track->EventChunk[track->EventP++];
}
CHECK_FINISHED
if (MIDI_EventLengths[(event&0x70)>>4] == 2)
{
data2 = track->EventChunk[track->EventP++];
}
if ((event & 0x70) == (MIDI_CTRLCHANGE & 0x70))
{
switch (data1)
{
case 7: // Channel volume
data2 = VolumeControllerChange(event & 15, data2);
break;
case 110: // XMI channel lock
case 111: // XMI channel lock protect
case 112: // XMI voice protect
case 113: // XMI timbre protect
case 115: // XMI indirect controller prefix
case 118: // XMI clear beat/bar count
case 119: // XMI callback trigger
case 120:
event = MIDI_META; // none of these are relevant to us.
break;
case 114: // XMI patch bank select
data1 = 0; // Turn this into a standard MIDI bank select controller.
break;
case 116: // XMI for loop controller
if (track->ForDepth < MAX_FOR_DEPTH)
{
track->ForLoops[track->ForDepth].LoopBegin = track->EventP;
track->ForLoops[track->ForDepth].LoopCount = ClampLoopCount(data2);
track->ForLoops[track->ForDepth].LoopFinished = track->Finished;
}
track->ForDepth++;
event = MIDI_META;
break;
case 117: // XMI next loop controller
if (track->ForDepth > 0)
{
int depth = track->ForDepth - 1;
if (depth < MAX_FOR_DEPTH)
{
if (data2 < 64 || (track->ForLoops[depth].LoopCount == 0 && !m_Looping))
{ // throw away this loop.
track->ForLoops[depth].LoopCount = 1;
}
// A loop count of 0 loops forever.
if (track->ForLoops[depth].LoopCount == 0 || --track->ForLoops[depth].LoopCount > 0)
{
track->EventP = track->ForLoops[depth].LoopBegin;
track->Finished = track->ForLoops[depth].LoopFinished;
}
else
{ // done with this loop
track->ForDepth = depth;
}
}
else
{ // ignore any loops deeper than the max depth
track->ForDepth = depth;
}
}
event = MIDI_META;
break;
}
}
events[0] = delay;
events[1] = 0;
if (event != MIDI_META)
{
events[2] = event | (data1<<8) | (data2<<16);
}
else
{
events[2] = MEVT_NOP << 24;
}
events += 3;
if ((event & 0x70) == (MIDI_NOTEON & 0x70))
{ // XMI note on events include the time until an implied note off event.
NoteOffs.AddNoteOff(track->ReadVarLen(), event & 0x0F, data1);
}
}
else
{
// Skip SysEx events just because I don't want to bother with them.
// The old MIDI player ignored them too, so this won't break
// anything that played before.
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
示例2: VolumeControllerChange
//.........这里部分代码省略.........
if (MIDI_CommonLengths[event & 15] > 1)
{
data2 = track->EventChunk[track->EventP++];
}
}
}
else
{
data1 = track->EventChunk[track->EventP++];
}
CHECK_FINISHED
if (MIDI_EventLengths[(event&0x70)>>4] == 2)
{
data2 = track->EventChunk[track->EventP++];
}
if ((event & 0x70) == (MIDI_CTRLCHANGE & 0x70))
{
switch (data1)
{
case 7: // Channel volume
data2 = VolumeControllerChange(event & 15, data2);
break;
case 110: // XMI channel lock
case 111: // XMI channel lock protect
case 112: // XMI voice protect
case 113: // XMI timbre protect
case 115: // XMI indirect controller prefix
case 118: // XMI clear beat/bar count
case 119: // XMI callback trigger
case 120:
event = MIDI_META; // none of these are relevant to us.
break;
case 114: // XMI patch bank select
data1 = 0; // Turn this into a standard MIDI bank select controller.
break;
case 116: // XMI for loop controller
if (track->ForDepth < MAX_FOR_DEPTH)
{
track->ForLoops[track->ForDepth].LoopBegin = track->EventP;
track->ForLoops[track->ForDepth].LoopCount = ClampLoopCount(data2);
track->ForLoops[track->ForDepth].LoopFinished = track->Finished;
}
track->ForDepth++;
event = MIDI_META;
break;
case 117: // XMI next loop controller
if (track->ForDepth > 0)
{
int depth = track->ForDepth - 1;
if (depth < MAX_FOR_DEPTH)
{
if (data2 < 64 || (track->ForLoops[depth].LoopCount == 0 && !m_Looping))
{ // throw away this loop.
track->ForLoops[depth].LoopCount = 1;
}
// A loop count of 0 loops forever.
if (track->ForLoops[depth].LoopCount == 0 || --track->ForLoops[depth].LoopCount > 0)
{
track->EventP = track->ForLoops[depth].LoopBegin;
track->Finished = track->ForLoops[depth].LoopFinished;
}
else
{ // done with this loop
track->ForDepth = depth;
}
}
else
{ // ignore any loops deeper than the max depth
track->ForDepth = depth;
}
}
event = MIDI_META;
break;
}
}
events[0] = delay;
events[1] = 0;
if (event != MIDI_META)
{
events[2] = event | (data1<<8) | (data2<<16);
}
events += 3;
if ((event & 0x70) == (MIDI_NOTEON & 0x70))
{ // XMI note on events include the time until an implied note off event.
NoteOffs.AddNoteOff(track->ReadVarLen(), event & 0x0F, data1);
}
}
else
{
// SysEx events could potentially not have enough room in the buffer...
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)