Changing ALSA configuration from C program

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

 



Dear alsa-users,

Recently I have used ALSA to stream audio on an embedded Linux computer 
(Gumstix Overo Air).

There are some user options for selecting the audio input source (mic or 
auxiliary).

Currently, when the user switches the audio input source, I use the 
system() function to run the following script:


---
#!/bin/sh

amixer -c 0 sset 'Analog Right AUXR' cap
amixer -c 0 sset 'Analog Left AUXL' cap
amixer -c 0 sset 'Analog Left Main Mic' nocap
amixer -c 0 sset 'Analog Right Sub Mic' nocap

/usr/sbin/alsactl -f /etc/asound.state store
---

(Depending on the audio source selected, the "cap" and "nocap" 
parameters are swapped.)

This does the job, but it seems like an inelegant solution with a number 
of potential problems.

Is there some way to accomplish the above, but using only the ALSA 
library C API?
I have looked over the API reference 
(http://www.alsa-project.org/alsa-doc/alsa-lib/index.html). As I have no 
background knowledge about how the configuration is structured from the 
API point of view, I don't even know where to begin.

Is there perhaps a tutorial that explains this more? Any help would be 
appreciated.

Thanks & best regards
Markus


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://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