<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform; Audio out Audio in-odac
; -iadc ;;;RT audio I/O; For Non-realtime ouput leave only the line below:; -o checkbox.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=10nchnls=2instr1kq=init(0); Get the value from the checkbox.k1=checkbox(1); If the checkbox is selected then k2=440, otherwise k2=880.k2=(k1==0?440:880)a1=poscil(10000,k2)outs(a1,a1)kq=button(1)schedkwhen(kq,0,1,2,0,0)endininstr2exitnow()endin</CsInstruments><CsScore>; sine wave.i101000e</CsScore></CsoundSynthesizer>
Here is a simple example of the checkbox opcode. It uses the file checkbox.csd.
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform; Audio out Audio in-odac -iadc ;;;RT audio I/O; For Non-realtime ouput leave only the line below:; -o checkbox.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=10nchnls=2instr1kqinit0; Get the value from the checkbox.k1checkbox1; If the checkbox is selected then k2=440, otherwise k2=880.k2=(k1==0?440:880)a1oscil10000,k2,1outsa1,a1kqbutton1schedkwhenkq,0,1,2,0,0endininstr2exitnowendin</CsInstruments><CsScore>; sine wave.f1032768101i101000e</CsScore></CsoundSynthesizer>