All of lore.kernel.org
 help / color / mirror / Atom feed
* Sound detection
@ 2007-01-21 12:39 Andreas Corneliussen
  2007-01-25 12:36 ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Corneliussen @ 2007-01-21 12:39 UTC (permalink / raw)
  To: alsa-devel

Hi
I've just build a mediacenter, and is about to construct an hifi 
amplifier for it. Therefore i would like to know a way to make alsa 
detect when nothing is playing at the output, and then run a external 
command. And detect when something has started playing at the output, 
and run an external command before any output is generatet.
This I would like to do, because I then could make an interface between 
the amplifier and the computer to make sure that it does not use anymore 
standbypower than needed.

Any help would be appreciatet.

Regards
Andreas

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sound detection
  2007-01-21 12:39 Sound detection Andreas Corneliussen
@ 2007-01-25 12:36 ` Takashi Iwai
  2007-01-25 16:03   ` Liam Girdwood
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2007-01-25 12:36 UTC (permalink / raw)
  To: Andreas Corneliussen; +Cc: alsa-devel

At Sun, 21 Jan 2007 13:39:35 +0100,
Andreas Corneliussen wrote:
> 
> Hi
> I've just build a mediacenter, and is about to construct an hifi 
> amplifier for it. Therefore i would like to know a way to make alsa 
> detect when nothing is playing at the output, and then run a external 
> command. And detect when something has started playing at the output, 
> and run an external command before any output is generatet.
> This I would like to do, because I then could make an interface between 
> the amplifier and the computer to make sure that it does not use anymore 
> standbypower than needed.

It's an interesting question.  Currently, there is no good framework
for such a functionality, so you need to build something new.

Maybe the easiest solution is to route the all audio I/O through a
sound server and let the sound server do the proper power management.
Alternatively, you can modify the dmix and dsnoop plugins so that some
power-management codes can be called at the first-open and the
last-close.

In both cases, the power-off shouldn't be sent too immediately after
the last close.  Otherwise you may get often click noises by bad apps
that open/close too frequently just for reset, etc. 


Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sound detection
  2007-01-25 12:36 ` Takashi Iwai
@ 2007-01-25 16:03   ` Liam Girdwood
  2007-01-25 16:09     ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Liam Girdwood @ 2007-01-25 16:03 UTC (permalink / raw)
  To: Andreas Corneliussen; +Cc: Takashi Iwai, alsa-devel

On Thu, 2007-01-25 at 13:36 +0100, Takashi Iwai wrote:
> At Sun, 21 Jan 2007 13:39:35 +0100,
> Andreas Corneliussen wrote:
> > 
> > Hi
> > I've just build a mediacenter, and is about to construct an hifi 
> > amplifier for it. Therefore i would like to know a way to make alsa 
> > detect when nothing is playing at the output, and then run a external 
> > command. And detect when something has started playing at the output, 
> > and run an external command before any output is generatet.
> > This I would like to do, because I then could make an interface between 
> > the amplifier and the computer to make sure that it does not use anymore 
> > standbypower than needed.
> 
> It's an interesting question.  Currently, there is no good framework
> for such a functionality, so you need to build something new.
> 

Fwiw, the Dynamic Audio Power Management code in ASoC (Alsa for SoC
devices) does this very thing. Please feel free to have a look and take
code if required.

http://opensource.wolfsonmicro.com/~lg/asoc/

Liam


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sound detection
  2007-01-25 16:03   ` Liam Girdwood
@ 2007-01-25 16:09     ` Takashi Iwai
  2007-01-25 16:21       ` Liam Girdwood
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2007-01-25 16:09 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: Andreas Corneliussen, alsa-devel

At Thu, 25 Jan 2007 16:03:29 +0000,
Liam Girdwood wrote:
> 
> On Thu, 2007-01-25 at 13:36 +0100, Takashi Iwai wrote:
> > At Sun, 21 Jan 2007 13:39:35 +0100,
> > Andreas Corneliussen wrote:
> > > 
> > > Hi
> > > I've just build a mediacenter, and is about to construct an hifi 
> > > amplifier for it. Therefore i would like to know a way to make alsa 
> > > detect when nothing is playing at the output, and then run a external 
> > > command. And detect when something has started playing at the output, 
> > > and run an external command before any output is generatet.
> > > This I would like to do, because I then could make an interface between 
> > > the amplifier and the computer to make sure that it does not use anymore 
> > > standbypower than needed.
> > 
> > It's an interesting question.  Currently, there is no good framework
> > for such a functionality, so you need to build something new.
> > 
> 
> Fwiw, the Dynamic Audio Power Management code in ASoC (Alsa for SoC
> devices) does this very thing. Please feel free to have a look and take
> code if required.

But it doesn't communicate with the user-space, right?
I supposed that the power-management stuff isn't built in the driver
itself...


Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sound detection
  2007-01-25 16:09     ` Takashi Iwai
