• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3#DBG="gdb --args "
4#DBG="strace"
5#DBG="valgrind --leak-check=full"
6ARGS=
7CFGFILE="/tmp/alsaloop.test.cfg"
8
9test1() {
10  echo "TEST1"
11  $DBG ./alsaloop -C hw:1,0 -P plughw:0,0 \
12    --tlatency 50000 \
13    --mixer "name='Master Playback Volume'@name='Master Playback Volume'" \
14    --mixer "name='Master Playback Switch'@name='Master Playback Switch'" \
15    --mixer "name='PCM Playback Volume'" \
16    --ossmixer "Master@VOLUME" \
17    --ossmixer "PCM@PCM" \
18    $ARGS
19}
20
21test2() {
22  echo "TEST2"
23cat > $CFGFILE <<EOF
24# first job
25-C hw:1,0,0 -P hw:0,0,0 --tlatency 50000 --thread 1 \
26    --mixer "name='Master Playback Volume'@name='Master Playback Volume'" \
27    --mixer "name='Master Playback Switch'@name='Master Playback Switch'" \
28    --mixer "name='PCM Playback Volume'"
29# next line - second job
30-C hw:1,0,1 -P hw:0,1,0 --tlatency 50000 --thread 2
31EOF
32  $DBG ./alsaloop -d --config $CFGFILE $ARGS
33}
34
35test3() {
36  echo "TEST3"
37  LATENCY=180000
38cat > $CFGFILE <<EOF
39-C hw:1,0,0 -P plug:dmix:0 --tlatency $LATENCY --thread 0 \
40    --mixer "name='Master Playback Volume'@name='Master Playback Volume'" \
41    --mixer "name='Master Playback Switch'@name='Master Playback Switch'" \
42    --mixer "name='PCM Playback Volume'" \
43    --ossmixer "name=Master@VOLUME"
44-C hw:1,0,1 -P plug:dmix:0 --tlatency $LATENCY --thread 1
45-C hw:1,0,2 -P plug:dmix:0 --tlatency $LATENCY --thread 2
46-C hw:1,0,3 -P plug:dmix:0 --tlatency $LATENCY --thread 3
47-C hw:1,0,4 -P plug:dmix:0 --tlatency $LATENCY --thread 4
48-C hw:1,0,5 -P plug:dmix:0 --tlatency $LATENCY --thread 5
49-C hw:1,0,6 -P plug:dmix:0 --tlatency $LATENCY --thread 6
50-C hw:1,0,7 -P plug:dmix:0 --tlatency $LATENCY --thread 7
51EOF
52  $DBG ./alsaloop --config $CFGFILE $ARGS
53}
54
55test4() {
56  echo "TEST4"
57  $DBG ./alsaloop -C hw:1,0 -P plughw:0,0 -a off -r 11025 \
58    --tlatency 50000 \
59    --mixer "name='Master Playback Volume'@name='Master Playback Volume'" \
60    --mixer "name='Master Playback Switch'@name='Master Playback Switch'" \
61    --mixer "name='PCM Playback Volume'" \
62    $ARGS
63}
64
65test5() {
66  echo "TEST5"
67cat > $CFGFILE <<EOF
68-C hw:1,0,0 -P plughw:0,0 --tlatency 50000 --thread 1 \
69    --mixer "name='Master Playback Volume'@name='Master Playback Volume'" \
70    --mixer "name='Master Playback Switch'@name='Master Playback Switch'" \
71    --mixer "name='PCM Playback Volume'" \
72    --ossmixer "name=Master@VOLUME"
73-C hw:1,0,1 -P plughw:0,1 --tlatency 50000 --thread 2
74EOF
75  $DBG ./alsaloop --config $CFGFILE $ARGS
76}
77
78sigusr1() {
79	pid=$(ps ax | grep alsaloop | grep -v grep | colrm 7 255)
80	if test -n "$pid"; then
81		echo "Killing alsaloop $pid..."
82		kill -SIGUSR1 $pid
83	fi
84}
85
86case "$1" in
87test1) shift; ARGS="$@"; test1 ;;
88test2) shift; ARGS="$@"; test2 ;;
89test3) shift; ARGS="$@"; test3 ;;
90test4) shift; ARGS="$@"; test4 ;;
91test5) shift; ARGS="$@"; test5 ;;
92usr|sig*) sigusr1 ;;
93*) ARGS="$@"; test1 ;;
94esac
95