00001 /* 00002 00003 This file is part of la Marmite. 00004 Copyright (C) 2005 Nicolas Falquet. 00005 00006 La Marmite is free software ; you can redistribute it and/or 00007 modify it under the terms of the GNU General Public License as 00008 published by the Free Software Foundation ; either version 2 of 00009 the License, or (at your option) any later version. 00010 00011 La Marmite is distributed in the hope that it will be useful, but 00012 WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with la Marmite ; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00019 02111-1307 USA 00020 00021 */ 00022 00023 #ifndef M_PLUGIN_H 00024 #define M_PLUGIN_H 00025 00026 using namespace std; 00027 00028 #include "MPluginDescriptor.h" 00029 #include "MModule.h" 00030 00031 class MPluginAudioInputPort; 00032 class MPluginAudioOutputPort; 00033 class MPluginControlInputPort; 00034 class MPluginControlOutputPort; 00035 00046 class MPlugin : public MPluginDescriptor, public MModule 00047 { 00048 00049 public : 00050 00051 // constructor - destructor 00052 00062 static MPlugin * CreateFromDescriptor ( const MPluginDescriptor * pluginDescriptor, const string & instanceName = "" ); 00063 00074 static MPlugin * CreateFromLibrary ( const string & library, const string & label, const string & instanceName = "" ); 00075 00082 virtual ~ MPlugin ( ); 00083 00084 // functions 00085 00086 virtual LADSPA_Handle LADSPAHandle ( ); 00087 00095 virtual MPluginAudioInputPort * AudioInput ( const unsigned int n ) const; 00096 00104 virtual MPluginAudioOutputPort * AudioOutput ( const unsigned int n ) const; 00105 00113 virtual MPluginControlInputPort * ControlInput ( const unsigned int n ) const; 00114 00122 virtual MPluginControlOutputPort * ControlOutput ( const unsigned int n ) const; 00123 00124 virtual MAudioInputPort * ModuleAudioInput ( const unsigned int n ) const; 00125 virtual MAudioOutputPort * ModuleAudioOutput ( const unsigned int n ) const; 00126 virtual MControlInputPort * ModuleControlInput ( const unsigned int n ) const; 00127 virtual MControlOutputPort * ModuleControlOutput ( const unsigned int n ) const; 00128 00133 virtual unsigned int NumberOfAudioInputs ( ) const; 00134 00139 virtual unsigned int NumberOfAudioOutputs ( ) const; 00140 00145 virtual unsigned int NumberOfControlInputs ( ) const; 00146 00151 virtual unsigned int NumberOfControlOutputs ( ) const; 00152 00165 virtual bool IsAutoRegister ( ) const; 00166 00167 public slots : 00168 00169 virtual void Activate ( ); 00170 00171 virtual void Deactivate ( ); 00172 00183 virtual void Run ( const unsigned int n ); 00184 00189 virtual void Cleanup ( ); 00190 00196 virtual void SetAutoRegister ( bool value ); 00197 00198 protected : 00199 00200 // protected constructor 00201 00202 MPlugin ( const LADSPA_Descriptor * descriptor, LADSPA_Handle instance, const string & instanceName ); 00203 00204 // protected methods 00205 00215 virtual void createAudioInput ( const unsigned long portNumber ); 00216 00226 virtual void createAudioOutput ( const unsigned long portNumber ); 00227 00237 virtual void createControlInput ( const unsigned long portNumber ); 00238 00248 virtual void createControlOutput ( const unsigned long portNumber ); 00249 00250 // protected attributes 00251 00253 vector < MPluginAudioInputPort * > _audioInput; 00254 00256 vector < MPluginAudioOutputPort * > _audioOutput; 00257 00259 vector < MPluginControlInputPort * > _controlInput; 00260 00262 vector < MPluginControlOutputPort * > _controlOutput; 00263 00265 LADSPA_Handle _instance; 00266 00268 bool _autoRegister; 00269 00270 }; 00271 00272 #include "MPluginAudioInputPort.h" 00273 #include "MPluginAudioOutputPort.h" 00274 #include "MPluginControlInputPort.h" 00275 #include "MPluginControlOutputPort.h" 00276 00277 #endif // M_PLUGIN_H