diff options
-rw-r--r-- | include/adlmidi.h | 3 | ||||
-rw-r--r-- | src/adlmidi.cpp | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/adlmidi.h b/include/adlmidi.h index 6a5a21a..8c5b7f4 100644 --- a/include/adlmidi.h +++ b/include/adlmidi.h @@ -212,6 +212,9 @@ extern int adl_generate(ADL_MIDIPlayer *device, int sampleCount, short *out); */ extern double adl_tickEvents(ADL_MIDIPlayer *device, double seconds, double granuality); +/*Returns 1 if music position has reached end*/ +extern int adl_atEnd(ADL_MIDIPlayer *device); + /**Hooks**/ typedef void (*ADL_RawEventHook)(void *userdata, ADL_UInt8 type, ADL_UInt8 subtype, ADL_UInt8 channel, const ADL_UInt8 *data, size_t len); diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index 5e252db..7c08287 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -686,3 +686,13 @@ ADLMIDI_EXPORT double adl_tickEvents(ADL_MIDIPlayer *device, double seconds, dou return -1.0; return player->Tick(seconds, granuality); } + +ADLMIDI_EXPORT int adl_atEnd(ADL_MIDIPlayer *device) +{ + if(!device) + return 1; + MIDIplay *player = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer); + if(!player) + return 1; + return (int)player->atEnd; +} |