From 46eebe29a485ef4044c809050657bbdbf30f5774 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 23 Sep 2010 22:37:25 +0000 Subject: [PATCH] - Update the HMI player to use the division information stored in the song and check the full file signature. SVN r2848 (trunk) --- src/sound/music_hmi_midiout.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sound/music_hmi_midiout.cpp b/src/sound/music_hmi_midiout.cpp index c2075bf1a..c847217ee 100644 --- a/src/sound/music_hmi_midiout.cpp +++ b/src/sound/music_hmi_midiout.cpp @@ -41,7 +41,7 @@ // MACROS ------------------------------------------------------------------ -#define SONG_MAGIC "HMI-MIDISONG" +#define SONG_MAGIC "HMI-MIDISONG061595" #define TRACK_MAGIC "HMI-MIDITRACK" // Used by SendCommand to check for unexpected end-of-track conditions. @@ -53,6 +53,7 @@ } // In song header +#define DIVISION_OFFSET 0xD2 #define TRACK_COUNT_OFFSET 0xE4 #define TRACK_DIR_PTR_OFFSET 0xE8 @@ -164,7 +165,7 @@ HMISong::HMISong (FILE *file, BYTE *musiccache, int len, EMIDIDevice type) } // Do some validation of the MIDI file - if (memcmp(MusHeader, SONG_MAGIC, 12) != 0) + if (memcmp(MusHeader, SONG_MAGIC, sizeof(SONG_MAGIC)) != 0) return; NumTracks = GetShort(MusHeader + TRACK_COUNT_OFFSET); @@ -174,7 +175,8 @@ HMISong::HMISong (FILE *file, BYTE *musiccache, int len, EMIDIDevice type) } // The division is the number of pulses per quarter note (PPQN). - Division = 60; + Division = GetShort(MusHeader + DIVISION_OFFSET); + InitialTempo = 4000000; Tracks = new TrackInfo[NumTracks + 1]; int track_dir = GetInt(MusHeader + TRACK_DIR_PTR_OFFSET);