| David,
unfortunately, for some reason TK widgets do not seem to trace the variable
as they should. I don't know why, I could not make it work myself. I suspect
this has to do with the fact that the variable is updated at a two fast a
rate (kr)
for Tcl. I'll think a little more about it.
Victor
At 08:14 24/03/2006, you wrote:
>Hi List,
>
>I'm trying to implement a simple display of MIDI Sliders using TclCsound.
>I've been studying the canonical examples but I cannot seem to ascertain
>how to create a Tk scale opcode that senses the outvalue channel correctly.
>
>The idea, in abstract, is simply run this Csound file and have TclCsound
>display the values of 4 MIDI sliders.
>
>Here is the code I was using - if anyone can help I'd really appreciate it!
>
>###
>source "graph.tcl" # from canonical examples/tclcsound directory
>set filename "oxy_sliders.csd" # see below
>
>set grph 0
>set sl1 0
>set sl2 0
>set sl3 0
>set sl4 0
>
>csCompile -odac -iadc -b1024 -B1024 -M0 -d -+noninterleaved=1
>-+rtaudio=CoreAudio $filename
>
>csOutChannel slider1
>csOutChannel slider2
>csOutChannel slider3
>csOutChannel slider4
>
>labelframe .middle -text "csound control panel" -padx 20 -pady 20
>frame .bottom -padx 20 -pady 20
>frame .sliders -padx 20 -pady 20
>
>proc newOrc { } {
>global filename grph .table
>set filename [tk_getOpenFile -filetypes "{{CSD} {.csd} TEXT}"]
>if { $filename != "" } {
>csStop
>csCompile -odac -iadc -b1024 -B1024 -M0 -d -+noninterleaved=1
>-+rtaudio=CoreAudio $filename
>if { $grph == 1} {
>destroy .table
>}
>}
>}
>
>proc newGraph { } {
>global grph .table
>if { [csGetTableSize 1] != -1} {
>if { $grph == 1 } {
>destroy .table
>}
>toplevel .table -padx 4 -pady 2
>GraphTable .table 200 400 1
>set grph 1
>}
>}
>
>pack .middle .sliders .bottom
>button .bottom.open -text "open new csd" -command newOrc
>button .middle.run -text "play" -command csPlay
>button .middle.stop -text "stop" -command csStop
>button .middle.pause -text "pause" -command csPause
>button .bottom.quit -text "quit" -command exit
>button .bottom.graph -text "graph" -command newGraph
>
># how to make a display for outvalue ?
>scale .sliders.slider1 -variable sl1 -orient vertical -from 127 -to 0
>-command [list csOutValue slider1] -label "slider1" -length 300
>scale .sliders.slider2 -variable sl2 -orient vertical -from 127 -to 0
>-command [list csOutValue slider2] -label "slider2" -length 300
>scale .sliders.slider3 -variable sl3 -orient vertical -from 127 -to 0
>-command [list csOutValue slider3] -label "slider3" -length 300
>scale .sliders.slider4 -variable sl4 -orient vertical -from 127 -to 0
>-command [list csOutValue slider4] -label "slider4" -length 300
>
>pack .middle.run .middle.pause .middle.stop -side left
>pack .bottom.open .bottom.graph .bottom.quit -side left
>pack .sliders.slider1 .sliders.slider2 .sliders.slider3 .sliders.slider4
>-side left
>###
># EOF
>###
>
>
>
>
>; referred to as "oxy_sliders.csd" above
>sr = 44100
>kr = 441
>ksmps = 100
>nchnls = 2
>
>/*--- ---*/
>
> instr 1
>/*
>k1 invalue "slider1"
>k2 invalue "slider2"
>k3 invalue "slider3"
>k4 invalue "slider4"
>
> printk2 k01
> printk2 k02
> printk2 k03
> printk2 k04
>*/
>k1 ctrl7 1, 8, 0, 127
>k2 ctrl7 1, 9, 0, 127
>k3 ctrl7 1, 10, 0, 127
>k4 ctrl7 1, 11, 0, 127
>
> outvalue "slider1", k1
>; printk2 k1
> outvalue "slider2", k2
> outvalue "slider3", k3
> outvalue "slider4", k4
>
> endin
>
>/*--- ---*/
>
>
>
>i1 0 3600
>
>e
>
>; EOF
>
>
>TIA,
>
>
>-David
>
>--
>Send bugs reports to this list.
>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth |