本文整理汇总了C++中MidiEvent::getMidiClockTime方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiEvent::getMidiClockTime方法的具体用法?C++ MidiEvent::getMidiClockTime怎么用?C++ MidiEvent::getMidiClockTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiEvent
的用法示例。
在下文中一共展示了MidiEvent::getMidiClockTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ntohl
//
// I_ReadMidiTrack()
//
// Reads an entire midi track from memory and creates a list of MidiEvents
// pointers where the event's start time is the time since the beginning of the
// track. It is the caller's responsibility to delete the list returned
// by this function.
//
static std::list<MidiEvent*> *I_ReadMidiTrack(MEMFILE *mf)
{
if (!mf)
return NULL;
midi_chunk_header_t chunkheader;
unsigned int track_time = 0;
size_t res = mem_fread(&chunkheader, cTrackHeaderSize, 1, mf);
if (!res)
return NULL;
chunkheader.chunk_id = ntohl(chunkheader.chunk_id);
chunkheader.chunk_size = ntohl(chunkheader.chunk_size);
if (chunkheader.chunk_id != cTrackChunkId)
{
Printf(PRINT_HIGH, "I_ReadMidiTrack: Unexpected chunk header ID\n");
return NULL;
}
std::list<MidiEvent*> *eventlist = new std::list<MidiEvent*>;
size_t trackend = mem_ftell(mf) + chunkheader.chunk_size;
while (mem_ftell(mf) < int(trackend))
{
MidiEvent *newevent = I_ReadMidiEvent(mf, track_time);
if (!newevent)
{
Printf(PRINT_HIGH, "I_ReadMidiTrack: Unable to read MIDI event\n");
I_ClearMidiEventList(eventlist);
delete eventlist;
return NULL;
}
eventlist->push_back(newevent);
track_time = newevent->getMidiClockTime();
}
return eventlist;
}