summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2014-10-01 18:42:49 +0200
committerJonathan Bauer2014-10-01 18:42:49 +0200
commitc570a6c8f648502a993e5ee6feb5dd447103fcb9 (patch)
tree2fcb2deec31bc98623b9d7d0df08e19203f95448
parent[vmchooser2] Update openslx.exe: Mute sound on Windows Vista and newer (diff)
downloadtm-scripts-c570a6c8f648502a993e5ee6feb5dd447103fcb9.tar.gz
tm-scripts-c570a6c8f648502a993e5ee6feb5dd447103fcb9.tar.xz
tm-scripts-c570a6c8f648502a993e5ee6feb5dd447103fcb9.zip
[vm*] set default sound card for vmware instead of using auto-detect
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt48
-rwxr-xr-xremote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt48
-rw-r--r--remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include4
3 files changed, 68 insertions, 32 deletions
diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
index 5c697d6c..2f3a9403 100755
--- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
@@ -438,14 +438,32 @@ else
VOL="85%"
fi
if true; then
- echo "Setting up volume..."
+ # detecting which card is to be used
+ echo "Detecting which sound card to use ..."
+ PROC="/proc/asound/cards"
+ if [ ! -r "$PROC" ]; then
+ echo "'${PROC}' not found or not readable."
+ SOUND_CARD_INDEX=0
+ else
+ # Try to filter HDMI cards first
+ SOUND_CARD_INDEX=$(grep -v -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1)
+ # If empty, try again with all
+ [ -z "${SOUND_CARD_INDEX}" ] && SOUND_CARD_INDEX=$(cat "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1)
+
+ if [ -z "${SOUND_CARD_INDEX}" ]; then
+ echo "No sound card found."
+ SOUND_CARD_INDEX=0
+ fi
+ fi
+
# Adjust sound volume (playback)... Random mixer names we have encountered during testing
- amixer -q sset 'Master' "$VOL" unmute
- amixer -q sset 'PCM' "$VOL" unmute
- amixer -q sset 'CD' "$VOL" unmute
- amixer -q sset 'Headphone' "$VOL" unmute
- amixer -q sset 'Front' "$VOL" unmute
- amixer -q sset 'Speaker' "$VOL" unmute
+ echo "Setting up volume..."
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Master' "$VOL" unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'PCM' "$VOL" unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'CD' "$VOL" unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Headphone' "$VOL" unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Front' "$VOL" unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Speaker' "$VOL" unmute
# Recording. It seems that (most) devices need the volume set to 0, so you
# don't hear your own mic input, but should be unmuted. Also on some cards,
# you need to set the cap option on the mic you want to use, while other cards
@@ -453,14 +471,14 @@ if true; then
# Plus, most cards have a Capture mixer, which needs to be set to cap too, and
# have its volume turned up. (There'll probably be some cards that need yet
# another setup, but this works for now on 4 tested cards)
- amixer -q sset 'Rear Mic Boost' "50%" cap unmute
- amixer -q sset 'Rear Mic' "0%" cap unmute
- amixer -q sset 'Front Mic Boost' "50%" cap unmute
- amixer -q sset 'Front Mic' "0%" cap unmute
- amixer -q sset 'Mic Boost' "50%" cap unmute
- amixer -q sset 'Mic' "0%" cap unmute
- amixer -q sset 'Capture' "100%" cap unmute
- amixer -q sset 'Input Source' 'Front Mic' # Let's hope nobody uses rear mic...
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Rear Mic Boost' "50%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Rear Mic' "0%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Front Mic Boost' "50%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Front Mic' "0%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Mic Boost' "50%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Mic' "0%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Capture' "100%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Input Source' 'Front Mic' # Let's hope nobody uses rear mic...
# fix random static noise when starting vmplayer when module snd_pcsp (not pcspkr) is loaded
amixer -q -c pcsp sset Master "0%" mute
echo "Done setting up volume."
diff --git a/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt
index 5c697d6c..2f3a9403 100755
--- a/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt
+++ b/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt
@@ -438,14 +438,32 @@ else
VOL="85%"
fi
if true; then
- echo "Setting up volume..."
+ # detecting which card is to be used
+ echo "Detecting which sound card to use ..."
+ PROC="/proc/asound/cards"
+ if [ ! -r "$PROC" ]; then
+ echo "'${PROC}' not found or not readable."
+ SOUND_CARD_INDEX=0
+ else
+ # Try to filter HDMI cards first
+ SOUND_CARD_INDEX=$(grep -v -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1)
+ # If empty, try again with all
+ [ -z "${SOUND_CARD_INDEX}" ] && SOUND_CARD_INDEX=$(cat "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1)
+
+ if [ -z "${SOUND_CARD_INDEX}" ]; then
+ echo "No sound card found."
+ SOUND_CARD_INDEX=0
+ fi
+ fi
+
# Adjust sound volume (playback)... Random mixer names we have encountered during testing
- amixer -q sset 'Master' "$VOL" unmute
- amixer -q sset 'PCM' "$VOL" unmute
- amixer -q sset 'CD' "$VOL" unmute
- amixer -q sset 'Headphone' "$VOL" unmute
- amixer -q sset 'Front' "$VOL" unmute
- amixer -q sset 'Speaker' "$VOL" unmute
+ echo "Setting up volume..."
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Master' "$VOL" unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'PCM' "$VOL" unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'CD' "$VOL" unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Headphone' "$VOL" unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Front' "$VOL" unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Speaker' "$VOL" unmute
# Recording. It seems that (most) devices need the volume set to 0, so you
# don't hear your own mic input, but should be unmuted. Also on some cards,
# you need to set the cap option on the mic you want to use, while other cards
@@ -453,14 +471,14 @@ if true; then
# Plus, most cards have a Capture mixer, which needs to be set to cap too, and
# have its volume turned up. (There'll probably be some cards that need yet
# another setup, but this works for now on 4 tested cards)
- amixer -q sset 'Rear Mic Boost' "50%" cap unmute
- amixer -q sset 'Rear Mic' "0%" cap unmute
- amixer -q sset 'Front Mic Boost' "50%" cap unmute
- amixer -q sset 'Front Mic' "0%" cap unmute
- amixer -q sset 'Mic Boost' "50%" cap unmute
- amixer -q sset 'Mic' "0%" cap unmute
- amixer -q sset 'Capture' "100%" cap unmute
- amixer -q sset 'Input Source' 'Front Mic' # Let's hope nobody uses rear mic...
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Rear Mic Boost' "50%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Rear Mic' "0%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Front Mic Boost' "50%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Front Mic' "0%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Mic Boost' "50%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Mic' "0%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Capture' "100%" cap unmute
+ amixer -q -c "$SOUND_CARD_INDEX" sset 'Input Source' 'Front Mic' # Let's hope nobody uses rear mic...
# fix random static noise when starting vmplayer when module snd_pcsp (not pcspkr) is loaded
amixer -q -c pcsp sset Master "0%" mute
echo "Done setting up volume."
diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include
index ef54218e..90e49445 100644
--- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include
+++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include
@@ -266,8 +266,8 @@ runvmwareconfheader ()
# sound
sound.present = "TRUE"
- sound.fileName = "-1"
- sound.autodetect = "TRUE"
+ sound.fileName = "sysdefault:CARD=$SOUND_CARD_INDEX"
+ sound.autodetect = "FALSE"
sound.virtualdev = "$sound"
pciSound.enableVolumeControl = "FALSE"
sound.enableVolumeControl = "FALSE"