Mixer.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 #ifndef CSL_Mixer_H
00007 #define CSL_Mixer_H
00008 
00009 #include "CSL_Core.h"
00010 
00011 namespace csl {
00012 
00019 
00020 class Mixer : public UnitGenerator, public Scalable {
00021 public:
00022     Mixer();                    
00023     Mixer(unsigned chans);
00024     Mixer(UnitGenerator & mScale);
00025     Mixer(unsigned chans, UnitGenerator & mScale);
00026     virtual ~Mixer();
00027                     // Accessing
00028     UGenVector getInputs(void) { return(mSources); };       
00029     unsigned getNumInputs(void) { return(mSources.size()); };       
00030 
00031     void addInput(UnitGenerator & inp);
00032     void addInput(UnitGenerator * inp);
00033     void removeInput(UnitGenerator & inp);
00035     void nextBuffer(Buffer &outputBuffer) throw (Exception);
00037     void dump();
00038 
00039 protected:
00040     UGenVector mSources;                    
00041     Buffer mOpBuffer;                       
00042     void allocateOpBuffer(unsigned chans);      
00043 };
00044 
00045 
00046 
00047 
00055 //
00056 //class Panner : public Effect, public Scalable {
00057 //public:
00058 //                      /// Constructors / destructor
00059 //  Panner();                                               ///< empty constructor
00060 //  Panner(UnitGenerator &input);                           ///< given an input stream
00061 //  Panner(UnitGenerator &input, UnitGenerator &position);  ///< given input and position stream
00062 //  Panner(UnitGenerator &input, float position);               ///< given an input and an amplitude const
00063 //  Panner(UnitGenerator &input, UnitGenerator &position, UnitGenerator &amplitude);    ///< given an amplitude stream
00064 //  Panner(UnitGenerator &input, UnitGenerator &position, float amplitude);         ///< given an amplitude value
00065 //  Panner(UnitGenerator &input, float position, float amplitude);                  ///< given an amplitude value and pan value
00066 //  ~Panner();
00067 //                      /// Operations
00068 //  void setPosition(UnitGenerator &pan);                       ///< set the position to a UGen
00069 //  void setPosition(float pan);                                ///< set the position to a float
00070 //  virtual unsigned numChannels() const { return 2; };         ///< I'm stereo!
00071 //
00072 //  virtual void nextBuffer(Buffer &outputBuffer) throw (Exception);
00073 //};
00074 //
00075 //#ifdef NOT_PORTED_YET
00076 //
00078 //
00079 //class StereoWidth : public Effect {
00080 //
00081 //protected:
00082 //  float mWidth;           // stereo width range: -1->1. -1 -- mix to mono, 0 -- no change 1 -- widen
00083 //  float mGain;            // amplitude scaler 0->10, 1 -- no scaling
00084 //  float mPan;             // pan position 0->1 0.5 -- no panning
00085 //
00086 //public:
00087 //                          // Constructors / destructor
00088 //  StereoWidth ();
00089 //  ~StereoWidth();
00090 //              // Operations
00091 //  void set_width(float width) { _width = width; }             
00092 //  void set_pan(float pan) { _pan = pan; }
00093 //  void set_gain(float gain) { _gain = gain; }
00094 //
00095 //  status next_buffer(Buffer & inputBuffer, Buffer & outputBuffer);
00096 //};
00097 //
00099 //
00100 //#define MAX_OUTPUTS 16
00101 //
00102 //class NtoMPanner : public Panner {
00103 //
00104 //protected:
00105 //  unsigned _in_ch, _out_ch;   // the # of input and output channels
00106 //  CPoint ** _speakers;        // the speaker array
00107 //  SampleStream * _posY;       // the Y coordinate
00108 //  float _spread;              // angle between the channels in stereo inputs
00109 //  Buffer _op_buffer;          // a temporary operation Buffer
00110 //  void init_speakers(void);
00111 //
00112 //public:
00113 //                          // Constructors / destructor
00114 //                          // Args are: i: input, p: pan, a: ampl, s: spread
00115 //  NtoMPanner() : Panner() { };
00116 //  NtoMPanner(UnitGenerator & i, float a, unsigned in_c, unsigned out_c);
00117 //  NtoMPanner(UnitGenerator & i, SampleStream & pX, SampleStream & pY, SampleStream & a, unsigned in_c, unsigned out_c);
00118 //  NtoMPanner(UnitGenerator & i, SampleStream & pX, SampleStream & pY, SampleStream & a, unsigned in_c, unsigned out_c, float spr);
00119 //  NtoMPanner(UnitGenerator & i, SampleStream & pX, SampleStream & pY, float a, unsigned in_c, unsigned out_c, float spr);
00120 //  ~NtoMPanner();
00121 //                          // Setup speaker arrays
00122 //  void init_stereo(float dist);
00123 //  void init_quad(float dist);
00124 //  void init_5point1(float dist);
00125 //  void init_6ch(float x, float y);
00126 //                          // Operations -- these are only relevant if the positions are static variables
00127 //  void set_x(float x) { _pos->set_value(x); };
00128 //  void set_y(float y) { _posY->set_value(y); };
00129 //                          // do it!
00130 //  status next_buffer(Buffer & inputBuffer, Buffer & outputBuffer);
00131 //
00132 //};
00133 //
00134 //#endif NOT_PORTED_YET
00135 //
00136 }
00137 
00138 #endif
00139 

Generated on Fri Apr 6 20:18:13 2007 for CSL by  doxygen 1.4.5-20051010