I've developed a small application that records sound using ALSA driver on an embedded system.
Now I have a problem selecting the device that I want to record from MIC/Line IN .
The application is set to start at system start up but my default recording device is set to MIC. For my app to work I have to go to amixer and set the recording device from MIC to Line IN and then start my app.
Do you guys know a way to do this change from the app or amixer command that will change this recording device and I can put it in a script an run it at start up.
Has I said this app is running on a embedded system and I need a way to conf the system before my app starts.
EDIT1:
here is my amixer output:
root@freescale ~$ amixer
Simple mixer control 'Headphone',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 127
Front Left: 103 [81%]
Front Right: 103 [81%]
Simple mixer control 'Playback',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 192
Front Left: 192 [100%]
Front Right: 192 [100%]
Simple mixer control 'Capture',0
Capabilities: cvolume
Capture channels: Front Left - Front Right
Limits: Capture 0 - 15
Front Left: Capture 15 [100%]
Front Right: Capture 15 [100%]
Simple mixer control 'Capture Vol Reduction',0
Capabilities: enum
Items: 'No Change' 'Reduced by 6dB'
Item0: 'No Change'
Simple mixer control 'ADC Mux',0
Capabilities: enum
Items: 'MIC_IN' 'LINE_IN'
Item0: 'MIC_IN'
Simple mixer control 'DAC Mux',0
Capabilities: enum
Items: 'DAC' 'LINE_IN'
Item0: 'DAC'
Simple mixer control 'MIC GAIN',0
Capabilities: enum
Items: '0dB' '20dB' '30dB' '40dB'
Item0: '0dB'
Thanks a lot, Gabriel
I finally did it. I'm using amixer with "cset" command to do it.
amixer -c 0 cset numid=7 1
"-c 0" is the first sound card
"numid=7" is the recording device that is active.
"1" is the second intput ... in my case 0-MIC 1-LINEIN
amixer info
Gets all the controls with their numids ex:
amixer info
Card default 'mxsevk'/'mxs-evk (SGTL5000)'
Mixer name : ''
Components : ''
Controls : 7
Simple ctrls : 7
root@freescale ~$ amixer contents
numid=5,iface=MIXER,name='Headphone Volume'
; type=INTEGER,access=rw---,values=2,min=0,max=127,step=0
: values=103,103
numid=7,iface=MIXER,name='ADC Mux'
; type=ENUMERATED,access=rw---,values=1,items=2
; Item #0 'MIC_IN'
; Item #1 'LINE_IN'
: values=1
numid=3,iface=MIXER,name='Capture Vol Reduction'
; type=ENUMERATED,access=rw---,values=1,items=2
; Item #0 'No Change'
; Item #1 'Reduced by 6dB'
: values=0
numid=2,iface=MIXER,name='Capture Volume'
; type=INTEGER,access=rw---,values=2,min=0,max=15,step=0
: values=15,15
numid=4,iface=MIXER,name='Playback Volume'
; type=INTEGER,access=rw---,values=2,min=0,max=192,step=0
: values=192,192
numid=6,iface=MIXER,name='DAC Mux'
; type=ENUMERATED,access=rw---,values=1,items=2
; Item #0 'DAC'
; Item #1 'LINE_IN'
: values=0
numid=1,iface=MIXER,name='MIC GAIN'
; type=ENUMERATED,access=rw---,values=1,items=4
; Item #0 '0dB'
; Item #1 '20dB'
; Item #2 '30dB'
; Item #3 '40dB'
: values=0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With