diff options
author | Richard <q@1bpm.net> | 2021-03-03 01:00:03 +0000 |
---|---|---|
committer | Richard <q@1bpm.net> | 2021-03-03 01:00:03 +0000 |
commit | 425c881b86435d756f09f82dd5c3ba48fe64cf66 (patch) | |
tree | 55a13e4cf23aadf57c8207a9bcacc5775e3e5b67 /examples | |
download | csound-nstrexists-425c881b86435d756f09f82dd5c3ba48fe64cf66.tar.gz csound-nstrexists-425c881b86435d756f09f82dd5c3ba48fe64cf66.tar.bz2 csound-nstrexists-425c881b86435d756f09f82dd5c3ba48fe64cf66.zip |
initial
Diffstat (limited to 'examples')
-rw-r--r-- | examples/example.csd | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/examples/example.csd b/examples/example.csd new file mode 100644 index 0000000..9c51083 --- /dev/null +++ b/examples/example.csd @@ -0,0 +1,69 @@ +<CsoundSynthesizer> +<CsOptions> +-n ; no audio +</CsOptions> +<CsInstruments> +/* + Demonstration of nstrexists. + Check through a range of instrument numbers and report if they are + known to the Csound engine. + +*/ +sr = 44100 +ksmps = 1 +nchnls = 2 +0dbfs = 1 + +/* + Empty instruments to test for existence +*/ +instr 92 +endin + +instr 93 +endin + +instr 95 +endin + +instr testinstr1 +endin + +instr testinstr3 +endin + +instr testinstr4 +endin + + +/* + Go through instrument numbers 1 to 10 and check for existence +*/ +instr 98 + + ; test the numeric i-rate opcode: look for instruments numbered between 91 and 98 + inum = 91 +loop: + prints(sprintf("(i-rate) Instr %d : %d\n", inum, nstrexists(inum))) + loop_lt inum, 1, 99, loop + turnoff +endin + + +instr 99 + + ; test the numeric k-rate opcode: look for instruments numbered between 91 and 98 + knum = 91 +loop: + printks2(sprintfk("(k-rate) Instr %d: %d\n", knum, nstrexists(knum)), knum) + loop_lt knum, 1, 99, loop + turnoff +endin + +</CsInstruments> +<CsScore> +i98 0 1 +i99 1 1 +</CsScore> +</CsoundSynthesizer> + |