Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

AudioDevice.h

Go to the documentation of this file.
00001 /* audiodevs: Abstraction layer for audio hardware & samples 00002 Copyright (C) 2003-2004 Nemosoft Unv. 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 For questions, remarks, patches, etc. for this program, the author can be 00019 reached at camstream@smcc.demon.nl. 00020 */ 00021 00022 #ifndef AUDIODEVICE_HPP 00023 #define AUDIODEVICE_HPP 00024 00025 #ifdef HAVE_CONFIG_H 00026 #include "config.h" 00027 #endif 00028 00029 #include <qglobal.h> 00030 00031 #if (QT_VERSION >= 0x030000) 00032 #include <qmutex.h> 00033 #endif 00034 00035 #include <qdom.h> 00036 #include <qobject.h> 00037 #include <qthread.h> 00038 00039 #include "AudioRingBuffer.h" 00040 #include "SoundAttributes.h" 00041 00042 class CAudioDevice: public QObject, public QThread 00043 { 00044 friend class CAudioCollector; 00045 Q_OBJECT 00046 public: 00047 enum Mode { Capture, Playback }; 00048 00049 private: 00050 Mode m_Mode; 00051 int m_OpenCount; 00052 int m_CaptureCount, m_PlaybackCount; 00053 00054 private slots: 00055 void EnableCapture(); 00056 void DisableCapture(); 00057 void EnablePlayback(); 00058 void DisablePlayback(); 00059 00060 protected: 00061 QString m_ShortName, m_LongName; 00062 QString m_NodeName; 00063 bool m_Validated; 00064 00065 SoundAttributes m_CurrentSoundAttr; 00066 CRingBuffer m_CaptureBuffer, m_PlaybackBuffer; 00067 00068 virtual bool Init() = 0; 00069 virtual void Exit() = 0; 00070 00071 virtual int StartCapture() = 0; 00072 virtual void StopCapture() = 0; 00073 virtual int StartPlayback() = 0; 00074 virtual void StopPlayback() = 0; 00075 00076 Mode GetMode() const { return m_Mode; }; 00077 int GetCaptureCount() const { return m_CaptureCount; }; 00078 int GetPlaybackCount() const { return m_PlaybackCount; }; 00079 00080 public: 00081 CAudioDevice(); 00082 virtual ~CAudioDevice(); 00083 00084 QString GetName() const; 00085 QString GetLongName() const; 00086 QString GetNodeName() const; 00087 00088 bool IsValid() const; 00089 bool Open(Mode m); 00090 void Close(); 00091 bool IsOpen() const; 00092 00093 bool SetSoundAttributes(const SoundAttributes &); 00094 SoundAttributes GetSoundAttributes() const; 00095 00096 CAudioRingBufferReader *CreateReader(); 00097 CRingBufferWriter *CreateWriter(); 00098 00099 virtual unsigned long GetPlaybackPointer() const = 0; 00100 00101 virtual void SetBufferLength(unsigned int len, unsigned int chunk_length = 0) = 0; 00102 virtual void SetBufferTime(unsigned int ms, unsigned int chunk_length = 0) = 0; 00103 // virtual int WriteDirectly(const void *, unsigned int len) = 0; 00104 00106 virtual void ShowMixerControls() = 0; 00107 00108 virtual void GetMixerSettings(QDomNode &) const = 0; 00109 virtual void SetMixerSettings(const QDomNode &) const = 0; 00110 00111 signals: 00112 void Opened(); 00113 void Closed(); 00114 00123 void SoundAttributesChanged(const SoundAttributes &); 00124 }; 00125 00126 00127 #endif

Generated on Wed Dec 13 23:38:46 2006 for CamStream by doxygen 1.3.7