File: waitalsaports

package info (click to toggle)
freewheeling 0.6-1.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,960 kB
  • sloc: cpp: 22,418; sh: 3,711; xml: 2,879; makefile: 78; ansic: 12
file content (27 lines) | stat: -rwxr-xr-x 849 bytes parent folder | download | duplicates (5)
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
# 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

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