Permalink
Browse files

fixed DBAP4.ck panner

  • Loading branch information...
1 parent d5d619a commit e7a978f580bbe48f5ee1ca46240f0c7ccaa9d7fe @hoch hoch committed Oct 20, 2012
Showing with 11 additions and 11 deletions.
  1. +8 −10 panning/DBAP4.ck
  2. +3 −1 testtones/DacBeeps.ck
View
@@ -6,7 +6,7 @@
// @version chuck-1.3.1.3
-class DBAP4
+class DBAP4 extends Chubgraph
{
// position of speakers: LF, RF, RR, LR
[[-1.0, 1.0], [1.0, 1.0], [1.0, -1.0], [-1.0, -1.0]]
@@ -16,11 +16,11 @@ class DBAP4
float _x, _y;
// UGens
- UGen @ _source;
Envelope _in;
Envelope _out[4];
// initialization
+ inlet => _in;
20::ms => _in.duration;
1.0 => _in.target;
for (0 => int i; i < 4; ++i) {
@@ -29,13 +29,6 @@ class DBAP4
1.0 => _out[i].target;
}
- // setSource(): obsolete. will be replaced with Chubgraph
- fun void setSource(UGen source) {
- if (_source != NULL) _source =< _in;
- source @=> _source;
- _source => _in;
- }
-
// setPosition(): implements simple DBAP. the radius
// of sound is set to 2.0 by default.
fun void setPosition(float x, float y) {
@@ -56,4 +49,9 @@ class DBAP4
fun void setGain(float gain) {
gain => _in.target;
}
-}
+}
+
+// example
+SinOsc s => DBAP4 p4;
+p4.setPosition(-1.0, 1.0);
+1::second => now;
View
@@ -16,6 +16,7 @@ SinOsc sine[nChans];
// iterate on each channel
for (0 => int i; i < nChans; ++i) {
+ 880 => sine[i].freq;
0.0 => sine[i].gain;
sine[i] => dac.chan(i);
}
@@ -34,7 +35,8 @@ fun void beepChannel(int id) {
// create an infinite pattern that rotates around the speakers
while(true) {
for (1 => int i; i <= nChans; ++i) {
+ <<< "Channel = ", i >>>;
beepChannel(i);
- 500::ms => now;
+ 1000::ms => now;
}
}

0 comments on commit e7a978f

Please sign in to comment.