Rémi Bernon (@rbernon) commented about dlls/dmime/midi.c:
while ((hr = read_midi_event(parser->stream, &last_status, &length)) == S_OK)
;
while ((hr = read_midi_event(parser->stream, &event, &last_status, &length)) == S_OK)
{
parser->time += event.delta_time;
if ((event.status & 0xf0) == MIDI_PROGRAM_CHANGE)
hr = midi_parser_handle_program_change(parser, &event);
if (FAILED(hr)) break;
}
if (FAILED(hr)) return hr;
if (FAILED(hr)) break; TRACE("End of track %u\n", i);
if (parser->time > music_length) music_length = parser->time;
parser->time = 0;
These track time changes seem unrelated to the band parsing. You should probably split them.