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

AudioDeviceLinux.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 #ifndef AUDIODEVICELINUX_HPP 00022 #define AUDIODEVICELINUX_HPP 00023 00024 #ifdef HAVE_CONFIG_H 00025 #include "config.h" 00026 #endif 00027 00028 #define ALSA_PCM_NEW_HW_PARAMS_API 00029 #define ALSA_PCM_NEW_SW_PARAMS_API 00030 #include <alsa/asoundlib.h> 00031 00032 #include <qstring.h> 00033 00034 #include "AudioDevice.h" 00035 00036 class CAudioControlLinux; 00037 00038 class CAudioDeviceLinux: public CAudioDevice 00039 { 00040 Q_OBJECT 00041 private: 00042 int m_CardNumber; 00043 bool m_StopCapture, m_StopPlayback; 00044 //QWaitCondition m_CaptureFinished, m_PlaybackFinished; 00045 QMutex m_ResetBusy; 00046 00047 snd_pcm_t *m_pSndPcm; 00048 snd_pcm_hw_params_t *m_pHWParams; 00049 snd_pcm_sw_params_t *m_pSWParams; 00050 snd_pcm_channel_area_t m_ChannelArea[32]; 00051 snd_pcm_format_t m_Format; 00052 snd_pcm_uframes_t m_SamplesWritten, m_SamplesRead; 00053 snd_pcm_uframes_t m_MinBufferSize, m_MaxBufferSize, m_CurrentBufferSize; 00054 00055 CAudioControlLinux *m_pControl; 00056 00057 int GetHWParameters(); 00058 int SetHWParameters(); 00059 void DumpHWParameters(); 00060 int SetSWParamaters(); 00061 00062 private slots: 00063 void ResetStream(); 00064 00065 protected: 00066 void run(); 00067 00068 virtual bool Init(); 00069 virtual void Exit(); 00070 00071 virtual int StartCapture(); 00072 virtual void StopCapture(); 00073 virtual int StartPlayback(); 00074 virtual void StopPlayback(); 00075 00076 public: 00077 CAudioDeviceLinux(int card_number); 00078 virtual ~CAudioDeviceLinux(); 00079 00080 virtual unsigned long GetPlaybackPointer() const; 00081 00082 virtual void SetBufferLength(unsigned int len, unsigned int chunk_length = 0); 00083 virtual void SetBufferTime(unsigned int ms, unsigned int chunk_length = 0); 00084 //virtual int WriteDirectly(const void *, unsigned int len) = 0; 00085 00086 virtual void GetMixerSettings(QDomNode &) const; 00087 virtual void SetMixerSettings(const QDomNode &) const; 00088 00089 public slots: 00091 void ShowMixerControls(); 00092 }; 00093 00094 #endif

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