MIDIClocker.cxx

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 
00023 
00024 #include "MIDIClocker.hxx"
00025 #include "MIDIManager.hxx"
00026 
00027 namespace CLAM {
00028 
00029 bool MIDIClocker::ConcreteConfigure(const ProcessingConfig& c)
00030         throw(ErrProcessingObj)
00031 {
00032         CopyAsConcreteConfig(mConfig, c);
00033 
00036         if (mpDevice)
00037                 mpDevice->Unregister(*this);
00038 
00039         MIDIManager *m;
00040 
00043         try {
00044                 m = &MIDIManager::Current();
00045         }
00046         catch (Err &e) {
00047                 ErrProcessingObj ne("MIDIClocker::ConcreteConfigure(): No MIDIManager found.",this);
00048                 ne.Embed(e);
00049                 throw(ne);
00050         }
00051 
00054         bool res;
00055         try {
00056                 res = m->Register(*this);
00057         }
00058         catch (Err &e) {
00059                 ErrProcessingObj ne("MIDIClocker::ConcreteConfigure(): Failed to register in MIDIManager.",this);
00060                 ne.Embed(e);
00061                 throw(ne);
00062         }
00063 
00064         if (res == false)
00065                 throw ErrProcessingObj("MIDIClocker::ConcreteConfigure(): "
00066                                            "Failed to register in MIDIManager.",this);
00067 
00068         return true;
00069 }
00070 
00071 bool MIDIClocker::ConcreteStart(void) 
00072 {
00073         if (!mpDevice)
00074                 throw(Err("MIDIClocker::ConcreteStart(): No Device found!"));
00076         mpDevice->Start();
00077         return true;
00078 }
00079 
00080 void MIDIClocker::GetDeviceInfo(MIDIDevice::TInfo &info) const
00081 {
00082         if (mpDevice)
00083                 mpDevice->GetInfo(info);
00084         else
00085                 info.Reset();
00086 }
00087 
00088 } // namespace CLAM
00089 
Generated by  doxygen 1.6.3