Use Non-Frames Version Previous Page Next Page
Instrument Control: Sensing and Control

setctrl, control


          setctrl     inum, kval, itype

  kr      control     knum


Description

Configurable slider controls for realtime user input. Requires Winsound or TCL/TK.

setctrl sets a slider to a specific value, or sets a minimum or maximum range.

control reads a slider's value.

Initialization

inum – number of the slider to set

itype – type of value sent to the slider as follows:

Performance

kval – value to be sent to the slider

Calling setctrl or control will create a new slider on the screen. There is no theoretical limit to the number of sliders. Windows and TCL/TK use only integers for slider values, so the values may need rescaling. GUIs usually pass values at a fairly slow rate, so it may be advisable to pass the output of control through port.

Example


#define SLIDERNUM # 6 #



          instr 1

          kgoto      continue        ; We don't want to configure sliders at k-rate!



  ; Set min=10, max=1000, actual=20

          setctrl    $SLIDERNUM., 20, 0

          setctrl    $SLIDERNUM., 10, 1

          setctrl    $SLIDERNUM., 1000, 2

 continue:

  kcHz    control    $SLIDERNUM.  ; Read values with smoothing

  kcHz    port       kcHz, .02

; ... etc

          endin

Author

John ffitch
University of Bath, Codemist. Ltd.
Bath, UK
May, 2000
New in Csound version 4.06


Use Non-Frames Version Previous Page Next Page
Instrument Control: Sensing and Control