Mercurial > hg > sonic-visualiser
comparison osc/sv-command @ 70:e269ae6ed008
* When adding a layer, make it the selected layer on that pane
* More OSC support, including transforms
author | Chris Cannam |
---|---|
date | Fri, 10 Nov 2006 17:45:26 +0000 |
parents | 76cc2c424268 |
children | e200055fe80b |
comparison
equal
deleted
inserted
replaced
69:76cc2c424268 | 70:e269ae6ed008 |
---|---|
1 #!/bin/sh | 1 #!/bin/sh |
2 port=`lsof -c sonic- | grep UDP | sed -e 's/^.*[^0-9]\([0-9][0-9]*\) *$/\1/' | grep -v ' ' | head -1` | 2 # |
3 # A very simple command shell for Sonic Visualiser. | |
4 # | |
5 # This provides a wrapper for the sv-osc-send program, which is a | |
6 # generic OSC sending program (not specific to SV, despite its name). | |
7 # This script attempts to guess the OSC port number for an SV | |
8 # process running on the local host, and then composes a method name | |
9 # and arguments into a complete OSC call. | |
10 # | |
11 # You can either run this with the method and its arguments on the | |
12 # command line, e.g. "sv-command set layer Frequency-Scale Log", or | |
13 # you can provide a series of method + argument commands on stdin. | |
14 # | |
15 # Unless you use the -q option, this script will echo the OSC URL | |
16 # and arguments that it is sending for each command. | |
17 # | |
18 # Note that the method and arguments may not contain spaces. | |
19 # | |
20 # Chris Cannam, Nov 2006 | |
21 | |
22 quiet= | |
23 if [ "$1" = "-q" ]; then | |
24 quiet=true; shift; | |
25 fi | |
26 | |
27 # The yucky bit | |
28 | |
29 port=`lsof -c sonic- | \ | |
30 grep UDP | \ | |
31 sed -e 's/^.*[^0-9]\([0-9][0-9]*\) *$/\1/' | \ | |
32 grep -v ' ' | \ | |
33 head -1 ` | |
34 | |
35 host=127.0.0.1 | |
36 scheme=osc.udp | |
37 | |
3 if [ -z "$port" ]; then | 38 if [ -z "$port" ]; then |
4 echo "Sonic Visualiser OSC port not found" | 39 echo "Sonic Visualiser OSC port not found" |
5 exit 1 | 40 exit 1 |
6 fi | 41 fi |
42 | |
7 if [ -n "$1" ]; then | 43 if [ -n "$1" ]; then |
8 command=$1; shift | 44 command=$1; shift |
9 echo "osc.udp://127.0.0.1:$port/$command" "$@" | 45 [ -z "$quiet" ] && echo "$scheme://$host:$port/$command" "$@" |
10 sv-osc-send "osc.udp://127.0.0.1:$port/$command" "$@" | 46 sv-osc-send "$scheme://$host:$port/$command" "$@" |
11 else | 47 else |
12 while read command arg1 arg2 arg3 arg4 arg5; do | 48 while read command a1 a2 a3 a4 a5; do |
13 echo "osc.udp://127.0.0.1:$port/$command" $arg1 $arg2 $arg3 $arg4 $arg5 | 49 [ -z "$command" ] && continue |
14 sv-osc-send "osc.udp://127.0.0.1:$port/$command" $arg1 $arg2 $arg3 $arg4 $arg5 | 50 [ -z "$quiet" ] && echo "$scheme://$host:$port/$command" $a1 $a2 $a3 $a4 $a5 |
51 sv-osc-send "$scheme://$host:$port/$command" $a1 $a2 $a3 $a4 $a5 | |
15 done | 52 done |
16 fi | 53 fi |
17 | 54 |