Advertisement
Guest User

Untitled

a guest
Aug 29th, 2010
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.97 KB | None | 0 0
  1. #!/bin/bash
  2. # a function to run yoshimi on a certain "channel"
  3. #     takes channel number as argument
  4. function runyoshimi() {
  5.     local CHAN=$1
  6.     # store jack_lsp output before...
  7.     local PRE=`jack_lsp`
  8.     yoshimi &
  9.     sleep 3
  10.     # ... and after application startup
  11.     local POST=`jack_lsp`
  12.     # diff to find the new ports
  13.     local PORTS=`diff <(echo "$PRE") <(echo "$POST")`
  14.     # retrieve the actual port names from the resulting 3 lines
  15.     LEFT=`echo "$PORTS" | grep left | cut -c 3-`
  16.     RIGHT=`echo "$PORTS" | grep right | cut -c 3-`
  17.     MIDI=`echo "$PORTS" | grep midi | cut -c 3-`
  18.     # assign aliases
  19.     jack_alias "$LEFT"  ch_${CHAN}_left
  20.     jack_alias "$RIGHT" ch_${CHAN}_right
  21.     jack_alias "$MIDI"  ch_${CHAN}_midi
  22. }
  23. # call the function
  24. runyoshimi 4
  25. # now use the new aliases
  26. jack_connect                ch_4_left  system:playback_1
  27. jack_connect               ch_4_right  system:playback_2
  28. jack_connect Non-Sequencer:midi_out-4  ch_4_midi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement