From 31a56d832ac1b45eff4c906df0fb7f7a0364bf0b Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 12 Oct 2024 12:57:51 +0200 Subject: [PATCH] Fix MIDI player reading number of MIDI tracks #1291 --- src/midi/fluid_midi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/midi/fluid_midi.c b/src/midi/fluid_midi.c index 52a2ad378..9a27cb08f 100644 --- a/src/midi/fluid_midi.c +++ b/src/midi/fluid_midi.c @@ -363,8 +363,7 @@ fluid_midi_file_read_mthd(fluid_midi_file *mf) "Sorry, but MIDI Format %d is not supported by this player", mf->type); return FLUID_FAILED; } - mf->ntracks = (unsigned) mthd[11]; - mf->ntracks += (unsigned int)(mthd[10]) << 16; + mf->ntracks = (signed)((unsigned)(mthd[10]) << 8 | (unsigned) mthd[11]); if((signed char)mthd[12] < 0) {