Log In  

I seem to have found a weird bug. Normally sfx(-1, -2) will stop sfx on all channels, but if it is triggered by a menuitem callback, it doesn't work; in that case only explicitly stopping sfx on each channel works

to reproduce, enter some notes on sfx 8 (so you can hear when playback stops), then use this code and compare the behavior of the two menu items:

function stop_all_sfx_short()
  sfx(-1, -2)
end

function stop_all_sfx_long()
  for i = 0, 3 do
    sfx(-1, i)
  end
end

function _init()
  menuitem(1, 'stop sfx (-2)', stop_all_sfx_short)
  menuitem(2, 'stop sfx (long)', stop_all_sfx_long)

  sfx(8)
end

function _update()
end

function _draw()
end
P#84681 2020-11-25 21:37 ( Edited 2020-11-25 21:38)


[Please log in to post a comment]