[Vorbis] Looping issues in ogg vorbis in Godot 4 engine

Benjamin loesch.benny92 at gmx.de
Sun Aug 27 18:51:42 UTC 2023


Hi,

Currently in Godot, we need some help to fix audio pops during looping.
We decode it ourselves and don't use vorbisfile.

We strongly guess that we're sometimes not sample accurate enough during
seeking and missing something.

Here's a pull request featuring some internal fixes:
https://github.com/godotengine/godot/pull/80452/files

I think it also lists the most vital files in regards to decoding,
seeking, mixing of ogg vorbis files (excluding the minimp3 folder).

Some notes to orient yourself more quickly:

* In audio_stream_ogg_vorbis.cpp, we delay the looping/seeking until all
frames from `vorbis_synthesis_pcmout` are consumed using the last
if-clause in `AudioStreamPlaybackOggVorbis::_mix_frames_vorbis`. Only
then is `if (!have_packets_left && !have_samples_left)` true.

* So the problem is most likely in `AudioStreamPlaybackOggVorbis::seek`
(audio_stream_ogg_vorbis.cpp)


Side note:

The PR author has been informed about the double calling of
`vorbis_synthesis_restart` & Co. in lines 317-327.


Any help would be greatly appreciated!

Cheers!



More information about the Vorbis mailing list