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 __MIDIOut__ 00023 #define __MIDIOut__ 00024 00025 #include "Processing.hxx" 00026 #include "MIDIDevice.hxx" 00027 #include "MIDIEnums.hxx" 00028 #include "MIDIIOConfig.hxx" 00029 00030 namespace CLAM { 00031 00035 class MIDIOut: public Processing 00036 { 00037 friend class MIDIManager; 00038 friend class MIDIDevice; 00039 protected: 00040 MIDIIOConfig mConfig; 00041 MIDIDevice* mpDevice; 00042 public: 00043 00050 virtual bool ConcreteConfigure(const ProcessingConfig& c) 00051 throw(ErrProcessingObj); 00052 00056 const ProcessingConfig &GetConfig() const { return mConfig;} 00057 protected: 00058 virtual void Handle(unsigned char* msg,int size) = 0; 00059 public: 00074 MIDIOut(bool configure = true) 00075 { 00076 mpDevice = 0; 00077 if (configure) 00078 { 00079 Configure(MIDIIOConfig()); 00080 } 00081 } 00082 00088 MIDIOut(const MIDIIOConfig &c) 00089 { 00090 mpDevice = 0; 00091 Configure(c); 00092 } 00093 00096 ~MIDIOut() { if (mpDevice) mpDevice->Unregister(*this); } 00097 00098 const char * GetClassName() const {return "MIDIOut";} 00099 00102 bool Do(void) 00103 { 00104 return true; 00105 } 00106 00112 void GetDeviceInfo(MIDIDevice::TInfo &) const; 00113 00114 protected: 00115 bool ConcreteStart(void); 00116 }; 00117 00118 } // namespace CLAM 00119 #endif 00120