MIDIClocker.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 __MIDIClocker__
00023 #define __MIDIClocker__
00024 
00025 #include "Processing.hxx"
00026 #include "MIDIDevice.hxx"
00027 #include "MIDIEnums.hxx"
00028 
00029 namespace CLAM
00030 {
00031 
00040 class MIDIClockerConfig: public ProcessingConfig
00041 {
00042 public:
00043         DYNAMIC_TYPE_USING_INTERFACE (MIDIClockerConfig, 1, ProcessingConfig);
00044 
00046         DYN_ATTRIBUTE (0, public, std::string, Device);
00047 
00048 protected:
00049         void DefaultInit(void)
00050         {
00051                 AddDevice();
00052                 UpdateData();
00053 
00054                 SetDevice("default:default");
00055         }
00056 };
00057 
00058 
00062 class MIDIClocker: public Processing
00063 {
00064 friend class MIDIManager;
00065 friend class MIDIDevice;
00066 protected:
00067         MIDIClockerConfig mConfig;
00068         MIDIDevice* mpDevice;
00069         FloatInControl mInput;
00070 public:
00071 
00078         virtual bool ConcreteConfigure(const ProcessingConfig& c)
00079                 throw(ErrProcessingObj);
00080         
00084         const ProcessingConfig &GetConfig() const { return mConfig;}
00085 
00086         MIDIClocker()
00087         :mInput("input",this,&MIDIClocker::DoClock)
00088         {
00089                 mpDevice = 0;
00090                 Configure(MIDIClockerConfig());
00091         }
00092 
00096         MIDIClocker(const MIDIClockerConfig &c)
00097         :mInput("input",this,&MIDIClocker::DoClock)
00098         {
00099                 mpDevice = 0;
00100                 Configure(c);
00101         }
00102 
00104         ~MIDIClocker() { if (mpDevice) mpDevice->Unregister(*this); }
00105 
00106         const char * GetClassName() const {return "MIDIClocker";}
00107 
00110         bool Do(void)
00111         { 
00112                 return true;
00113         }
00114 
00118         void GetDeviceInfo(MIDIDevice::TInfo &) const;
00119 
00120         /*
00121          *  @param val The value received with this message
00122          *  @return 1 if method has been executed correctly
00123          */
00124         void DoClock(TControlData val)
00125         {
00126                 if (mpDevice) mpDevice->SetClock(val);
00127         }
00128 
00129 protected:
00130         bool ConcreteStart(void);
00131 
00132 };
00133 
00134 
00135 
00136 } // namespace CLAM
00137 #endif
00138 
Generated by  doxygen 1.6.3