Kha
Kha copied to clipboard
Sound crackling when changing Stream positions
channel = Audio.stream(sound, loop);
// ten seconds later
channel.stop();
channel = Audio.stream(sound, loop);
// or channel.position = something.
Incorrect sound restarting after channel.position = foo and this problem happen because of uncleared samples data before next stream() call. Works fine in this situation:
channel = Audio.stream(sound, loop);
// ten seconds later
channel.pause();
channel = Audio.stream(sound, loop);
// another ten seconds later
channel.pause();
channel.position = something;
channel.play();
I guess this code block should be in stop/set_position and maybe in other places:
https://github.com/Kode/Kha/blob/master/Backends/Kore/kha/audio2/StreamChannel.hx#L45
This can happen without channel.position, but more rarely. Will test if pause usage fixes it too.