Oscillator.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
00003  *                         UNIVERSITAT POMPEU FABRA
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 #ifndef __Oscillator_hxx__
00023 #define __Oscillator_hxx__ 
00024 
00025 #include "SimpleOscillator.hxx"
00026 #include "Processing.hxx"
00027 #include "ProcessingConfig.hxx"
00028 #include "Audio.hxx"
00029 #include "AudioInPort.hxx"
00030 #include "InControl.hxx"
00031 #include <string>
00032 
00033 namespace CLAM
00034 {
00035         
00036 class OscillatorConfig: public ProcessingConfig
00037 {
00038 public:
00039         DYNAMIC_TYPE_USING_INTERFACE (OscillatorConfig, 5, ProcessingConfig);
00040         DYN_ATTRIBUTE (0, public, TData, Frequency);
00041         DYN_ATTRIBUTE (1, public, TData, Amplitude);
00042         DYN_ATTRIBUTE (2, public, TData, ModIndex);
00043         DYN_ATTRIBUTE (3, public, TData , Phase);
00044         DYN_ATTRIBUTE (4, public, TData , SamplingRate);
00045 protected:
00046         void DefaultInit(void);
00047 };
00048 
00049 class Oscillator : public SimpleOscillator
00050 {
00051         OscillatorConfig mConfig;
00052 
00053         AudioInPort mInputPhaseMod;
00054         AudioInPort mInputFreqMod;
00055         TData mModIndex;
00056 
00057         typedef InControlTmpl<Oscillator> OscillatorCtrl;
00058 
00059         bool mModIdxUpdated;
00060         Oscillator::OscillatorCtrl * mModIdxCtl;
00061 
00062         
00063         inline void ApplyControls()
00064         {
00065                 ApplyFreqAndAmpControls();
00066                 if ( mModIdxUpdated )
00067                         {
00068                                 mModIndex = mModIdxCtl->GetLastValue();
00069                                 mModIdxUpdated = false;
00070                         }
00071         }
00072         int UpdateModIdx( TControlData );
00073 
00074 public:
00075         Oscillator();
00076         
00077         Oscillator(const OscillatorConfig& c );
00078 
00079         virtual ~Oscillator();
00080         bool ConcreteConfigure( const ProcessingConfig& c );
00081 
00082         const char * GetClassName() const {return "Oscillator";}
00083         const ProcessingConfig &GetConfig() const { return mConfig;}
00084 
00085         bool Do();
00086         bool Do(Audio & out)
00087         {
00088                 return SimpleOscillator::Do(out);
00089         }
00090         bool Do(const Audio& pitchModIn,const Audio& phaseModIn,Audio& out);
00091         bool Do(const Audio& pitchModIn,const int& dum ,Audio& out);
00092         bool Do(const int& dum ,const Audio& phaseModIn,Audio& out);
00093 };
00094 
00095 }
00096 
00097 #endif //__Oscillator_hxx__ 
00098 

Generated on Tue Aug 12 22:33:43 2008 for CLAM by  doxygen 1.5.5