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 __MIDIIn__ 00023 #define __MIDIIn__ 00024 00025 #include "Processing.hxx" 00026 #include "MIDIDevice.hxx" 00027 #include "MIDIEnums.hxx" 00028 #include "MIDIIOConfig.hxx" 00029 00030 namespace CLAM { 00031 00035 class MIDIIn: public Processing 00036 { 00037 friend class MIDIManager; 00038 friend class MIDIDevice; 00039 protected: 00040 MIDIIOConfig mConfig; 00041 MIDIDevice* mpDevice; 00042 public: 00053 virtual bool ConcreteConfigure(const ProcessingConfig& c) 00054 throw(ErrProcessingObj); 00055 00059 const ProcessingConfig &GetConfig() const { return mConfig;} 00060 private: 00061 virtual void Handle(unsigned char* msg,int size) = 0; 00062 00077 public: 00078 MIDIIn(bool configure = true) 00079 { 00080 mpDevice = 0; 00081 if (configure) 00082 { 00083 Configure(MIDIIOConfig()); 00084 } 00085 } 00086 00092 MIDIIn(const MIDIIOConfig &c) 00093 { 00094 mpDevice = 0; 00095 Configure(c); 00096 } 00097 00100 ~MIDIIn() { if (mpDevice) mpDevice->Unregister(*this); } 00101 00102 const char * GetClassName() const {return "MIDIIn";} 00103 00106 bool Do(void) 00107 { 00108 return true; 00109 } 00110 00116 void GetDeviceInfo(MIDIDevice::TInfo &) const; 00117 00118 protected: 00119 bool ConcreteStart(void); 00120 }; 00121 00122 } // namespace CLAM 00123 #endif 00124