Initial
This commit is contained in:
31
midiseq/MIDISequencer.cpp
Normal file
31
midiseq/MIDISequencer.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <midiseq/MIDISequencer.hpp>
|
||||
#include <common/mmtimer.hpp>
|
||||
|
||||
MIDISequencer::MIDISequencer()
|
||||
{
|
||||
}
|
||||
|
||||
MIDISequencer::~MIDISequencer()
|
||||
{
|
||||
}
|
||||
|
||||
bool MIDISequencer::sequence(MIDIOutputDevice &midiDevice)
|
||||
{
|
||||
DWORD currTime(MMTimer::getSystemTime());
|
||||
int currentTrack;
|
||||
bool eligibleTracks;
|
||||
|
||||
eligibleTracks=false;
|
||||
for(currentTrack=0;currentTrack<MIDIBlock::MaxTracks;currentTrack++)
|
||||
{
|
||||
if(mTrackIndices[currentTrack]>=((*mMIDIData)[currentTrack]).size())continue;
|
||||
eligibleTracks=true;
|
||||
while(((*mMIDIData)[currentTrack])[mTrackIndices[currentTrack]].playTime()<=currTime)
|
||||
{
|
||||
if(!midiDevice.midiEvent(((*mMIDIData)[currentTrack])[mTrackIndices[currentTrack]]))return false;
|
||||
mTrackIndices[currentTrack]=mTrackIndices[currentTrack]+1;
|
||||
if(mTrackIndices[currentTrack]>=((*mMIDIData)[currentTrack]).size())break;
|
||||
}
|
||||
}
|
||||
return eligibleTracks;
|
||||
}
|
||||
Reference in New Issue
Block a user