add test directory
authorBill Allen <[email protected]>
Sun, 10 Feb 2008 04:30:42 +0000 (9 23:30 -0500)
committerBill Allen <[email protected]>
Sun, 10 Feb 2008 04:30:42 +0000 (9 23:30 -0500)
com/wha/modsynth_test/TestRingBuffer.scala [new file with mode: 0644]

diff --git a/com/wha/modsynth_test/TestRingBuffer.scala b/com/wha/modsynth_test/TestRingBuffer.scala
new file mode 100644 (file)
index 0000000..486f7b0
--- /dev/null
@@ -0,0 +1,33 @@
+package com.wha.modsynth_test;
+
+import concurrent.ops._
+
+import com.wha.modsynth.RingBuffer
+
+object TestRingBuffer {
+  def kill(delay: Int) = new java.util.Timer().schedule(
+      new java.util.TimerTask {
+        override def run() = {
+          println("[killed]")
+          System.exit(0)
+        }
+      },
+      delay) // in milliseconds
+
+    def main(args: Array[String]) {
+      val buf = new RingBuffer(100)
+      var cnt = 100.0f
+      def produceString = { cnt }
+      def consumeString(ss: Float) = println(ss)
+      spawn { 
+        while (true) { 
+          val sig = 100.0f
+         val fx = buf.get
+          println (sig + fx * 0.5)
+          buf.put(sig + fx * 0.1f)
+        } 
+      }
+      kill(100)
+    }
+
+}