LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Respond to ALSA events? (https://www.linuxquestions.org/questions/programming-9/respond-to-alsa-events-326482/)

apberzerk 05-24-2005 12:48 AM

Respond to ALSA events? [SOLVED]
 
Hi, I have been messing with the ALSA API and writing C programs to control the volume. I would also like a way to execute a piece of code when an ALSA event occurs. Specifically, I want to do something when the volume changes.

First of all, does anyone know of an easy way to do this through ALSA configuration files. Second, does anyone know of a way to do this by writing code for it manually and using the ALSA API. This stuff isn't very well documented and I have been unable to find anything on it yet.

Thanks.

Linux.tar.gz 05-24-2005 08:43 PM

I dont know if it helps you, but you can control mixer with a command line like this:
amixer set DAC 10+
amixer set DAC,1 10+
etc... man amixer.

apberzerk 05-24-2005 09:58 PM

Yeah, I was doing that, but I started to desire a way to control the mixer through my own C program. I wanted my own daemon to do some certain things.

Anyway, it turns out that snd_mixer_wait, in the ALSA API, is the function I wanted. It will cause the program to sleep until a mixer event occurs (i.e. the volume changes).

- Phil

Linux.tar.gz 05-24-2005 10:52 PM

I'm not a C programmer, but i think looking at amixer source code could be full of learnings.

apberzerk 05-24-2005 11:09 PM

Solved
 
Yup, that is what I did to figure out how to do what I wanted to do. I've got a working C program now, which does exactly what I want to do.

- Phil


All times are GMT -5. The time now is 09:37 PM.