Kha icon indicating copy to clipboard operation
Kha copied to clipboard

Sound crackling when changing Stream positions

Open RblSb opened this issue 6 years ago • 1 comments

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

RblSb avatar Oct 14 '19 07:10 RblSb

This can happen without channel.position, but more rarely. Will test if pause usage fixes it too.

RblSb avatar Oct 14 '19 08:10 RblSb