[mythtv] ALSA sound patch

James Y. Knight foom at fuhm.net
Thu Aug 28 21:56:18 EDT 2003

On Thursday, August 28, 2003, at 06:19  PM, John Knottenbelt wrote:
> Hello everyone
> Attached is a patch (again mythtv cvs 28/08/2003) which adds ALSA as a
> possible sound device to the configuration menus in the front-end. 
> This is
> different to using ALSA's OSS emulation API.
> Additionally some tweaks to the ALSA sound module, which make it work 
> (at
> least on my machine) when it was stuttering badly before.

Hi, thanks a lot for looking at the ALSA code! I've been meaning to get 
back to it for a while but various things (work, hardware failure of my 
myth box after being struck by lightning) have been conspiring against 
me. Anyhow, a few comments:
1) The changes to the 'audiodevice = "/dev/dsp";' lines shouldn't be 
necessary, since I'm pretty sure it gets set somewhere else.
2) If you're getting stuttering, there's certainly some problem, but it 
seems unlikely that snd_pcm_wait is the right solution, since 
AddSamples is supposed to be (usually) non-blocking. I'm surprised that 
putting in code that can cause it to block for up to 1/10th of a second 
actually works. Do you have some reason to believe that's the right 
thing to do, or did you just randomly try it and it worked?
3) "ALSA:default" should probably only be added to the menu if ALSA is 
compiled in.

While I'm at it, here's a status report of where things stand with me.

- ALSA sound output from mythtv works right for me, hopefully works for 
some other people too.

- Mythmusic is half converted to use the AudioOutput interface (not its 
own audio code). What's remaining (and has been remaining for a while) 
is to change the mythmusic code that requires feedback events from the 
audio output layer back to the GUI (OutputEvent::*). I got tired of 
working on this code and stalled.

- I'm also and about halfway through reworking NuppelVideoRecorder to 
use an AudioInput interface (and thus support ALSA input). I'm actually 
actively working on this part now, so it may yet be finished. I just 
gotta be careful since if I break my mythtv backend when it's supposed 
to be recording an important TV show I risk being banned from touching 
it. :)

- I haven't started looking at how to do configuration in myth to 
autodetect if ALSA is installed and what devices you have and add them 
to the sound device menu.

- Another thing that might be cool to do at some point is enable raw 
AC3 SPDIF output through the ALSA audio output. This doesn't look to be 
too hard, as there are other projects the code can mostly be 
copy/pasted from. However, I have no way of testing any such support as 
I have nothing that supports SPDIF other than my myth box, so I'm 
reluctant to even try coding this.


More information about the mythtv-dev mailing list