SFML community forums

Help => Audio => Topic started by: lzr on July 05, 2008, 03:51:45 am

Title: Audio "Clicks" on Linux
Post by: lzr on July 05, 2008, 03:51:45 am
I have no idea what is going on, but on every computer I've tested, which is so far 3, the audio in my SFML-based game "clicks" and has general low quality. Has anyone gotten the audio to sound good without glitches? I didn't want to release it until it was finished (the only thing left to fix is the sound), but if you want you can try my game so far and tell me if you get the annoying audio clicks: http://lzr.cc/games/ovidlinux.tar.gz . It's just a little frustrating cause I'm so close to releasing the Linux port of the game, if it wasn't for this one little issue. I'm using a Sound Blaster Live! sound card on my computer, and openal-soft. I also tried a different implementation of openal made specifically for my sound card at one point, but it didn't make a difference. If you do get it or another SFML program to work, which I'm sure has been done, I'd like to know what sound card/openal implementation/anything else that might be useful that you used.
Title: Audio "Clicks" on Linux
Post by: Laurent on July 13, 2008, 07:47:56 am
I fixed it today, can you try and confirm that everything's ok for you ?
Title: Audio "Clicks" on Linux
Post by: Avency on July 13, 2008, 01:33:28 pm
It still clicks for me...
Title: Audio "Clicks" on Linux
Post by: Laurent on July 13, 2008, 01:41:13 pm
I recently made changes to makefiles and binaries names; make sure you're not using old builds of SFML (I faced this problem a few times after I changed the makefiles), use make clean, remove the old files, etc...

Then tell me which revision you're using : I made several versions of the fix, and I'm not sure the very last one works under Linux.
Title: Audio "Clicks" on Linux
Post by: Avency on July 13, 2008, 02:14:33 pm
Here is what ldd says:

Code: [Select]
linux-gate.so.1 =>  (0xb7f3d000)
libsfml-audio.so.1.3 => /usr/lib/libsfml-audio.so.1.3 (0xb7efe000)
libsfml-system.so.1.3 => /usr/lib/libsfml-system.so.1.3 (0xb7ef9000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e0a000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7de4000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7dd6000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7c78000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7c5f000)
libsndfile.so.1 => /usr/lib/libsndfile.so.1 (0xb7c03000)
libopenal.so.1 => /usr/lib/libopenal.so.1 (0xb78bf000)
/lib/ld-linux.so.2 (0xb7f3e000)
libFLAC.so.8 => /usr/lib/libFLAC.so.8 (0xb786c000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7868000)
libogg.so.0 => /usr/lib/libogg.so.0 (0xb7862000)


I assume that those are the right ones.
I'm using the latest revision (rev 768).
Title: Audio "Clicks" on Linux
Post by: Laurent on July 13, 2008, 03:17:01 pm
Ok. Can you try compiling SFML in debug mode ? (make DEBUGBUILD=yes)
Title: Audio "Clicks" on Linux
Post by: Avency on July 13, 2008, 03:41:05 pm
You're right. The problem is gone when I select the debug build.
Can you tell what causes the problem? Has it something to do with optimization?
Title: Audio "Clicks" on Linux
Post by: Laurent on July 13, 2008, 04:01:01 pm
Yes, it has something to do with optimization. It seems the fast float-to-int trick used in stb_vorbis causes some problems when optimized. After a discussion with the author, he made a fix which works with VC++, but apparently not with gcc.

I've disabled the fast float-to-int trick, so now it should work fine even in release build.

Thanks for your feedback :)