CLAM-Development  1.4.0
AudioOut.hxx
Go to the documentation of this file.
1 /* Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
2  * UNIVERSITAT POMPEU FABRA
3  *
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  */
20 
21 
22 
23 #ifndef __AudioOut__
24 #define __AudioOut__
25 
26 #include "AudioIO.hxx"
27 #include "Processing.hxx"
28 #include "Audio.hxx"
29 #include "AudioDevice.hxx"
30 #include "AudioInPort.hxx"
31 
32 namespace CLAM{
33 
37 class AudioOut: public Processing
38 {
39 friend class AudioManager;
40 friend class AudioDevice;
41 private:
42  AudioIOConfig mConfig;
43  AudioDevice* mpDevice;
44 
45  AudioInPort mInput;
46 public:
47 
54  bool ConcreteConfigure(const ProcessingConfig& c)
55  throw(ErrProcessingObj);
56 
60  const ProcessingConfig &GetConfig() const { return mConfig;}
61 
62 
65  AudioOut();
66 
70  AudioOut( const AudioIOConfig& cfg );
71 
73  ~AudioOut();
74 
75 
76  const char * GetClassName() const {return "AudioOut";}
77 
80  bool Do(void);
81 
92  bool Do(const Audio& data)
93  {
94  if (!AbleToExecute()) return true; // object was disabled
95 
96  mpDevice->Write(data,mConfig.GetChannelID());
97  return true;
98  }
99 
103  void GetDeviceInfo(AudioDevice::TInfo &) const;
104 
105  int GetChannelID() const {return mConfig.GetChannelID();}
106 
109  bool IsSyncSource() const { return true; }
110 
111 protected:
112  bool ConcreteStart();
113  bool ConcreteStop();
114 };
115 
116 };//CLAM
117 
118 #endif
119