ControlMapper.hxx

Go to the documentation of this file.
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 _ControlMapper_
00023 #define _ControlMapper_
00024 
00025 #include "Mapping.hxx"
00026 #include "Array.hxx"
00027 #include "Processing.hxx"
00028 #include "InControl.hxx"
00029 #include "OutControl.hxx"
00030 #include <iosfwd>
00031 #include <string>
00032 
00033 namespace CLAM {
00034 
00035         class ControlMapperConfig:public ProcessingConfig
00036         {
00037         public:
00038                 DYNAMIC_TYPE_USING_INTERFACE (ControlMapperConfig, 3,ProcessingConfig);
00039                 DYN_ATTRIBUTE (0, public, std::string, Name);
00040                 DYN_ATTRIBUTE (1, public, std::string, Mapping);
00041                 DYN_ATTRIBUTE (2, public, DataArray, Arguments);
00042         protected:
00043                 void DefaultInit(void);         
00044         };
00045 
00046         class ControlMapper:public Processing
00047         {
00048         private:
00049                 typedef ControlMapperConfig Config;
00050                 Config mConfig;
00051                 Mapping* mMappingPtr;
00052 
00053                 FloatInControl mInput;
00054                 FloatOutControl mOutput;
00055         public:
00056                 ControlMapper(const Config& cfg = Config());
00057                 ~ControlMapper()
00058                 {
00059                 }
00060                 const char * GetClassName() const {return "ControlMapper";}
00061                 bool ConcreteConfigure(const ProcessingConfig& c);
00062                 void DoMap(TControlData val)
00063                 {
00064                         mOutput.SendControl(TControlData(mMappingPtr->Map(val)));
00065                 }
00066                 bool Do(void) { return true; }
00067                 inline const ProcessingConfig &GetConfig() const { return mConfig;}
00068         };
00069 
00070         
00071 }
00072 
00073 #endif //_ControlMapper_
00074 
00075 
00076 
Generated by  doxygen 1.6.3