本文整理汇总了C++中MidiDevice::putEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiDevice::putEvent方法的具体用法?C++ MidiDevice::putEvent怎么用?C++ MidiDevice::putEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiDevice
的用法示例。
在下文中一共展示了MidiDevice::putEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initDevices
void Audio::initDevices()
{
//
// mark all used ports
//
bool activePorts[MIDI_PORTS];
for (int i = 0; i < MIDI_PORTS; ++i)
activePorts[i] = false;
MidiTrackList* tracks = song->midis();
for (iMidiTrack it = tracks->begin(); it != tracks->end(); ++it)
{
MidiTrack* track = *it;
activePorts[track->outPort()] = true;
}
if (song->click())
activePorts[clickPort] = true;
//
// test for explicit instrument initialization
//
for (int i = 0; i < MIDI_PORTS; ++i)
{
if (!activePorts[i])
continue;
MidiPort* port = &midiPorts[i];
MidiInstrument* instr = port->instrument();
MidiDevice* md = port->device();
if (instr && md)
{
EventList* events = instr->midiInit();
if (events->empty())
continue;
for (iEvent ie = events->begin(); ie != events->end(); ++ie)
{
MidiPlayEvent ev(0, i, 0, ie->second);
md->putEvent(ev);
}
activePorts[i] = false; // no standard initialization
}
}
//
// damit Midi-Devices, die mehrere Ports besitzen, wie z.B.
// das Korg NS5R, nicht mehrmals zwischen GM und XG/GS hin und
// hergeschaltet werden, wird zunïÿýhst auf allen Ports GM
// initialisiert, und dann erst XG/GS
//
// Standard initialization...
for (int i = 0; i < MIDI_PORTS; ++i)
{
if (!activePorts[i])
continue;
MidiPort* port = &midiPorts[i];
switch (song->mtype())
{
case MT_GS:
case MT_UNKNOWN:
break;
case MT_GM:
case MT_XG:
port->sendGmOn();
break;
}
}
for (int i = 0; i < MIDI_PORTS; ++i)
{
if (!activePorts[i])
continue;
MidiPort* port = &midiPorts[i];
switch (song->mtype())
{
case MT_UNKNOWN:
break;
case MT_GM:
port->sendGmInitValues();
break;
case MT_GS:
port->sendGsOn();
port->sendGsInitValues();
break;
case MT_XG:
port->sendXgOn();
port->sendXgInitValues();
break;
}
}
}