"Speaker saver" module to notify when sound is needed and when not

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

 



On 07.11.2011 22:38, Tanu Kaskinen wrote:
> On Mon, 2011-11-07 at 10:23 +0000, Colin Guthrie wrote:
>> 'Twas brillig, and Ben Bucksch at 07/11/11 02:55 did gyre and gimble:
>>> On 07.11.2011 03:34, Ben Bucksch wrote:
>>>> Is there a module that can run a (configurable) shell command when
>>>>
>>>>    * sound output is needed, i.e. an application plays a sound, and
>>>>      it's not muted
>>>>    * no sound output is needed anymore, after a certain configurable
>>>>      timeout, e.g. no sound played in the last 120 minutes
>>>>
>>>> ? Effectively, this would work exactly like a screen saver, just for
>>>> sound, not for the screen/input.
>>> FYI: Ford_Perfect pointed me to
>>> http://0pointer.de/blog/projects/device-reservation.html
>>> http://git.0pointer.de/?p=reserve.git;a=blob_plain;f=reserve.txt
>>>
>>> (if anybody has better solutions, please let me know)
>> Ahh interesting. Yeah you could use this to know when PA is playing
>> sound. All you'd need is a simple dbus integration and you could write
>> your app accordingly completely separate of PA.
>>
>> The other option is to get your hands dirty, write a module in PA and
>> use that.
> I don't see why server-side solution would be better in this case.

I didn't claim that. I agree, system-wide or not is irrelevant for this 
question.

>  Ben, you seemed to think that having mplayer on pause running all the 
> time would have this same problem. I don't think that's the case - 
> mplayer should set the stream to "corked" state while paused.
> Corked streams don't keep the sink in the "running" state, so just monitoring
> the sink state should be enough.
>

OK, great, that's good then. I wouldn't know. All I know is that I often 
have 2-3 applications listed in pavucontrol, including mplayer on pause 
often.

If that's not a problem, and pulse closes the audio device despite this 
and therefore notifies via dbus, I'm happy and can try to use this 
approach, i.e. write a small dbus app.

> (The device reservation solution might also work well, and if it does,
> it's probably the easiest solution to implement, at least if you're
> already familiar with D-Bus.)
>

Yes. I'm vaguely familiar with dbus, I used it once before. I found 
mozjs-dbus, which has a nice implementation of "listen until service 
name X appears" that I can implement in any language.

Ben


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux