annotate data/osc/sv-command @ 458:f60360209e5c

* Fix race condition in FFTFileCache when reading from the same FFT model from multiple threads (e.g. when applying more than one plugin at once)
author Chris Cannam
date Wed, 15 Oct 2008 12:08:02 +0000
parents 32e50b620a6c
children
rev   line source
Chris@320 1 #!/bin/sh
Chris@320 2 #
Chris@320 3 # A very simple command shell for Sonic Visualiser.
Chris@320 4 #
Chris@320 5 # This provides a wrapper for the sv-osc-send program, which is a
Chris@320 6 # generic OSC sending program (not specific to SV, despite its name).
Chris@320 7 # This script attempts to guess the OSC port number for an SV
Chris@320 8 # process running on the local host, and then composes a method name
Chris@320 9 # and arguments into a complete OSC call.
Chris@320 10 #
Chris@320 11 # You can either run this with the method and its arguments on the
Chris@320 12 # command line, e.g. "sv-command set layer Frequency-Scale Log", or
Chris@320 13 # you can provide a series of method + argument commands on stdin.
Chris@320 14 #
Chris@320 15 # Unless you use the -q option, this script will echo the OSC URL
Chris@320 16 # and arguments that it is sending for each command.
Chris@320 17 #
Chris@320 18 # Note that the method and arguments may not contain spaces.
Chris@320 19 #
Chris@320 20 # Chris Cannam, Nov 2006
Chris@320 21
Chris@320 22 quiet=
Chris@320 23 if [ "$1" = "-q" ]; then
Chris@320 24 quiet=true; shift;
Chris@320 25 fi
Chris@320 26
Chris@320 27 # The yucky bit
Chris@320 28
Chris@320 29 port=`lsof -c sonic- | \
Chris@320 30 grep UDP | \
Chris@320 31 sed -e 's/^.*[^0-9]\([0-9][0-9]*\) *$/\1/' | \
Chris@320 32 grep -v ' ' | \
Chris@320 33 head -1 `
Chris@320 34
Chris@320 35 host=127.0.0.1
Chris@320 36 scheme=osc.udp
Chris@320 37
Chris@320 38 if [ -z "$port" ]; then
Chris@320 39 echo "Sonic Visualiser OSC port not found"
Chris@320 40 exit 1
Chris@320 41 fi
Chris@320 42
Chris@320 43 if [ -n "$1" ]; then
Chris@320 44 command=$1; shift
Chris@320 45 [ -z "$quiet" ] && echo "$scheme://$host:$port/$command" "$@"
Chris@320 46 sv-osc-send "$scheme://$host:$port/$command" "$@"
Chris@320 47 else
Chris@320 48 while read command a1 a2 a3 a4 a5; do
Chris@320 49 [ -z "$command" ] && continue
Chris@320 50 [ -z "$quiet" ] && echo "$scheme://$host:$port/$command" $a1 $a2 $a3 $a4 $a5
Chris@320 51 sv-osc-send "$scheme://$host:$port/$command" $a1 $a2 $a3 $a4 $a5
Chris@320 52 done
Chris@320 53 fi
Chris@320 54
Chris@320 55 exit 0