Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed DBAP4.ck panner

  • Loading branch information...
commit e7a978f580bbe48f5ee1ca46240f0c7ccaa9d7fe 1 parent d5d619a
Hongchan Choi authored October 19, 2012
18  panning/DBAP4.ck
@@ -6,7 +6,7 @@
6 6
 // @version chuck-1.3.1.3
7 7
 
8 8
 
9  
-class DBAP4
  9
+class DBAP4 extends Chubgraph
10 10
 {
11 11
     // position of speakers: LF, RF, RR, LR
12 12
     [[-1.0, 1.0], [1.0, 1.0], [1.0, -1.0], [-1.0, -1.0]]
@@ -16,11 +16,11 @@ class DBAP4
16 16
     float _x, _y;
17 17
     
18 18
     // UGens
19  
-    UGen @ _source;
20 19
     Envelope _in;
21 20
     Envelope _out[4];
22 21
     
23 22
     // initialization
  23
+    inlet => _in;
24 24
     20::ms => _in.duration;
25 25
     1.0 => _in.target;
26 26
     for (0 => int i; i < 4; ++i) {
@@ -29,13 +29,6 @@ class DBAP4
29 29
         1.0 => _out[i].target;
30 30
     }
31 31
     
32  
-    // setSource(): obsolete. will be replaced with Chubgraph
33  
-    fun void setSource(UGen source) {
34  
-        if (_source != NULL) _source =< _in;
35  
-        source @=> _source;
36  
-        _source => _in;
37  
-    }
38  
-
39 32
     // setPosition(): implements simple DBAP. the radius 
40 33
     // of sound is set to 2.0 by default.
41 34
     fun void setPosition(float x, float y) {
@@ -56,4 +49,9 @@ class DBAP4
56 49
     fun void setGain(float gain) {
57 50
         gain => _in.target;
58 51
     }
59  
-}
  52
+}
  53
+
  54
+// example
  55
+SinOsc s => DBAP4 p4;
  56
+p4.setPosition(-1.0, 1.0);
  57
+1::second => now;
4  testtones/DacBeeps.ck
@@ -16,6 +16,7 @@ SinOsc sine[nChans];
16 16
 
17 17
 // iterate on each channel
18 18
 for (0 => int i; i < nChans; ++i) {
  19
+    880 => sine[i].freq;
19 20
     0.0 => sine[i].gain;
20 21
     sine[i] => dac.chan(i);
21 22
 }
@@ -34,7 +35,8 @@ fun void beepChannel(int id) {
34 35
 // create an infinite pattern that rotates around the speakers
35 36
 while(true) {
36 37
     for (1 => int i; i <= nChans; ++i) {
  38
+        <<< "Channel = ", i >>>;
37 39
         beepChannel(i);
38  
-        500::ms => now;
  40
+        1000::ms => now;
39 41
     }
40 42
 }

0 notes on commit e7a978f

Please sign in to comment.
Something went wrong with that request. Please try again.