Godot-steam-audio version
master (commit 8742aa3)
Operating System
macOS (Apple Silicon)
Describe the bug
When is_ambisonics_on is false, the output buffer (bufs.out) is never cleared between mix frames. iplAudioBufferMix adds into the destination buffer rather than replacing it, so each frame's audio accumulates on top of the previous frame's data. The result is audio that gets progressively louder and never decays.
When ambisonics is on, iplAmbisonicsDecodeEffectApply writes (replaces) into bufs.out, so the problem doesn't occur.
Root cause
In stream.cpp line ~135, the non-ambisonics path:
iplAudioBufferMix(gs->ctx, &ls->bufs.direct, &ls->bufs.out);
needs bufs.out to be zeroed before the mix, e.g.:
for (int i = 0; i < ls->bufs.out.numChannels; i++) {
memset(ls->bufs.out.data[i], 0, ls->bufs.out.numSamples * sizeof(float));
}
iplAudioBufferMix(gs->ctx, &ls->bufs.direct, &ls->bufs.out);
To Reproduce
- Set
is_ambisonics_on = false on a SteamAudioPlayer (currently requires code change since the property isn't exposed in the inspector on master)
- Play audio
- Audio gets louder each frame and never stops
Note
This bug is currently hard to trigger since is_ambisonics_on has no inspector property or GDScript binding on master. It becomes easily reproducible if #127 lands (which exposes the ambisonics toggle).
Godot-steam-audio version
master (commit 8742aa3)
Operating System
macOS (Apple Silicon)
Describe the bug
When
is_ambisonics_onisfalse, the output buffer (bufs.out) is never cleared between mix frames.iplAudioBufferMixadds into the destination buffer rather than replacing it, so each frame's audio accumulates on top of the previous frame's data. The result is audio that gets progressively louder and never decays.When ambisonics is on,
iplAmbisonicsDecodeEffectApplywrites (replaces) intobufs.out, so the problem doesn't occur.Root cause
In
stream.cppline ~135, the non-ambisonics path:iplAudioBufferMix(gs->ctx, &ls->bufs.direct, &ls->bufs.out);needs
bufs.outto be zeroed before the mix, e.g.:To Reproduce
is_ambisonics_on = falseon a SteamAudioPlayer (currently requires code change since the property isn't exposed in the inspector on master)Note
This bug is currently hard to trigger since
is_ambisonics_onhas no inspector property or GDScript binding on master. It becomes easily reproducible if #127 lands (which exposes the ambisonics toggle).