| Does anyone have a working example for getting values from Csound to
Tk widgets via cswish?
I tried a lot. It's no problem to bring control values from the
widgets to Csound (via invalue), but I can't receive any value back
via outvalue or chnset (for displaying).
Perhaps I am missing something elementary, because I am quite new in
Tcl/Tk.
I read in the list archive that 2 years ago someone asked something
similar. Victor proposed a code by Jean Piche. I tried to work with
this code, but without success, too.
My files are below, and also in the attachement.
Thanks a lot for any help -
joachim
SIMPLETEST.TCL
> #!/usr/local/bin/cswish
>
> #cd /Users/jh/Documents/Csound/csound5/examples/tclcsound
> set filename "simpletest.csd"
> csCompile -odac -iadc -d $filename -b1024
>
> # setting the channels for invalue/outvalue
> csInChannel val
> csOutChannel reval
>
> #try to implement the code porposed by victor (http://
> www.nabble.com/Any-TclCsound-manual--to4149782.html#a4152130)
> proc updateSliders { } {
> global stopper sliderValue reval
> set ti 50
> after $ti
> while {$stopper == 1} {
> set sliderValue $reval
> update
> after $ti
> }
> }
>
> labelframe .middle -text "csound control panel" -padx 20 -pady 20
> frame .bottom -padx 20 -pady 20
> frame .sliders -padx 20 -pady 20
> frame .fr
> pack .middle .sliders .bottom .fr
> 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
>
> #the way TO csound is working:
> scale .sliders.val -orient horizontal -from 0 -to 10 -command [list
> csInValue val] -label "Send to Csound" -length 300
>
> #but no success getting values FROM csound:
> #neither with sliders (trying both variables)
> scale .sliders.retval1 -variable reval -orient horizontal -from 0 -
> to 30 -label "Return Value 1" -length 300
> scale .sliders.retval2 -variable sliderValue -orient horizontal -
> from 0 -to 30 -label "Return Value 2" -length 300
> #nor with labels (trying both too)
> label .fr.label1 -textvariable reval
> label .fr.label2 -textvariable sliderValue
>
> pack .middle.run .middle.pause .middle.stop -side left
> pack .bottom.quit -side left
> pack .sliders.val .sliders.retval1 .sliders.retval2 .fr.label1 .fr.lab
> el2
SIMPLETEST.CSD
>
>
> -d
>
>
> instr 1
> koffset init 0
> ktrig init 0
> kzel init 0
> koffset invalue "val"
> ktrig metro 1
> if ktrig==1 then
> kzel = kzel+1
> endif
> kcount = kzel + koffset
> outvalue "reval", kcount; trying with outvalue
> chnset kcount, "reval"; trying with chnset
> kproffset changed koffset
> if kproffset==1 then
> printks "koffset = %d%n", 0, koffset
> endif
> kprcount changed kcount
> if kprcount==1 then
> printks "kcount = %d%n", 0, kcount
> endif
> endin
>
>
> i1 0 600
>
>
|