From d9a000cc0a6a8aae37f34c4cc6e23797a1ceb8c9 Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Thu, 26 Oct 2017 03:17:15 +0300 Subject: Continue works on loop points and some clean-up - Added more detailed error information while parsing MIDI file - Added abiltiy to retrieve loop points time positions - Added ability to change playing tempo by giving multiplier - Removed old commented code TODO: - implement meta-information store and a way to retreive it - implement hook-ability for every MIDI event - implement ability to mute/solo every channel --- src/adlmidi_load.cpp | 50 ++------------------------------------------------ 1 file changed, 2 insertions(+), 48 deletions(-) (limited to 'src/adlmidi_load.cpp') diff --git a/src/adlmidi_load.cpp b/src/adlmidi_load.cpp index 5bc2ba0..08892a5 100644 --- a/src/adlmidi_load.cpp +++ b/src/adlmidi_load.cpp @@ -48,53 +48,6 @@ uint64_t MIDIplay::ReadLEint(const void *buffer, size_t nbytes) return result; } -//uint64_t MIDIplay::ReadVarLenEx(size_t tk, bool &ok) -//{ -// uint64_t result = 0; -// ok = false; - -// for(;;) -// { -// if(tk >= TrackData.size()) -// return 1; - -// if(tk >= CurrentPosition.track.size()) -// return 2; - -// size_t ptr = CurrentPosition.track[tk].ptr; - -// if(ptr >= TrackData[tk].size()) -// return 3; - -// unsigned char byte = TrackData[tk][CurrentPosition.track[tk].ptr++]; -// result = (result << 7) + (byte & 0x7F); - -// if(!(byte & 0x80)) break; -// } - -// ok = true; -// return result; -//} - -uint64_t MIDIplay::ReadVarLenEx(uint8_t **ptr, uint8_t *end, bool &ok) -{ - uint64_t result = 0; - ok = false; - - for(;;) - { - if(*ptr >= end) - return 2; - unsigned char byte = *((*ptr)++); - result = (result << 7) + (byte & 0x7F); - if(!(byte & 0x80)) break; - } - - ok = true; - return result; -} - - bool MIDIplay::LoadBank(const std::string &filename) { fileReader file; @@ -388,6 +341,7 @@ bool MIDIplay::LoadMIDI(MIDIplay::fileReader &fr) ADL_UNUSED(fsize); //! Temp buffer for conversion AdlMIDI_CPtr cvt_buf; + errorString.clear(); #ifdef DISABLE_EMBEDDED_BANKS if((opl.AdlBank != ~0u) || (opl.dynamic_metainstruments.size() < 256)) @@ -792,7 +746,7 @@ InvFmt: //Build new MIDI events table (ALPHA!!!) if(!buildTrackData()) { - ADLMIDI_ErrorString = fr._fileName + ": MIDI data parsing error has occouped!"; + ADLMIDI_ErrorString = fr._fileName + ": MIDI data parsing error has occouped!\n" + errorString; return false; } -- cgit v1.2.3