Skip to content

Commit 6f8b94f

Browse files
committed
Add alsaloop_wait to loopback after m8c starts
in case wait_for_device=true or other failure.
1 parent cfdf245 commit 6f8b94f

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

M8/M8.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#!/bin/bash
2+
3+
# Uncomment the following lines to disable wi-fi
4+
#sudo modprobe -r mt7601u
5+
#sudo sed -i '$ablacklist mt7601u' /etc/modprobe.d/blacklist.conf
6+
#printf "\n\n\n\e[32mWifi has been disabled.\n"
7+
18
m8_path=ports/M8
29
roms2_path=/roms2/$m8_path
310
roms_path=/roms/$m8_path
@@ -8,7 +15,16 @@ else
815
cd $roms_path
916
fi
1017

11-
alsaloop -P hw:0,0 -C hw:1,0 -t 50000 -B 5000 --rate 44100 --sync=0 -d
18+
19+
# alsaloop_wait will run in background and try to create the loopback
20+
# if it can't be created before m8c runs. Useful for wait_for_device=true.
21+
./alsaloop_wait &
22+
#alsaloop -P hw:0,0 -C hw:1,0 -t 200000 -A 5 --rate 44100 --sync=0 -T -1 -d
1223
./_m8c/m8c
1324

1425
pkill alsaloop
26+
27+
# Uncomment the following lines to enable wi-fi
28+
#sudo modprobe -i mt7601u
29+
#sudo sed -i '/blacklist mt7601u/d' /etc/modprobe.d/blacklist.conf
30+
#printf "\n\n\n\e[32mWifi has been enabled.\n"

M8/alsaloop_wait

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
var=$(aconnect -o|grep M8)
4+
var2=$(aconnect -o|grep XYXYX)
5+
var3=$(ps aux|grep [a]lsaloop|grep -v alsaloop_wait)
6+
7+
while :
8+
do
9+
10+
if [ "$var" = "$var2" ]
11+
then
12+
var=$(aconnect -o|grep M8)
13+
sleep 1
14+
else
15+
if [ "$var2" = "$var3" ]
16+
then
17+
sleep 1
18+
alsaloop -P hw:0,0 -C hw:1,0 -t 200000 -A 5 --rate 44100 --sync=0 -T -1 -d
19+
fi
20+
fi
21+
22+
done
23+

0 commit comments

Comments
 (0)