00001 /* Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG) 00002 * UNIVERSITAT POMPEU FABRA 00003 * 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 */ 00020 00021 00022 00023 #ifndef __AudioOut__ 00024 #define __AudioOut__ 00025 00026 #include "AudioIO.hxx" 00027 #include "Processing.hxx" 00028 #include "Audio.hxx" 00029 #include "AudioDevice.hxx" 00030 #include "AudioInPort.hxx" 00031 00032 namespace CLAM{ 00033 00037 class AudioOut: public Processing 00038 { 00039 friend class AudioManager; 00040 friend class AudioDevice; 00041 private: 00042 AudioIOConfig mConfig; 00043 AudioDevice* mpDevice; 00044 00045 AudioInPort mInput; 00046 public: 00047 00054 bool ConcreteConfigure(const ProcessingConfig& c) 00055 throw(ErrProcessingObj); 00056 00060 const ProcessingConfig &GetConfig() const { return mConfig;} 00061 00062 00065 AudioOut(); 00066 00070 AudioOut( const AudioIOConfig& cfg ); 00071 00073 ~AudioOut(); 00074 00075 00076 const char * GetClassName() const {return "AudioOut";} 00077 00080 bool Do(void); 00081 00092 bool Do(const Audio& data) 00093 { 00094 if (!AbleToExecute()) return true; // object was disabled 00095 00096 mpDevice->Write(data,mConfig.GetChannelID()); 00097 return true; 00098 } 00099 00103 void GetDeviceInfo(AudioDevice::TInfo &) const; 00104 00105 int GetChannelID() const {return mConfig.GetChannelID();} 00106 00109 bool IsSyncSource() const { return true; } 00110 00111 protected: 00112 bool ConcreteStart(); 00113 bool ConcreteStop(); 00114 }; 00115 00116 };//CLAM 00117 00118 #endif 00119