- hopefully fixed the MUS precaching for good.

According to blzut3, it looks like it is a byte followed by a variable length field. It can be any value 0-15 and will be followed by that many bytes one for each bank used. If the bank count is 0 then it is shorthand for using one bank (bank 0).
This commit is contained in:
Christoph Oelckers 2015-12-30 20:32:19 +01:00
parent be6daf5d78
commit 3c40d71c20
2 changed files with 14 additions and 14 deletions

View file

@ -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);
}

View file

@ -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;
}