summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-04-16 22:18:27 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-04-16 22:18:27 +0200
commit6aabf209da366b2c62b0b44fc6eed9b1a24cdc63 (patch)
tree9f41835c433d701438119f9f87fbe462d6adf0e2 /lib
parent7f8536b4a6d7fd06b1cd4929f548d241183c09cd (diff)
downloaddigitale-debutanten-6aabf209da366b2c62b0b44fc6eed9b1a24cdc63.tar.gz
added sample-based oscillator class
Diffstat (limited to 'lib')
-rw-r--r--lib/SampOsc.ck26
-rw-r--r--lib/pulse.wavbin0 -> 35322 bytes
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/SampOsc.ck b/lib/SampOsc.ck
new file mode 100644
index 0000000..bc5feda
--- /dev/null
+++ b/lib/SampOsc.ck
@@ -0,0 +1,26 @@
+/*
+ * Sample based oscillator
+ * NOTE: may not be frequency-synced!
+ */
+public class SampOsc extends SndBuf {
+ 1 => float __freq; /* pseudo-private */
+ fun float freq(float f)
+ {
+ return f => __freq;
+ }
+ fun float freq()
+ {
+ return __freq;
+ }
+
+ /* FIXME: not independant from cwd when instantiated */
+ "lib/pulse.wav" => read;
+ 1 => rate;
+
+ fun void __loop() /* pseudo-private */
+ {
+ while (second/__freq => now)
+ 0 => pos;
+ }
+ spork ~ __loop();
+}
diff --git a/lib/pulse.wav b/lib/pulse.wav
new file mode 100644
index 0000000..ccf7b26
--- /dev/null
+++ b/lib/pulse.wav
Binary files differ