diff --git a/src/sound/music_mus_midiout.cpp b/src/sound/music_mus_midiout.cpp index 5f5d39d18a..e81adc07f0 100644 --- a/src/sound/music_mus_midiout.cpp +++ b/src/sound/music_mus_midiout.cpp @@ -228,18 +228,18 @@ void MUSSong2::Precache() val = instr - 100 + (1 << 14); } - BYTE moreparam = used[k++]; - if (moreparam == 1) + int numbanks = used[k++]; + if (numbanks > 0) { - BYTE bank = used[k++]; - val |= (bank << 7); + for (int b = 0; b < numbanks; b++) + { + work[j++] = val | used[k++]; + } } - else if (moreparam > 0) + else { - // No information if this is even valid. Print a message so it can be investigated later - Printf("Unknown instrument data found in music\n"); + work[j++] = val; } - work[j++] = val; } MIDI->PrecacheInstruments(&work[0], j); } diff --git a/src/wildmidi/wildmidi_lib.cpp b/src/wildmidi/wildmidi_lib.cpp index 94a446e176..0a527ec2a8 100644 --- a/src/wildmidi/wildmidi_lib.cpp +++ b/src/wildmidi/wildmidi_lib.cpp @@ -2719,14 +2719,14 @@ midi *WildMidi_NewMidi() { } } - if ((((_mdi*)ret)->reverb = _WM_init_reverb(_WM_SampleRate, reverb_room_width, - reverb_room_length, reverb_listen_posx, reverb_listen_posy)) - == NULL) { - _WM_ERROR(__FUNCTION__, __LINE__, WM_ERR_MEM, "to init reverb", 0); + if ((((_mdi*)ret)->reverb = _WM_init_reverb(_WM_SampleRate, reverb_room_width, + reverb_room_length, reverb_listen_posx, reverb_listen_posy)) + == NULL) { + _WM_ERROR(__FUNCTION__, __LINE__, WM_ERR_MEM, "to init reverb", 0); WildMidi_Close(ret); ret = NULL; - } - + } + return ret; }