CSL 5.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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.
16 setCopyPolicy(kIgnore);
17 mMixer = new AmbisonicMixer(order);
18 mRotator = new AmbisonicRotator(*mMixer);
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);
25 mRotator = new AmbisonicRotator(*mMixer);
26 mDecoder = new AmbisonicDecoder(*mRotator, layout);
27 }
28
29 AmbisonicPanner::~AmbisonicPanner() {
30 delete mDecoder;
31 delete mRotator;
32 delete mMixer;
33 }
34
35 //void AmbisonicPanner::initialize() {
36 //
37 //}
38
39 void AmbisonicPanner::addSource(SpatialSource &soundSource) {
40 mMixer->addInput(*(new AmbisonicEncoder(soundSource)));
41 }
42
43 // delete from the list, shifting if necessary
44
45 void AmbisonicPanner::removeSource(SpatialSource &soundSource) {
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