LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-24-2005, 12:48 AM   #1
apberzerk
Member
 
Registered: Sep 2003
Location: kansas....
Distribution: gentoo
Posts: 51

Rep: Reputation: 15
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.

Last edited by apberzerk; 05-24-2005 at 11:09 PM.
 
Old 05-24-2005, 08:43 PM   #2
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
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.
 
Old 05-24-2005, 09:58 PM   #3
apberzerk
Member
 
Registered: Sep 2003
Location: kansas....
Distribution: gentoo
Posts: 51

Original Poster
Rep: Reputation: 15
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
 
Old 05-24-2005, 10:52 PM   #4
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
I'm not a C programmer, but i think looking at amixer source code could be full of learnings.
 
Old 05-24-2005, 11:09 PM   #5
apberzerk
Member
 
Registered: Sep 2003
Location: kansas....
Distribution: gentoo
Posts: 51

Original Poster
Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alsa on games makes the keyboard and mouse respond with a 15 sec. delay Ac1db0rN Linux - Hardware 4 03-24-2005 03:13 PM
alsa sound stops in mmap mode with events/0 spike Moloko Debian 0 02-02-2005 06:34 AM
keyboard does not respond reaz82 Slackware 11 07-28-2004 06:39 PM
Modem does not respond ricemark20 Linux - Networking 1 08-28-2003 11:25 AM
modem does not respond willo Linux - Newbie 4 11-17-2001 03:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration