SOLVED! No sound on raspbian/Pi4
webspacecreations opened this issue · comments
Running latest Raspberry Pi Desktop. Followed instructions for Retropie-Setup, then compiled. Sound doesn't work on the latest (as of today) repo. With prior versions of GSplus, I was able to get mangled sound by issuing 'aoss GSplus' to route sound through the ALSA OSS compatibility layer, but this doesn't work at all now.
As a point of reference, routing sound through aoss works flawlessly on GSport, so perhaps it's an SDL thing?
master branch is missing the src/vars_* fileset. The v015 branch contains the src/vars_* fileset and sound is audible, but "scratchy" or "blown out" on Pi 4 / Raspbian. Not sure if this is a problem with SDL2... sound works fine on other SDL1.2 based A2 emulators.
FWIW, a temporary workaround to high background noise / static / audio blowout is to pass the -arate switch with a value of 12000 or less. Far from ideal, but a lot less annoying.
In diagnosing sound problems for https://github.com/linappleii/linapple I found a similar solution for GSplus. The following code change resolves sound problems for Pi4 without needing to reduce sampling frequency:
Open sdl2snd_driver.c. Go to line 134. Change from:
wanted.samples = 512;
to:
wanted.samples = 2048;
This same value resolves issues for the Linapple code as well. The comment within Linapple states "I just do not know what number of samples use," so it seems that the "samples" value for SDL1/2 is poorly understood in general. According to SDL2 documentation "When the SDL_AudioSpec is used with SDL_LoadWAV() samples is set to 4096" (https://wiki.libsdl.org/SDL_AudioSpec#Remarks). The default in Linapple of 1024 and 512 in GSplus are both problematic. 2048 represents a reasonable balance between both and the 4096 SDL itself uses as a default for WAV files.
Have you found a way to "quit" the emulator on the Raspberry Pi? I cannot find a hot key that will work 100% of the time.