Re: How can you programmatically tell that audio is playing?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le Fri, 26 Dec 2008 11:53:48 -0500,Christian Brink <cbrink@xxxxxxxxxxxx> a écrit :
> J. Pauli wrote:> > Christian Brink wrote:> >   > >> How can you programmatically tell that audio is playing or at least > >> being sent to the soundcard?> >>> >> I've got an application that occasionally fails to pick up a remote > >> stream, but the process hangs around so I can't tell that it failed just > >> by checking the process list. I would like to be able to tell if  the > >> application is sending audio or not so I can retry.> >>> >> I've checked the archives, googled, and tried cat'ing /dev/audio (which > >> seems to return data whether or not audio is playing).> >>> >>     > >> > Check the files> > /proc/asound/cardX/pcmYp/subZ/[status|hw_params|sw_params], where X,Y> > and Z is the soundcard, device and subdevice you want to monitor. If> > nothing is being sent to the soundcard it should contain "closed".> > Unfortunately you need to activate "verbose proc something" in your> > kernel, which most distributions don't have by default.> >> > I've also written some small (and really buggy) program to monitor all> > devices and subdevices of a soundcard but you still need that kernel> > option or it will crash. You can get it here:> > http://stinfwww.informatik.uni-leipzig.de/~mai00bgn/aproc/ (source code> > only). Sorry for the propaganda.> >> >   > Jan -> > Thanks for the info, it's been a great help. I had a couple more > questions if you'd being willing to help.> > I've been doing some testing on a couple of different machines (Fedora > and Deb). 'closed' only seems to show up when the card is not "open" by > an application. So if I have a mp3 player app open (Rhythmbox for > example) but not playing or paused, it shows the card not "closed" even > though no music is playing.> Is this normal?
A paused application just pause the playing but doesn't close the thread thatmake the playing, so the card will still "see" the app.
If you make a stop instead of pause, a good written app would close the threadthat make the playing and the card would not "see" the app anymore.
> or is this the difference between having the kernel flag on and not?
I don't know.
Ciao,Dominique
------------------------------------------------------------------------------_______________________________________________Alsa-user mailing listAlsa-user@xxxxxxxxxxxxxxxxxxxxxxxxxx://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux