00001
00002
00003
00004
00005
00006 #ifndef CSL_Mixer_H
00007 #define CSL_Mixer_H
00008
00009 #include "CSL_Core.h"
00010 #include "CPoint.h"
00011
00012 namespace csl {
00013
00020
00021 class Mixer : public UnitGenerator, public Scalable {
00022 public:
00023 Mixer();
00024 Mixer(unsigned chans);
00025 Mixer(UnitGenerator & mScale);
00026 Mixer(unsigned chans, UnitGenerator & mScale);
00027 virtual ~Mixer();
00028
00029 UGenVector getInputs(void) { return(mSources); };
00030 unsigned getNumInputs(void) { return(mSources.size()); };
00031
00032 void addInput(UnitGenerator & inp);
00033 void addInput(UnitGenerator * inp);
00034 void removeInput(UnitGenerator & inp);
00035 void deleteInputs();
00037 void nextBuffer(Buffer &outputBuffer) throw (CException);
00039 void dump();
00040 unsigned activeSources();
00041
00042 protected:
00043 UGenVector mSources;
00044 Buffer mOpBuffer;
00045 void allocateOpBuffer(unsigned chans);
00046 };
00047
00056
00057 class Panner : public Effect, public Scalable {
00058 public:
00060 Panner();
00061 Panner(UnitGenerator &input);
00062 Panner(UnitGenerator &input, UnitGenerator &position);
00063 Panner(UnitGenerator &input, float position);
00064 Panner(UnitGenerator &input, UnitGenerator &position, UnitGenerator &litude);
00065 Panner(UnitGenerator &input, UnitGenerator &position, float amplitude);
00066 Panner(UnitGenerator &input, float position, float amplitude);
00067 ~Panner();
00069 void setPosition(UnitGenerator &pan);
00070 void setPosition(float pan);
00071 virtual unsigned numChannels() const { return 2; };
00072
00073 virtual void nextBuffer(Buffer &outputBuffer) throw (CException);
00074 };
00075
00079
00080 #define MAX_OUTPUTS 16
00081
00082 class NtoMPanner : public Panner {
00083
00084 protected:
00085 unsigned mInCh, mOutCh;
00086 CPoint ** mSpeakers;
00087 float mSpread;
00088 Buffer mOpBuffer;
00089 void initSpeakers(void);
00090
00091 public:
00092
00093 NtoMPanner() : Panner() { };
00094 NtoMPanner(UnitGenerator & i, float a, unsigned in_c, unsigned out_c);
00095 NtoMPanner(UnitGenerator & i, UnitGenerator & pX, UnitGenerator & pY, UnitGenerator & a, unsigned in_c, unsigned out_c);
00096 NtoMPanner(UnitGenerator & i, UnitGenerator & pX, UnitGenerator & pY, UnitGenerator & a, unsigned in_c, unsigned out_c, float spr);
00097 NtoMPanner(UnitGenerator & i, UnitGenerator & pX, UnitGenerator & pY, float a, unsigned in_c, unsigned out_c, float spr);
00098 ~NtoMPanner();
00099
00100 void init_stereo(float dist);
00101 void init_quad(float dist);
00102 void init_5point1(float dist);
00103 void init_6ch(float x, float y);
00104
00105 void setX(float x);
00106 void setY(float y);
00107
00108 virtual void nextBuffer(Buffer &outputBuffer) throw (CException);
00109 };
00110
00114
00115 class StereoWidth : public Effect {
00116
00117 public:
00118 StereoWidth ();
00119 ~StereoWidth();
00120
00121 void setWidth(float width) { mWidth = width; }
00122 void setPan(float pan) { mPan = pan; }
00123 void setGain(float gain) { mGain = gain; }
00124
00125 void nextBuffer(Buffer & inputBuffer) throw (CException);
00126
00127 protected:
00128 float mWidth;
00129 float mGain;
00130 float mPan;
00131 };
00132
00133 }
00134
00135 #endif