CLAM-Development
1.1
|
00001 /* 00002 * Copyright (c) 2001-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 _EnvelopeModulator_ 00023 #define _EnvelopeModulator_ 00024 00025 #include "Processing.hxx" 00026 #include "InPort.hxx" 00027 #include "AudioOutPort.hxx" 00028 #include "AudioInPort.hxx" 00029 #include "Envelope.hxx" 00030 #include "Audio.hxx" 00031 00032 namespace CLAM 00033 { 00034 00035 class EnvModulatorConfig: public ProcessingConfig 00036 { 00037 public: 00038 DYNAMIC_TYPE_USING_INTERFACE (EnvModulatorConfig, 3, ProcessingConfig); 00039 DYN_ATTRIBUTE (0, public, TData, SampleRate); 00040 DYN_ATTRIBUTE (1, public, int, FrameSize); 00041 DYN_ATTRIBUTE (2, public, bool, EnvelopeCompression); 00042 protected: 00043 00044 void DefaultInit(void); 00045 }; 00046 00047 class EnvelopeModulator: public Processing 00048 { 00049 public: 00050 00051 InPort<Envelope> InputEnvelope; 00052 InPort<Audio> InputAudio; 00053 OutPort<Audio> Output; 00054 00055 private: 00056 EnvModulatorConfig mConfig; 00057 TTime mDeltaX; 00058 bool mCompress; 00059 00060 TData Compress(TData); 00061 00062 bool ConcreteConfigure(const ProcessingConfig& c); 00063 00064 public: 00065 EnvelopeModulator(const EnvModulatorConfig& c = EnvModulatorConfig()); 00066 00067 const char * GetClassName() const {return "EnvelopeModulator";} 00068 00069 const ProcessingConfig &GetConfig() const { return mConfig;} 00070 00071 void Attach(Envelope& env, Audio& inp, Audio& out); 00072 00073 bool Do(void); 00074 00075 bool Do(const Envelope& env, const Audio& inp, Audio& out); 00076 00077 }; 00078 00079 } 00080 00081 #endif 00082 00083