- Fixed: I missed a nuance of the MIDI spec when writing MIDIStreamer::CreateSMF(): Running status

is supposed to be canceled by sysex events and meta events. This confused FMOD when the
  resulting song used used running status right after these events.

SVN r3803 (trunk)
This commit is contained in:
Randy Heit 2012-08-04 01:42:49 +00:00
parent ede622bb93
commit 26f9540d3c
1 changed files with 3 additions and 1 deletions

View File

@ -1130,7 +1130,7 @@ void MIDIStreamer::Precache()
void MIDIStreamer::CreateSMF(TArray<BYTE> &file, int looplimit)
{
DWORD delay = 0;
BYTE running_status = 0;
BYTE running_status = 255;
// Always create songs aimed at GM devices.
CheckCaps(MOD_MIDIPORT);
@ -1163,6 +1163,7 @@ void MIDIStreamer::CreateSMF(TArray<BYTE> &file, int looplimit)
file.Push(BYTE(tempo >> 16));
file.Push(BYTE(tempo >> 8));
file.Push(BYTE(tempo));
running_status = 255;
}
else if (MEVT_EVENTTYPE(event[2]) == MEVT_LONGMSG)
{
@ -1176,6 +1177,7 @@ void MIDIStreamer::CreateSMF(TArray<BYTE> &file, int looplimit)
file.Push(MIDI_SYSEX);
WriteVarLen(file, len);
memcpy(&file[file.Reserve(len - 1)], bytes, len);
running_status = 255;
}
}
else if (MEVT_EVENTTYPE(event[2]) == 0)