summaryrefslogtreecommitdiff
path: root/examples/greaterequal.csd
diff options
context:
space:
mode:
Diffstat (limited to 'examples/greaterequal.csd')
-rw-r--r--examples/greaterequal.csd43
1 files changed, 43 insertions, 0 deletions
diff --git a/examples/greaterequal.csd b/examples/greaterequal.csd
new file mode 100644
index 0000000..e14bb31
--- /dev/null
+++ b/examples/greaterequal.csd
@@ -0,0 +1,43 @@
+<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 greaterequal.wav -W ;;; for file output any platform
+</CsOptions>
+<CsInstruments>
+
+; Initialize the global variables.
+sr = 44100
+kr = 44100
+ksmps = 1
+nchnls = 1
+
+; Instrument #1.
+instr 1
+ ; Get the 4th p-field from the score.
+ k1 = p4
+
+ ; Is it greater than or equal to 3? (1 = true, 0 = false)
+ k2 = (p4 >= 3 ? 1 : 0)
+
+ ; Print the values of k1 and k2.
+ printks "k1 = %f, k2 = %f\\n", 1, k1, k2
+endin
+
+
+</CsInstruments>
+<CsScore>
+
+; Call Instrument #1 with a p4 = 2.
+i 1 0 0.5 2
+; Call Instrument #1 with a p4 = 3.
+i 1 1 0.5 3
+; Call Instrument #1 with a p4 = 4.
+i 1 2 0.5 4
+e
+
+
+</CsScore>
+</CsoundSynthesizer>