From 777002030d7427c2e1437736018192bfa92746fa Mon Sep 17 00:00:00 2001 From: na Date: Mon, 7 Sep 2026 13:16:25 +0200 Subject: [PATCH] Hacky hack See comment in code. --- cimp.bas | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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