diff options
author | Vitaly Novichkov <admin@wohlnet.ru> | 2018-05-20 02:07:05 +0300 |
---|---|---|
committer | Vitaly Novichkov <admin@wohlnet.ru> | 2018-05-20 02:07:05 +0300 |
commit | f545d69e3384e235828580e3f3e64aa959435478 (patch) | |
tree | 1b7e01fe2ee74c416c92e700b5aef3fe876c22ec | |
parent | 622425a6c8db4d668925b3d7d3240f23034d963e (diff) | |
download | libADLMIDI-f545d69e3384e235828580e3f3e64aa959435478.tar.gz libADLMIDI-f545d69e3384e235828580e3f3e64aa959435478.tar.bz2 libADLMIDI-f545d69e3384e235828580e3f3e64aa959435478.zip |
Polishing default tempo for MIDI files are lacks the tempo event
#91
-rw-r--r-- | src/adlmidi_load.cpp | 5 | ||||
-rw-r--r-- | src/adlmidi_midiplay.cpp | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/adlmidi_load.cpp b/src/adlmidi_load.cpp index bd38620..3e833c3 100644 --- a/src/adlmidi_load.cpp +++ b/src/adlmidi_load.cpp @@ -517,11 +517,8 @@ riffskip: TrackData.clear(); TrackData.resize(TrackCount, std::vector<uint8_t>()); - //CurrentPosition.track.clear(); - //CurrentPosition.track.resize(TrackCount); InvDeltaTicks = fraction<uint64_t>(1, 1000000l * static_cast<uint64_t>(DeltaTicks)); - //Tempo = 1000000l * InvDeltaTicks; - Tempo = fraction<uint64_t>(1, static_cast<uint64_t>(DeltaTicks)); + Tempo = fraction<uint64_t>(1, static_cast<uint64_t>(DeltaTicks) / 2); static const unsigned char EndTag[4] = {0xFF, 0x2F, 0x00, 0x00}; size_t totalGotten = 0; diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 8aab901..7919e91 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -1822,6 +1822,14 @@ MIDIplay::MidiEvent MIDIplay::parseEvent(uint8_t **pptr, uint8_t *end, int &stat evt.subtype = evtype; evt.data.insert(evt.data.begin(), data.begin(), data.end()); +#if 0 /* Print all tempo events */ + if(evt.subtype == MidiEvent::ST_TEMPOCHANGE) + { + if(hooks.onDebugMessage) + hooks.onDebugMessage(hooks.onDebugMessage_userData, "Temp Change: %02X%02X%02X", evt.data[0], evt.data[1], evt.data[2]); + } +#endif + /* TODO: Store those meta-strings separately and give ability to read them * by external functions (to display song title and copyright in the player) */ if(evt.subtype == MidiEvent::ST_COPYRIGHT) |