|
CLAM-Development
1.3
|
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 typedef OscillatorConfig Config; 00052 Config mConfig; 00053 00054 AudioInPort mInputPhaseMod; 00055 AudioInPort mInputFreqMod; 00056 TData mModIndex; 00057 00058 bool mModIdxUpdated; 00059 FloatInControl mModIdxCtl; 00060 00061 00062 inline void ApplyControls() 00063 { 00064 ApplyFreqAndAmpControls(); 00065 if ( mModIdxUpdated ) 00066 { 00067 mModIndex = mModIdxCtl.GetLastValue(); 00068 mModIdxUpdated = false; 00069 } 00070 } 00071 void UpdateModIdx( TControlData ); 00072 00073 public: 00074 Oscillator(const Config& c = Config()); 00075 00076 virtual ~Oscillator(); 00077 bool ConcreteConfigure( const ProcessingConfig& c ); 00078 00079 const char * GetClassName() const {return "Oscillator";} 00080 const ProcessingConfig &GetConfig() const { return mConfig;} 00081 00082 bool Do(); 00083 bool Do(Audio & out) 00084 { 00085 return SimpleOscillator::Do(out); 00086 } 00087 bool Do(const Audio& pitchModIn,const Audio& phaseModIn,Audio& out); 00088 bool Do(const Audio& pitchModIn,const int& dum ,Audio& out); 00089 bool Do(const int& dum ,const Audio& phaseModIn,Audio& out); 00090 }; 00091 00092 } 00093 00094 #endif //__Oscillator_hxx__ 00095
1.7.6.1