BinaryOp.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 #ifndef CSL_BINARYOP_H
00013 #define CSL_BINARYOP_H
00014 
00015 #include "CSL_Core.h"
00016 
00017 namespace csl {
00018 
00024 class BinaryOp : public Effect {
00025 
00026 public:                             
00027     BinaryOp(UnitGenerator & op1, UnitGenerator & op2);
00029     BinaryOp(UnitGenerator & op1, float op2);
00031     BinaryOp(float op1, UnitGenerator & op2);
00032     virtual ~BinaryOp();                
00033 
00035     void dump();                        
00036 
00037 
00038 protected:  
00040     virtual void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw(CException) = 0;
00042     inline bool isFixed();
00043     inline bool inputIsFixed();
00045     inline bool operandIsFixed();   
00047     inline sample operandFixedValue(Buffer & outputBuffer);     
00048 
00049 };
00050 
00052 
00053 #define DECLARE_OPERAND_CONTROLS                        \
00054     Port * opPort = mInputs[CSL_OPERAND];               \
00055     sample * inValue;                                       \
00056     sample opValue
00057 
00060 
00061 #define LOAD_OPERAND_CONTROLS                           \
00062     Controllable::pullInput(opPort, numFrames);         \
00063     Effect::pullInput(numFrames);                           \
00064     inValue = mInputPtr;                                    \
00065     opValue = opPort->nextValue()
00066 
00068 
00069 #define UPDATE_OPERAND_CONTROLS                     \
00070     opValue = opPort->nextValue()   ;                       \
00071     inValue++
00072 
00076 
00077 class AddOp : public BinaryOp {
00078 
00079 public:                             
00080     AddOp(UnitGenerator & op1, UnitGenerator & op2);
00082     AddOp(UnitGenerator & op1, float op2);
00084     AddOp(float op1, UnitGenerator & op2);
00085 
00086 //  float nextValue() throw (CException);
00087 
00088 protected:                          
00089     void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException) ;
00090 };
00091 
00095 
00096 class MulOp : public BinaryOp {
00097 
00098 public:                             
00099     MulOp(UnitGenerator & op1, UnitGenerator & op2);
00101     MulOp(UnitGenerator & op1, float op2);
00102 
00103     MulOp(float op2, UnitGenerator & op1);
00105 //  float nextValue() throw (CException);
00106 
00107 protected:                          
00108     void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException) ;
00109 
00110 };
00111 
00112 }
00113 
00114 #endif CSL_BINARYOP_H
00115 

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