| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-m128 |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 2 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
instr 1 |
| 12 |
|
| 13 |
;a string to be copied at init- and performance-time |
| 14 |
String strcpyk "yes!\n" |
| 15 |
|
| 16 |
;print it at init-time |
| 17 |
printf_i "INIT 1: %s", 1, String |
| 18 |
|
| 19 |
;a copy assignment that will never become true during performance |
| 20 |
kBla = 0 |
| 21 |
if kBla == 1 then |
| 22 |
String strcpyk "no!\n" |
| 23 |
endif |
| 24 |
|
| 25 |
;nevertheless the string variable is initialized by it |
| 26 |
printf_i "INIT 2: %s", 1, String |
| 27 |
|
| 28 |
;during performance only "yes!" remains |
| 29 |
printf "PERF %d: %s", timeinstk(), timeinstk(), String |
| 30 |
|
| 31 |
;turn off after three k-cycles |
| 32 |
if timeinstk() == 3 then |
| 33 |
turnoff |
| 34 |
endif |
| 35 |
|
| 36 |
endin |
| 37 |
|
| 38 |
</CsInstruments> |
| 39 |
<CsScore> |
| 40 |
i 1 0 1 |
| 41 |
</CsScore> |
| 42 |
</CsoundSynthesizer> |
| 43 |
;example by joachim heintz |