本文整理汇总了C++中MidiEvent::dataA方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiEvent::dataA方法的具体用法?C++ MidiEvent::dataA怎么用?C++ MidiEvent::dataA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiEvent
的用法示例。
在下文中一共展示了MidiEvent::dataA方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
void Zerberus::process(const MidiEvent& event)
{
if (busy)
return;
Channel* cp = _channel[int(event.channel())];
if (cp->instrument() == 0) {
// printf("Zerberus::process(): no instrument for channel %d\n", event.channel());
return;
}
switch(event.type()) {
case MidiEventType::NOTEOFF:
processNoteOff(cp, event.dataA());
break;
case MidiEventType::NOTEON: {
int key = event.dataA();
int vel = event.dataB();
if (vel)
processNoteOn(cp, key, vel);
else
processNoteOff(cp, key);
}
break;
case MidiEventType::CONTROLLER:
cp->controller(event.dataA(), event.dataB());
break;
default:
printf("event type 0x%02x\n", event.type());
break;
}
}
示例2: writeEvent
void MidiFile::writeEvent(const MidiEvent& event)
{
switch(event.type()) {
case ME_NOTEON:
writeStatus(ME_NOTEON, event.channel());
put(event.pitch());
put(event.velo());
break;
case ME_NOTEOFF:
writeStatus(ME_NOTEOFF, event.channel());
put(event.pitch());
put(event.velo());
break;
case ME_PITCHBEND:
writeStatus(ME_PITCHBEND, event.channel());
put(event.dataA());
put(event.dataB());
break;
case ME_CONTROLLER:
switch(event.controller()) {
case CTRL_PROGRAM:
writeStatus(ME_PROGRAM, event.channel());
put(event.value() & 0x7f);
break;
case CTRL_PRESS:
writeStatus(ME_AFTERTOUCH, event.channel());
put(event.value() & 0x7f);
break;
default:
writeStatus(ME_CONTROLLER, event.channel());
put(event.controller());
put(event.value() & 0x7f);
break;
}
break;
case ME_META:
put(ME_META);
put(event.metaType());
putvl(event.len());
write(event.edata(), event.len());
resetRunningStatus(); // really ?!
break;
case ME_SYSEX:
put(ME_SYSEX);
putvl(event.len() + 1); // including 0xf7
write(event.edata(), event.len());
put(ME_ENDSYSEX);
resetRunningStatus();
break;
}
}