diff --git a/cimp.bas b/cimp.bas index 3aa6243..f70f384 100644 --- a/cimp.bas +++ b/cimp.bas @@ -250,13 +250,22 @@ while keyin<>27 elseif left$(client_cmd, 10) = "SOUNDBANK:" then loadsoundbank mid$(client_cmd,11) if _SNDPLAYING(musichandle) then - oldhandle=musichandle + + ' a hack to make qb64pe load the midi file that is already loaded. + ' qb64 can't open the same file again with a new sound bank for some reason + ' so it has to be closed, freed and given a short delay before reloading + ' which gives a short break in the playing of music, very annoying. + ' this should be reverted if qb64pe ever gets the ability to reload the same + ' file more than once. + + tmppos=_sndgetpos(musichandle) + _sndstop musichandle + _sndclose musichandle + _delay .1 musichandle=_sndopen(file(i)) _sndvol musichandle,volume + _sndsetpos musichandle,tmppos _sndplay musichandle - _sndsetpos musichandle, _sndgetpos(oldhandle) - _sndstop oldhandle - _sndclose oldhandle end if elseif left$(client_cmd, 4) = "VOL:" then volume = val(mid$(client_cmd, 5)) / 100