File: waitalsaports

package info (click to toggle)
freewheeling 0.6.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,136 kB
  • sloc: cpp: 23,079; xml: 3,632; ansic: 1,818; sh: 1,241; makefile: 45
file content (28 lines) | stat: -rwxr-xr-x 867 bytes parent folder | download | duplicates (3)
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
# Script to wait for named ALSA midi ports to appear
#
# usage: waitalsaports <name>
#
# where name is the full or partial client name (grep search will be done)
#
# prints the port numbers for system MIDI input and client MIDI input,
# respectively
#
# typically they are 72:0 128:0
 
ALSA_NAME=$1

# **** You will have to change the following line to reflect the name of your MIDI hardware
# On my system aconnect -li reports client 72: 'MidiSport 2x2', so the name can be any subset of that:

#ALSA_IN_NAME=MidiSport
#ALSA_IN_NAME=PCR
ALSA_IN_NAME=BCF

while ((`aconnect -lo | grep $ALSA_NAME | awk 'END { print NR }'` == 0))
do 
  sleep 0.1
done

ALSA_SYSTEM_MIDI=`aconnect -lo | grep $ALSA_IN_NAME | grep client | awk '{ print $2 }'`0
ALSA_CLIENT_MIDI=`aconnect -lo | grep $ALSA_NAME | grep client | awk '{ print $2 }'`0
echo $ALSA_SYSTEM_MIDI $ALSA_CLIENT_MIDI