@ 2007-01-25 16:21       ` Liam Girdwood
  2007-01-25 16:32         ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Liam Girdwood @ 2007-01-25 16:21 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Andreas Corneliussen, alsa-devel

On Thu, 2007-01-25 at 17:09 +0100, Takashi Iwai wrote:
> At Thu, 25 Jan 2007 16:03:29 +0000,
> Liam Girdwood wrote:
> > 
> > On Thu, 2007-01-25 at 13:36 +0100, Takashi Iwai wrote:
> > > At Sun, 21 Jan 2007 13:39:35 +0100,
> > > Andreas Corneliussen wrote:
> > > > 
> > > > Hi
> > > > I've just build a mediacenter, and is about to construct an hifi 
> > > > amplifier for it. Therefore i would like to know a way to make alsa 
> > > > detect when nothing is playing at the output, and then run a external 
> > > > command. And detect when something has started playing at the output, 
> > > > and run an external command before any output is generatet.
> > > > This I would like to do, because I then could make an interface between 
> > > > the amplifier and the computer to make sure that it does not use anymore 
> > > > standbypower than needed.
> > > 
> > > It's an interesting question.  Currently, there is no good framework
> > > for such a functionality, so you need to build something new.
> > > 
> > 
> > Fwiw, the Dynamic Audio Power Management code in ASoC (Alsa for SoC
> > devices) does this very thing. Please feel free to have a look and take
> > code if required.
> 
> But it doesn't communicate with the user-space, right?

Your right, it only powers on board components and can't communicate
with user-space atm.

> I supposed that the power-management stuff isn't built in the driver
> itself...
> 

The codec and machine power maps are in the driver, but it's controlled
via the ASoC core (and ultimately via alsa-lib)

Liam



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sound detection
  2007-01-25 16:21       ` Liam Girdwood
@ 2007-01-25 16:32         ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2007-01-25 16:32 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: Andreas Corneliussen, alsa-devel

At Thu, 25 Jan 2007 16:21:43 +0000,
Liam Girdwood wrote:
> 
> On Thu, 2007-01-25 at 17:09 +0100, Takashi Iwai wrote:
> > At Thu, 25 Jan 2007 16:03:29 +0000,
> > Liam Girdwood wrote:
> > > 
> > > On Thu, 2007-01-25 at 13:36 +0100, Takashi Iwai wrote:
> > > > At Sun, 21 Jan 2007 13:39:35 +0100,
> > > > Andreas Corneliussen wrote:
> > > > > 
> > > > > Hi
> > > > > I've just build a mediacenter, and is about to construct an hifi 
> > > > > amplifier for it. Therefore i would like to know a way to make alsa 
> > > > > detect when nothing is playing at the output, and then run a external 
> > > > > command. And detect when something has started playing at the output, 
> > > > > and run an external command before any output is generatet.
> > > > > This I would like to do, because I then could make an interface between 
> > > > > the amplifier and the computer to make sure that it does not use anymore 
> > > > > standbypower than needed.
> > > > 
> > > > It's an interesting question.  Currently, there is no good framework
> > > > for such a functionality, so you need to build something new.
> > > > 
> > > 
> > > Fwiw, the Dynamic Audio Power Management code in ASoC (Alsa for SoC
> > > devices) does this very thing. Please feel free to have a look and take
> > > code if required.
> > 
> > But it doesn't communicate with the user-space, right?
> 
> Your right, it only powers on board components and can't communicate
> with user-space atm.
> 
> > I supposed that the power-management stuff isn't built in the driver
> > itself...
> > 
> 
> The codec and machine power maps are in the driver, but it's controlled
> via the ASoC core (and ultimately via alsa-lib)

Yes, I understand the ASoC design :)

Just to clarify:
My comment above refers the fact that the power-mangement outside of
the sound-chip/controller might be necessary to be accessed from the
outside, preferablly from a user-space tool.  I just guessed this case
is like so.  But, it might be, of course, much easier to do in the
driver code depending on the hardware design.


Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-01-25 16:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-21 12:39 Sound detection Andreas Corneliussen
2007-01-25 12:36 ` Takashi Iwai
2007-01-25 16:03   ` Liam Girdwood
2007-01-25 16:09     ` Takashi Iwai
2007-01-25 16:21       ` Liam Girdwood
2007-01-25 16:32         ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.