#setup a shell thru IPC to carry out different # mixer and v4l2 control commands my $pidcon = open3(\*CON,0,0,'/bin/sh'); # then later use it like this &mic_con(1); #turn on Mic sub mic_con{ my $con = shift; if($con == 1){ #turn Mic on to max for recording #turn off playback to avoid feedback squeal print CON "amixer cset name='AC97 Playback Volume', 0\n"; #switch the capture to Mic print CON "amixer sset Mic Capture cap\n"; #turn up maximum Mic gain print CON "amixer cset name='Mic Playback Volume', 100\n"; #turn on Mic +20db boost print CON "amixer cset name='Mic Boost (+20dB)', 1\n"; } if($con == 0){ #restore old Line settings #turn off Mic by changing capture to Line print CON "amixer sset Line Capture cap\n"; #turn off Mic +20db boost print CON "amixer cset name='Mic Boost (+20dB)', 0\n"; #restore normal capture volume print CON "amixer cset name='AC97 Playback Volume', 88\n"; } }