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 _AudioMixer_hxx__ 00023 #define _AudioMixer_hxx__ 00024 00025 #include "Processing.hxx" 00026 #include "AudioOutPort.hxx" 00027 #include "AudioInPort.hxx" 00028 #include "Audio.hxx" 00029 #include "InControl.hxx" 00030 00031 namespace CLAM 00032 { 00033 00034 class AudioMixerConfig: public ProcessingConfig 00035 { 00036 public: 00037 DYNAMIC_TYPE_USING_INTERFACE (AudioMixerConfig, 2, ProcessingConfig); 00038 DYN_ATTRIBUTE (0, public, int, NumberOfInPorts); 00039 DYN_ATTRIBUTE (1, public, int, FrameSize); 00040 00041 protected: 00042 void DefaultInit(void) 00043 { 00044 AddAll(); 00045 UpdateData(); 00046 SetNumberOfInPorts(2); 00047 SetFrameSize(512); 00048 } 00049 00050 }; 00051 00052 class AudioMixer: public Processing 00053 { 00054 private: 00055 AudioMixerConfig mConfig; 00056 00057 std::vector< AudioInPort* > mInputPorts; 00058 AudioOutPort mOutputPort; 00059 std::vector< InControl* > mInputControls; 00060 00061 void RemovePortsAndControls(); 00062 void CreatePortsAndControls(); 00063 00064 public: 00065 bool ConcreteConfigure(const ProcessingConfig& c); 00066 AudioMixer(); 00067 virtual ~AudioMixer() 00068 { 00069 RemovePortsAndControls(); 00070 } 00071 bool ModifiesPortsAndControlsAtConfiguration() 00072 { 00073 return true; 00074 } 00075 00076 const char * GetClassName() const {return "AudioMixer";} 00077 const ProcessingConfig &GetConfig() const { return mConfig;} 00078 bool Do(); 00079 }; 00080 00081 } // namespace CLAM 00082 00083 #endif // __AudioMixer_hxx__ 00084