00001
00002
00003
00004
00005
00006 #ifndef INCLUDE_Panners_H
00007 #define INCLUDE_Panners_H
00008
00009 #include "CSL_Core.h"
00010
00011 namespace csl {
00012
00020
00021 class Panner : public Effect, public Scalable {
00022 public:
00024 Panner();
00025 Panner(UnitGenerator &input);
00026 Panner(UnitGenerator &input, UnitGenerator &position);
00027 Panner(UnitGenerator &input, float position);
00028 Panner(UnitGenerator &input, UnitGenerator &position, UnitGenerator &litude);
00029 Panner(UnitGenerator &input, UnitGenerator &position, float amplitude);
00030 Panner(UnitGenerator &input, float position, float amplitude);
00031 ~Panner();
00033 void setPosition(UnitGenerator &pan);
00034 void setPosition(float pan);
00035 virtual unsigned numChannels() const { return 2; };
00036
00037 virtual void nextBuffer(Buffer &outputBuffer) throw (CException);
00038 };
00039
00046
00047 class Mixer : public UnitGenerator, public Scalable {
00048 public:
00049 Mixer();
00050 Mixer(unsigned chans);
00051 Mixer(UnitGenerator & mScale);
00052 Mixer(unsigned chans, UnitGenerator & mScale);
00053 virtual ~Mixer();
00054
00055 UGenVector getInputs(void) { return(mSources); };
00056 unsigned getNumInputs(void) { return(mSources.size()); };
00057
00058 void addInput(UnitGenerator & inp);
00059 void addInput(UnitGenerator * inp);
00060 void removeInput(UnitGenerator & inp);
00062 void nextBuffer(Buffer &outputBuffer) throw (CException);
00064 void dump();
00065
00066 protected:
00067 UGenVector mSources;
00068 Buffer mOpBuffer;
00069 void allocateOpBuffer(unsigned chans);
00070 };
00071
00072 #ifdef NOT_PORTED_YET
00073
00074
00075
00076 class StereoWidth : public UnitGenerator, public Effect {
00077
00078 protected:
00079 float mWidth;
00080 float mGain;
00081 float mPan;
00082
00083 public:
00084
00085 StereoWidth ();
00086 ~StereoWidth();
00087
00088 void set_width(float width) { _width = width; }
00089 void set_pan(float pan) { _pan = pan; }
00090 void set_gain(float gain) { _gain = gain; }
00091
00092 status next_buffer(Buffer & inputBuffer, Buffer & outputBuffer);
00093 };
00094
00095
00096
00097 #define MAX_OUTPUTS 16
00098
00099 class NtoMPanner : public Panner {
00100
00101 protected:
00102 unsigned _in_ch, _out_ch;
00103 CPoint ** _speakers;
00104 SampleStream * _posY;
00105 float _spread;
00106 Buffer _op_buffer;
00107 void init_speakers(void);
00108
00109 public:
00110
00111
00112 NtoMPanner() : Panner() { };
00113 NtoMPanner(UnitGenerator & i, float a, unsigned in_c, unsigned out_c);
00114 NtoMPanner(UnitGenerator & i, SampleStream & pX, SampleStream & pY, SampleStream & a, unsigned in_c, unsigned out_c);
00115 NtoMPanner(UnitGenerator & i, SampleStream & pX, SampleStream & pY, SampleStream & a, unsigned in_c, unsigned out_c, float spr);
00116 NtoMPanner(UnitGenerator & i, SampleStream & pX, SampleStream & pY, float a, unsigned in_c, unsigned out_c, float spr);
00117 ~NtoMPanner();
00118
00119 void init_stereo(float dist);
00120 void init_quad(float dist);
00121 void init_5point1(float dist);
00122 void init_6ch(float x, float y);
00123
00124 void set_x(float x) { _pos->set_value(x); };
00125 void set_y(float y) { _posY->set_value(y); };
00126
00127 status next_buffer(Buffer & inputBuffer, Buffer & outputBuffer);
00128
00129 };
00130
00131 #endif NOT_PORTED_YET
00132
00133 }
00134
00135 #endif
00136