Debian Codegraph @

examples/rtclock.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -n ;;;no sound
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o rtclock.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 ;after an example by Iain McCurdy
12
13 sr = 44100
14 ksmps = 32
15 nchnls = 2
16 0dbfs = 1
17
18 FLcolor 200, 200, 200, 0, 0, 0
19 ; LABEL | WIDTH | HEIGHT | X | Y
20 FLpanel "rtclock", 500, 130, 0, 0
21 ; ON,OFF,TYPE,WIDTH, HEIGHT, X, Y, OPCODE, INS,START,IDUR
22 gkOnOff,ihOnOff FLbutton "On/Off", 1, 0, 22, 150, 25, 5, 5, 0, 1, 0, 3600
23 gkExit,ihExit FLbutton "exitnow",1, 0, 21, 150, 25, 345, 5, 0, 999, 0, 0.001
24 FLsetColor2 255, 0, 50, ihOnOff ;reddish color
25
26 ;VALUE DISPLAY BOXES WIDTH,HEIGHT,X, Y
27 gidclock FLvalue "clock", 100, 25, 200, 60
28 FLsetVal_i 1, ihOnOff
29 FLpanel_end
30 FLrun
31
32 instr 1
33
34 if gkOnOff !=0 kgoto CONTINUE ;sense if FLTK on/off switch is not off (in which case skip the next line)
35 turnoff ;turn this instr. off now
36 CONTINUE:
37 ktime rtclock ;clock continues to run even
38 FLprintk2 ktime, gidclock ;after the on/off button was used to stop
39
40 endin
41
42 instr 999
43
44 exitnow ;exit Csound as fast as possible
45
46 endin
47 </CsInstruments>
48 <CsScore>
49
50 f 0 60 ;runs 60 seconds
51 e
52 </CsScore>
53 </CsoundSynthesizer>