本文整理汇总了C++中MidiEvent::ReadSysEx方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiEvent::ReadSysEx方法的具体用法?C++ MidiEvent::ReadSysEx怎么用?C++ MidiEvent::ReadSysEx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiEvent
的用法示例。
在下文中一共展示了MidiEvent::ReadSysEx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadFromStream
MidiEvent MidiEvent::ReadFromStream(istream &stream,
unsigned char last_status,
bool contains_delta_pulses) {
MidiEvent ev;
if (contains_delta_pulses)
ev.m_delta_pulses = parse_variable_length(stream);
else
ev.m_delta_pulses = 0;
// MIDI uses a compression mechanism called "running status".
// Anytime you read a status byte that doesn't have the highest-
// order bit set, what you actually read is the 1st data byte
// of a message with the status of the previous message.
ev.m_status = static_cast<unsigned char>(stream.peek());
if ((ev.m_status & 0x80) == 0)
ev.m_status = last_status;
else
// It was a status byte after all, just read past it
// in the stream
stream.read(reinterpret_cast<char*>(&ev.m_status), sizeof(unsigned char));
switch (ev.Type()) {
case MidiEventType_Meta:
ev.ReadMeta(stream);
break;
case MidiEventType_SysEx:
ev.ReadSysEx(stream);
break;
default:
ev.ReadStandard(stream);
break;
}
return ev;
}