-
Notifications
You must be signed in to change notification settings - Fork 1
/
make_asoundrc.bash
99 lines (84 loc) · 1.8 KB
/
make_asoundrc.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
dj_dev=`aplay -l | grep Audio4DJ | grep "device 0" | cut -d\ -f 2 | cut -d: -f 1`
HAS_A4DJ=1
if [ "$dj_dev"x == "x" ] ; then
echo "Audio4DJ not found"
HAS_A4DJ=0
fi
cat << EOF > ~/.asoundrc
#
#This file was generated by $0 -- do not edit by hand (it will get overwritten!)
EOF
if [ $HAS_A4DJ == "1" ] ; then
cat << EOF >> ~/.asoundrc
###
### Begin Audio 4 DJ Section
###
pcm.AUDIO4DJ {
type multi;
# bind hardware devices
slaves.a.pcm "hw:$dj_dev,0,0";
slaves.a.channels 2;
slaves.b.pcm "hw:$dj_dev,0,1";
slaves.b.channels 2;
# bind channels to virtual device;
bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave a;
bindings.1.channel 1;
bindings.2.slave b;
bindings.2.channel 0;
bindings.3.slave b;
bindings.3.channel 1;
}
# JACK will be unhappy if there is no mixer to talk to, so we set
# this to card 0. This could be any device but 0 is easy.
#note that audio4dj is actually card 1!
ctl.AUDIO4DJ {
type hw;
card 0;
}
# This creates a 4 channel interleaved pcm stream based on
# the multi device. JACK will work with this one.
pcm.ttable {
type route;
slave.pcm "AUDIO4DJ";
slave.channels 4;
ttable.0.0 1;
ttable.1.1 1;
ttable.2.2 1;
ttable.3.3 1;
}
# see above.
ctl.ttable {
type hw;
card 0;
}
pcm.AUDIO4DJ_A {
type route
slave {
pcm "plughw:$dj_dev,0,0"
channels 2
}
ttable.0.0 1
ttable.1.1 1
}
ctl.AUDIO4DJ_A {
type hw;
card 0;
}
pcm.AUDIO4DJ_B {
type route
slave {
pcm "plughw:$dj_dev,0,1"
channels 2
}
ttable.0.0 1
ttable.1.1 1
}
ctl.AUDIO4DJ_B {
type hw;
card 0;
}
EOF
fi