CSL  6.0
AmbisonicPanner.cpp
Go to the documentation of this file.
1 //
2 // AmbisonicPanner.h -- Ambisonic effects and panners.
3 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT
4 // Higher Order Ambisonic classes written by Jorge Castellanos, Graham Wakefield, Florian Hollerweger, 2005
5 //
6 
7 #include "AmbisonicPanner.h"
8 
9 using namespace csl;
10 
11 // Default constructor
12 
13 AmbisonicPanner::AmbisonicPanner(unsigned order, SpeakerLayout *layout) : SpatialPanner(layout) {
14  // This is needed so the default kCopy doesn't
15  // overide the multiple channel panning done here.
17  mMixer = new AmbisonicMixer(order);
19  mDecoder = new AmbisonicDecoder(*mRotator, layout);
20 }
21 
22 AmbisonicPanner::AmbisonicPanner(unsigned hOrder, unsigned vOrder, SpeakerLayout *layout)
23  : SpatialPanner(layout) {
24  setCopyPolicy(kIgnore); mMixer = new AmbisonicMixer(hOrder, vOrder);
26  mDecoder = new AmbisonicDecoder(*mRotator, layout);
27 }
28 
30  delete mDecoder;
31  delete mRotator;
32  delete mMixer;
33 }
34 
35 //void AmbisonicPanner::initialize() {
36 //
37 //}
38 
40  mMixer->addInput(*(new AmbisonicEncoder(soundSource)));
41 }
42 
43 // delete from the list, shifting if necessary
44 
46 // unsigned count = mSources.size();
47 // SpatialSource *tempSource;
48 //
49 // for (unsigned i = 0; i < count; i++) {
50 // tempSource = mSources[i]->input();
51 // if (tempSource == &soundSource) {
52 // mSources.erase(mSources.begin() + i);
53 // break;
54 // }
55 // }
56 }
57 
58 
59 void AmbisonicPanner::rotate(float amount) {
60  mRotator->setRotate(amount);
61 }
62 
63 //void AmbisonicPanner::speakerLayoutChanged() {
64 //
65 //}
66 
67 void AmbisonicPanner::nextBuffer(Buffer &outputBuffer /*, unsigned outBufNum */) throw(CException) {
68 
69 #ifdef CSL_DEBUG
70  logMsg("AmbisonicPanner::nextBuffer");
71 #endif
72  // Ask the decoder to fill the buffer with the data to be processed
73  ((UnitGenerator *)mDecoder)->nextBuffer(outputBuffer);
74 }
75 
76 
void logMsg(const char *format,...)
These are the public logging messages.
Definition: CGestalt.cpp:292
AmbisonicMixer * mMixer
Print info about this instance.
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
Definition: Accessor.h:17
void addSource(SpatialSource &s)
Implement Panner's addSource, inserting an Encoder to each source.
void rotate(float amount)
void setRotate(float amount)
Base class for all panners. Handles source management and holds a speaker layout. ...
Definition: SpatialPanner.h:22
Temp Spatial Sound Source.
Definition: SpatialSource.h:29
void addInput(AmbisonicUnitGenerator &input)
methods for adding/removing inputs to the mixer.
AmbisonicPanner(unsigned order=1, SpeakerLayout *layout=SpeakerLayout::defaultSpeakerLayout())
void nextBuffer(Buffer &outputBuffer)
fill the buffer with the next buffer_length of values
AmbisonicRotator * mRotator
void setCopyPolicy(BufferCopyPolicy ch)
get/set the receiver's buffer copy policy
Definition: CSL_Core.h:256
void removeSource(SpatialSource &s)
Remove a sound source.
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
Definition: CSL_Core.h:106
AmbisonicDecoder * mDecoder
ignore extra buffer channels
Definition: CSL_Core.h:213
forward declaration
Definition: CSL_Core.h:241
Base class of CSL exceptions (written upper-case). Has a string message.