Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

FEAPIPluginBase.h

Go to the documentation of this file.
00001 
00002 //     /*! \file FEAPIPluginBase.h: \brief interface of the CFeatureExtractBase class. */
00003 //
00004 //        Copyright (c) 2004-2007, Alexander Lerch, zplane.development GbR
00005 //        All rights reserved.
00006 //
00007 //        Redistribution and use in source and binary forms, with or without 
00008 //        modification, are permitted provided that the following conditions 
00009 //        are met:
00010 //
00011 //        *   Redistributions of source code must retain the above copyright 
00012 //            notice, this list of conditions and the following disclaimer. 
00013 //        *   Redistributions in binary form must reproduce the above 
00014 //            copyright notice, this list of conditions and the following 
00015 //            disclaimer in the documentation and/or other materials 
00016 //            provided with the distribution. 
00017 //        *   Neither the name of the FEAPI development team nor the names 
00018 //            of its contributors may be used to endorse or promote products 
00019 //            derived from this software without specific prior written 
00020 //            permission. 
00021 //
00022 //        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
00023 //        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
00024 //        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
00025 //        FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
00026 //        COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
00027 //        INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
00028 //        BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
00029 //        LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
00030 //        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00031 //        LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
00032 //        ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
00033 //        POSSIBILITY OF SUCH DAMAGE.
00034 //
00037 //                      !!!Do never ever edit this file!!!
00040 
00041 #if !defined(FEAPI_PLUGIN_BASE_HEADER_INCLUDED__)
00042 #define FEAPI_PLUGIN_BASE_HEADER_INCLUDED__
00043 
00044 
00045 #include <map>
00046 
00047 
00088 class CPin
00089 {
00090 
00092 // Constructors and destructor
00094 
00095 public: 
00101     CPin(const CPin& OtherPin);
00102 
00112     static CPin SetIndex(int iIndex);
00113 
00115     virtual ~CPin();
00116 
00117 
00119 // Properties common to all kinds of pins
00121 
00122 public:
00123 
00129     int GetIndex() const;
00130 
00137     CPin& SetName(const std::string& Name);
00138 
00144     const std::string& GetName() const;
00145 
00152     CPin& SetUnit(const std::string& Unit);
00153 
00159     const std::string& GetUnit() const;
00160 
00167     CPin& SetDescription(const std::string& Description);
00168 
00174     const std::string& GetDescription() const;
00175 
00182     CPin& SetRangeMin(float fRangeMin);
00183  
00189     float GetRangeMin() const;
00190 
00197     CPin& SetRangeMax(float fRangeMax);
00198 
00204     float GetRangeMax() const;
00205 
00206 
00208 // Properties common to input and result pins only
00210 
00211 public:
00212 
00219     CPin& SetSampleRate(float fSampleRate);
00220 
00226     float GetSampleRate() const;
00227 
00234     CPin& SetQuantizedTo(float fQuantizedTo);
00235 
00241     float GetQuantizedTo() const;
00242 
00243 
00245 // Properties of parameter pins only
00247 
00248 public:
00249 
00256     CPin& SetDefaultValue(float fDefaultValue);
00257     
00263     float GetDefaultValue() const;
00264 
00271     CPin& SetIsChangeableInRealTime(int bIsChangeableInRealTime);
00272     
00278     int GetIsChangeableInRealTime() const;
00279 
00280 protected:
00281 
00283     CPin();
00284 
00286     CPin(int iIndex);
00287 
00289     void Copy(const CPin& OtherPin);
00290 
00291 private:
00292     int m_iIndex;                       
00293     std::string m_Name;                 
00294     std::string m_Unit;                 
00295     std::string m_Description;          
00296     float m_fRangeMin;                  
00297     float m_fRangeMax;                  
00298     float m_fQuantizedTo;               
00299     float m_fSampleRate;                
00300     float m_fDefaultValue;              
00301     int m_bIsChangeableInRealTime;      
00302 
00303     // Friend classes
00304     friend class std::map<int, CPin>;
00305 };
00306 
00307 
00308 typedef std::map<int, CPin> PinMap;
00309 
00318 class CFeatureExtractBase
00319 {
00320 public:
00321 
00327     CFeatureExtractBase ();
00328     
00332     virtual ~CFeatureExtractBase ();
00333 
00334 
00336     // method declaration
00337 
00338 
00347     static int                 GetPluginAPIVersion (FEAPI_VersionInfo_t eApiMajorMinorOrSubVersion);
00348 
00349 
00350 
00361     FEAPI_Error_t              InitializePlugin (   float               fInputSampleRate, 
00362                                                     int                 iNumberOfAudioChannels,
00363                                                     int                 iHostApiMajorVersion,
00364                                                     FEAPI_UserData_t     *pstUserData);
00365 
00372     FEAPI_Error_t              GetPluginName (     char *pcPluginName);
00373 
00380     FEAPI_Error_t              GetPluginVendor (   char *pcPluginVendor);
00381 
00388     virtual float              GetPluginProperty (  FEAPI_PluginProperty_t ePluginProperty) = 0;
00389 
00396     FEAPI_Error_t              GetPluginId (   char *pcPluginId);
00397 
00404     int                        GetPluginVendorVersion (FEAPI_VersionInfo_t ePluginMajorMinorOrSubVersion);
00405 
00412     FEAPI_Error_t              GetPluginDescription (char *pcPluginDescription);
00413 
00420     FEAPI_Error_t              GetPluginCopyright (char *pcPluginCopyright);
00421 
00430     int                        GetPluginNumOfInputs ();
00431 
00439     virtual FEAPI_Error_t      GetPluginInputDescription (  int                         iInputIndex, 
00440                                                             FEAPI_SignalDescription_t   *pstInputDescription);
00441 
00447     int                        GetPluginNumOfResults ();
00448 
00449 
00457     virtual FEAPI_Error_t      GetPluginResultDescription ( int                         iResultIndex, 
00458                                                             FEAPI_SignalDescription_t   *pstResultDescription);
00459 
00465     int                        GetPluginNumOfParameters ();
00466 
00474     virtual FEAPI_Error_t      GetPluginParameterDescription (  int                         iParameterIndex, 
00475                                                                 FEAPI_ParameterDescription_t *pstParameterDescription);
00476 
00484     virtual FEAPI_Error_t      SetPluginParameter ( int     iParameterIndex, 
00485                                                     float   fValue);
00486 
00493     virtual float              GetPluginParameter (  int iParameterIndex);
00494 
00503     virtual FEAPI_Error_t      ProcessPlugin (  const FEAPI_Signal_t    **ppfInputBuffer, 
00504                                                 const FEAPI_TimeStamp_t *ptFEAPI_TimeStamp,
00505                                                 int                     iNumberOfFrames) = 0;
00506 
00507 
00513     virtual FEAPI_Error_t      ProcessPluginDone ();
00514 
00515 
00522     virtual int                GetPluginSizeOfResult (int iResultIndex) = 0;
00523 
00532     virtual FEAPI_Error_t      GetPluginResult (int                 iResultIndex, 
00533                                                 float               *pfResult,
00534                                                 FEAPI_TimeStamp_t   *ptFEAPI_TimeStamp) = 0;
00535 
00542     virtual int                GetPluginResultLatency (int iResultIndex);
00543 
00549     virtual FEAPI_Error_t      ResetPlugin ();
00550 
00551 
00552 // Helper methods
00553 protected:
00554     
00572     void SetPluginInputPinInfo(const CPin& PinInfo);
00573 
00591     void SetPluginResultPinInfo(const CPin& PinInfo);
00592     
00612     void SetPluginParameterPinInfo(const CPin& PinInfo);
00613     
00614 protected:
00615 
00617     // member variables
00618 
00619     float   m_fSampleRate;                  
00620 
00621     int     m_iMajorVersion,                
00622             m_iMinorVersion,                
00623             m_iSubVersion;                  
00624 
00625     bool    m_bIsInitialized;           
00626 
00627     std::string m_cPluginName,           
00628                 m_cPluginVendor,         
00629                 m_cPluginId,             
00630                 m_cPluginDescription,    
00631                 m_cPluginCopyRight;      
00632 
00633 
00634     PinMap m_Inputs;            
00635     PinMap m_Results;           
00636     PinMap m_Parameters;        
00637 
00638 };
00639 
00640 #endif // #if !defined(FEAPI_PLUGIN_BASE_HEADER_INCLUDED__)
00641 
00642 
00643 

Generated on Fri Mar 23 10:28:54 2007 for FEAPI Plugin Documentation by  doxygen 1.3.9.1