Mercurial > hg > sonic-visualiser
annotate osc/sv-command @ 149:37cb005f7c40
* FFT: fix invalid write of normalisation factor in compact mode of disc cache
* FFT: fix range problem for normalisation factor in compact mode (it was
  stored as an unsigned scaled from an assumed float range of 0->1, which
  is not very plausible and not accurate enough even if true -- use a float
  instead)
* Spectrogram: fix vertical zoom behaviour for log frequency spectrograms:
  make the thing in the middle of the display remain in the middle after zoom
* Overview widget: don't update the detailed waveform if still decoding the
  audio file (too expensive to do all those redraws)
| author | Chris Cannam | 
|---|---|
| date | Fri, 08 Jun 2007 15:19:50 +0000 | 
| parents | e200055fe80b | 
| children | 
| rev | line source | 
|---|---|
| Chris@69 | 1 #!/bin/sh | 
| Chris@70 | 2 # | 
| Chris@70 | 3 # A very simple command shell for Sonic Visualiser. | 
| Chris@70 | 4 # | 
| Chris@70 | 5 # This provides a wrapper for the sv-osc-send program, which is a | 
| Chris@70 | 6 # generic OSC sending program (not specific to SV, despite its name). | 
| Chris@70 | 7 # This script attempts to guess the OSC port number for an SV | 
| Chris@70 | 8 # process running on the local host, and then composes a method name | 
| Chris@70 | 9 # and arguments into a complete OSC call. | 
| Chris@70 | 10 # | 
| Chris@70 | 11 # You can either run this with the method and its arguments on the | 
| Chris@70 | 12 # command line, e.g. "sv-command set layer Frequency-Scale Log", or | 
| Chris@70 | 13 # you can provide a series of method + argument commands on stdin. | 
| Chris@70 | 14 # | 
| Chris@70 | 15 # Unless you use the -q option, this script will echo the OSC URL | 
| Chris@70 | 16 # and arguments that it is sending for each command. | 
| Chris@70 | 17 # | 
| Chris@70 | 18 # Note that the method and arguments may not contain spaces. | 
| Chris@70 | 19 # | 
| Chris@70 | 20 # Chris Cannam, Nov 2006 | 
| Chris@70 | 21 | 
| Chris@70 | 22 quiet= | 
| Chris@70 | 23 if [ "$1" = "-q" ]; then | 
| Chris@70 | 24 quiet=true; shift; | 
| Chris@70 | 25 fi | 
| Chris@70 | 26 | 
| Chris@70 | 27 # The yucky bit | 
| Chris@70 | 28 | 
| Chris@70 | 29 port=`lsof -c sonic- | \ | 
| Chris@70 | 30 grep UDP | \ | 
| Chris@70 | 31 sed -e 's/^.*[^0-9]\([0-9][0-9]*\) *$/\1/' | \ | 
| Chris@70 | 32 grep -v ' ' | \ | 
| Chris@70 | 33 head -1 ` | 
| Chris@70 | 34 | 
| Chris@70 | 35 host=127.0.0.1 | 
| Chris@70 | 36 scheme=osc.udp | 
| Chris@70 | 37 | 
| Chris@69 | 38 if [ -z "$port" ]; then | 
| Chris@69 | 39 echo "Sonic Visualiser OSC port not found" | 
| Chris@69 | 40 exit 1 | 
| Chris@69 | 41 fi | 
| Chris@70 | 42 | 
| Chris@69 | 43 if [ -n "$1" ]; then | 
| Chris@69 | 44 command=$1; shift | 
| Chris@70 | 45 [ -z "$quiet" ] && echo "$scheme://$host:$port/$command" "$@" | 
| Chris@70 | 46 sv-osc-send "$scheme://$host:$port/$command" "$@" | 
| Chris@69 | 47 else | 
| Chris@70 | 48 while read command a1 a2 a3 a4 a5; do | 
| Chris@70 | 49 [ -z "$command" ] && continue | 
| Chris@70 | 50 [ -z "$quiet" ] && echo "$scheme://$host:$port/$command" $a1 $a2 $a3 $a4 $a5 | 
| Chris@70 | 51 sv-osc-send "$scheme://$host:$port/$command" $a1 $a2 $a3 $a4 $a5 | 
| Chris@69 | 52 done | 
| Chris@69 | 53 fi | 
| Chris@69 | 54 | 
| Chris@73 | 55 exit 0 | 
