aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Knight <q@1bpm.net>2021-07-22 01:39:33 +0100
committerRichard Knight <q@1bpm.net>2021-07-22 01:39:33 +0100
commit9f5577cbb65e06aa075a9b4b3a17d7a93656f747 (patch)
tree302e748b7ca88b0b3c85dec8123ed32ff84b16ba
parentcf0f0faa24b90ceb7095b19f69314059f9304204 (diff)
downloadcsound-sdl-9f5577cbb65e06aa075a9b4b3a17d7a93656f747.tar.gz
csound-sdl-9f5577cbb65e06aa075a9b4b3a17d7a93656f747.tar.bz2
csound-sdl-9f5577cbb65e06aa075a9b4b3a17d7a93656f747.zip
cmake adjustments, example added
-rw-r--r--examples/test.csd6
-rw-r--r--examples/test2.csd61
2 files changed, 66 insertions, 1 deletions
diff --git a/examples/test.csd b/examples/test.csd
index 3e528cf..e5e80f1 100644
--- a/examples/test.csd
+++ b/examples/test.csd
@@ -1,7 +1,6 @@
<CsoundSynthesizer>
<CsOptions>
-odac
---opcode-lib=/home/bargepole/bpcheckout/csound-dev/sdltest/sdllib.so
</CsOptions>
<CsInstruments>
sr = 44100
@@ -9,6 +8,11 @@ kr = 4410
nchnls = 2
0dbfs = 1
seed 0
+/*
+ SDL example 1
+ Oscillator triggering a rectangle, a moving line and mouse input
+*/
+
gisdl init -1
gicol init -1
diff --git a/examples/test2.csd b/examples/test2.csd
new file mode 100644
index 0000000..3e0dfa3
--- /dev/null
+++ b/examples/test2.csd
@@ -0,0 +1,61 @@
+<CsoundSynthesizer>
+<CsOptions>
+-odac
+-m0
+</CsOptions>
+<CsInstruments>
+sr = 44100
+kr = 441
+nchnls = 2
+0dbfs = 1
+seed 0
+/*
+ SDL Example 2
+ Mouse triggered clusters of rectangles
+*/
+
+gisdl init -1
+gicol init -1
+
+instr 1
+ gisdl, ktrig, kx, ky sdlinit "A SDL Window", 1000, 1000, 30
+ schedkwhen ktrig, 0.05, 0, 2, 0, 1, kx, ky
+ kc = abs(oscil(40, 0.2))
+ ibg sdlcolour kc, kc, kc, 0
+ sdlrect gisdl, ibg, 0, 0, 10, 10
+endin
+
+
+instr 2
+ ix init p4
+ iy init p5
+ inum random 5, 20
+ index = 0
+ while (index < inum) do
+ event_i "i", 3, random(0, 0.5), random(0.5, 1.5), random(ix-0.05, ix+0.05), random(iy-0.05, iy+0.05)
+ index += 1
+ od
+endin
+
+instr 3
+ kc1 line 0, p3, random(100, 255)
+ kc2 line 0, p3, random(100, 255)
+ icol sdlcolour kc1, kc2, kc2, 255
+ kx init p4
+ ky init p5
+ isize random 0.01, 0.05
+ sdlrect gisdl, icol, kx, ky, isize, isize
+
+ iamp = 0.3 + (p5*0.7)
+ kamp line iamp, p3, 0
+ ipitch = 100 + (p4*1000)
+ a1 oscil kamp, ipitch
+ outs a1*0.01, a1*0.01
+endin
+
+
+</CsInstruments>
+<CsScore>
+i1 0 6000
+</CsScore>
+</CsoundSynthesizer>