Colecovision sound stutters
-
I have been debugging this, and it is the sdl2.0.5 update that has caused the issue.
Unfortunately as it is closed source, I am unable to debug it further (at least debugging coolcv), and don't know what in SDL2 would have affected it as other SDL2 apps seem ok.(Changed my mind - I can debug SDL of course) -
-
It's quite likely it's an issue with SDL2.0.5 (SDL 2.0.5 has had heaps of problems on the rpi) - I am going to try and git bisect it, but this will take some time.
If I find the commit in SDL, I will revert it or backport any fix if there is one. If I can't (and the coolcv author cannot work around it), I may be forced to switch back to SDL2.0.4 again...
-
I have found the commit that causes the issue (this references our git mirror, not the original repository)
commit f0a9a821497b8e9d3e2496a5c5ab844cdddc5e4c Author: Sam Lantinga <slouken@libsdl.org> Date: Wed Oct 12 22:25:19 2016 -0700 Work-around for a hang when USB devices are unplugged, contributed by James Zipperer diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index 3fdbd82..574d51b 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -314,9 +314,20 @@ ALSA_PlayDevice(_THIS) swizzle_alsa_channels(this, this->hidden->mixbuf, frames_left); while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) { - /* !!! FIXME: This works, but needs more testing before going live */ - /* ALSA_snd_pcm_wait(this->hidden->pcm_handle, -1); */ - int status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, + int status; + + /* This wait is a work-around for a hang when USB devices are + unplugged. Normally it should not result in any waiting, + but in the case of a USB unplug, it serves as a way to + join the playback thread after the timeout occurs */ + status = ALSA_snd_pcm_wait(this->hidden->pcm_handle, 1000); + if (status == 0) { + /*fprintf(stderr, "ALSA timeout waiting for available buffer space\n");*/ + SDL_OpenedAudioDeviceDisconnected(this); + return; + } + + status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, sample_buf, frames_left); if (status < 0) {
I will see if this has been changed in newer versions and either revert or update.
-
Please can you update retropie-setup and update coolcv and let me know if that sorts it (I reverted the problematic commit in sdl2).
-
Issue has been reported upstream to sdl here - https://bugzilla.libsdl.org/show_bug.cgi?id=3599
-
I'll try to fix fbalpha-libretro's colecovision inputs soon, that way you'll have an alternative to CoolCV.
-
@barbudreadmon that would be great :) thanks.
-
Everything is back up to speed and performing beautifully. It really does amaze me that a problem like this can be zeroed in on among an ocean of possible causes and rectified. Also, I know it doesn't "just happen", so again I thank you for taking the time to do this.
I'll try to fix fbalpha-libretro's colecovision inputs soon, that way you'll have an alternative to CoolCV.
That would be fantastic! Thank you.
-
@mediamogul , does that mean there is a new CoolCV binary to be had, with these fixes in place? What would be our best way to get it installed over the top of our existing CoolCV?
Thanks! -
There's no new binary, but BuZz fixed the root of the problem and it can be applied by using the 'Update from Binary' option for CoolCV in the RetroPie-Setup.
-
Is anyone else here running a USB sound device with CoolCV? It seems as long as my rpi3 is configured for USB sound, my screen goes blank and becomes unresponsive to any connected keyboard/controllers when I try to play any CV game (even launching a game from command line). I have to SSH in to reboot. This happens with a fresh 4.1 install to the latest 4.1.18 update with sound fix. So far everything else I use RetroPie for is fine.
-
Sounds good, I updated from binary (think I did) and it didnt seem to change, I'm sure Im doing it wrong.
For the newbies out here may just give us a quick guide.
-
@raymate you didn't update retropie-setup.
-
My bad. I forgot to reiterate that above.
-
my screen goes blank and becomes unresponsive to any connected keyboard/controllers when I try to play any CV game
I can't speak to the keyboard controls, but you might try adding the following to
/opt/retropie/configs/all/runcommand-onstart.sh
and see if it solves the screen issue. It was used to solve a similar issue in Kodi a while back and may work here.if [ "$2" = "coolcv" ] then fbset -depth 8 fbset -depth 32 fi
-
OK did from script and it works, sound normal. Perfect thank to all your hard work
-
@mediamogul said in Colecovision sound stutters:
my screen goes blank and becomes unresponsive to any connected keyboard/controllers when I try to play any CV game
I can't speak to the keyboard controls, but you might try adding the following to
/opt/retropie/configs/all/runcommand-onstart.sh
and see if it solves the screen issue. It was used to solve a similar issue in Kodi a while back and may work here.if [ "$2" = "coolcv" ] then fbset -depth 8 fbset -depth 32 fi
I tried as you suggested but it didn't work. I did find out what the problem was. I used the /etc/modprobe.d/alsa-base.conf method of setting the sound device but had to use the /etc/asound.conf method. All seems to be working great now.
Thanks.
-
@BuZz i have an ip address showing but when i try to update setup script so i can update coolcv i am getting this error:
I even rebooted my pi and same thing. Tested in basilisk and i have internet connection.
-
@barbudreadmon said in Colecovision sound stutters:
I'll try to fix fbalpha-libretro's colecovision inputs soon, that way you'll have an alternative to CoolCV.
Yes please! 😀
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.