Pulseaudio: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
record several sources. | record several sources. | ||
Audiosink with several sources. | |||
#!/bin/bash | |||
### This script sets up two loopback virtual devices and a null sink | |||
### which can then be used to mix inputs and record the result. | |||
### It requires a functioning PulseAudio installation and also | |||
### PulseAudio Volume Control to manage the streams. | |||
# License: GPL 2 or later | |||
# Author: clareoldie | |||
# Date: June 1st 2012 | |||
set -x | |||
unload-modules () { | |||
### First detect then unload loopback devices | |||
for i in $(pactl list | grep -B 1 'Name: module-loopback' | grep 'Module #' | cut -d '#' -f 2-) | |||
do | |||
pactl unload-module $i | |||
done | |||
### Next detect and unload the Null-Sink device/s | |||
for i in $(pactl list | grep -B 1 'Name: module-null-sink' | grep 'Module #' | cut -d '#' -f 2-) | |||
do | |||
pactl unload-module $i | |||
done | |||
} | |||
load-modules () { | |||
### Load required modules | |||
pactl load-module module-null-sink sink_name=MySink | |||
pactl load-module module-loopback sink=MySink | |||
pactl load-module module-loopback sink=MySink | |||
} | |||
test-modules () { | |||
## If the modules exist 0$?=0 then unload them, else load them. | |||
pactl list | grep -B 1 'Name: module-loopback' | |||
if [ "$?" = "0" ] | |||
then | |||
unload-modules | |||
exit 0 | |||
fi | |||
pactl list | grep -B 1 'Name: module-null-sink' | |||
if [ "$?" = "0" ] | |||
then | |||
unload-modules | |||
exit 0 | |||
else | |||
load-modules | |||
fi | |||
} | |||
### Main Programme | |||
test-modules | |||
http://www.pclinuxos.com/forum/index.php/topic,105968.0.html | http://www.pclinuxos.com/forum/index.php/topic,105968.0.html |
Revision as of 18:54, 10 March 2013
record several sources.
Audiosink with several sources.
#!/bin/bash ### This script sets up two loopback virtual devices and a null sink ### which can then be used to mix inputs and record the result. ### It requires a functioning PulseAudio installation and also ### PulseAudio Volume Control to manage the streams. # License: GPL 2 or later # Author: clareoldie # Date: June 1st 2012 set -x unload-modules () { ### First detect then unload loopback devices for i in $(pactl list | grep -B 1 'Name: module-loopback' | grep 'Module #' | cut -d '#' -f 2-) do pactl unload-module $i done ### Next detect and unload the Null-Sink device/s for i in $(pactl list | grep -B 1 'Name: module-null-sink' | grep 'Module #' | cut -d '#' -f 2-) do pactl unload-module $i done } load-modules () { ### Load required modules pactl load-module module-null-sink sink_name=MySink pactl load-module module-loopback sink=MySink pactl load-module module-loopback sink=MySink } test-modules () { ## If the modules exist 0$?=0 then unload them, else load them. pactl list | grep -B 1 'Name: module-loopback' if [ "$?" = "0" ] then unload-modules exit 0 fi pactl list | grep -B 1 'Name: module-null-sink' if [ "$?" = "0" ] then unload-modules exit 0 else load-modules fi } ### Main Programme test-modules
http://www.pclinuxos.com/forum/index.php/topic,105968.0.html