| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
;-odac ;;;realtime audio out |
| 4 |
|
| 5 |
</CsOptions> |
| 6 |
<CsInstruments> |
| 7 |
|
| 8 |
sr = 44100 |
| 9 |
ksmps = 64 |
| 10 |
nchnls = 2 |
| 11 |
0dbfs = 1 |
| 12 |
|
| 13 |
; This is the example file for reshapearray |
| 14 |
|
| 15 |
/* |
| 16 |
|
| 17 |
reshapearray |
| 18 |
|
| 19 |
Reshape an array, maintaining the capacity of the array |
| 20 |
(it does NOT resize the array). |
| 21 |
|
| 22 |
You can reshape a 2D array to another array of equal capacity |
| 23 |
of reshape a 1D array to a 2D array, or a 2D array to a 1D |
| 24 |
array |
| 25 |
|
| 26 |
reshapearray array[], inumrows, inumcols=0 |
| 27 |
|
| 28 |
works with i and k arrays, at i-time and k-time |
| 29 |
|
| 30 |
*/ |
| 31 |
|
| 32 |
|
| 33 |
instr 1 |
| 34 |
ivalues[] fillarray 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 |
| 35 |
printarray ivalues |
| 36 |
reshapearray ivalues, 3, 4 |
| 37 |
printarray ivalues |
| 38 |
turnoff |
| 39 |
endin |
| 40 |
|
| 41 |
instr 2 |
| 42 |
kxs[][] init 3, 4 |
| 43 |
kxs fillarray 0, 1, 2, 3, \ |
| 44 |
10, 11, 12, 13, \ |
| 45 |
20, 21, 22, 23 |
| 46 |
reshapearray kxs, 4, 3 |
| 47 |
printarray kxs, 1, "", "kxs after" |
| 48 |
turnoff |
| 49 |
endin |
| 50 |
|
| 51 |
instr 3 |
| 52 |
kxs[][] init 3, 4 |
| 53 |
kxs fillarray 0, 1, 2, 3, \ |
| 54 |
10, 11, 12, 13, \ |
| 55 |
20, 21, 22, 23 |
| 56 |
reshapearray kxs, 12 |
| 57 |
printarray kxs, 1, "", "kxs after" |
| 58 |
turnoff |
| 59 |
|
| 60 |
endin |
| 61 |
|
| 62 |
</CsInstruments> |
| 63 |
|
| 64 |
<CsScore> |
| 65 |
i 1 0 0.01 |
| 66 |
i 2 1 0.01 |
| 67 |
i 3 2 0.01 |
| 68 |
</CsScore> |
| 69 |
|
| 70 |
</CsoundSynthesizer> |