00001 /* 00002 * Copyright (C) 2007 Anand K. Mistry 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (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., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301, USA. 00018 */ 00019 /* vim: set expandtab tabstop=4 shiftwidth=4: */ 00020 00021 #ifndef _AUDIOINPUT_H_ 00022 #define _AUDIOINPUT_H_ 00023 00024 #include <QString> 00025 #include <unistd.h> 00026 00027 class AudioInput 00028 { 00029 public: 00030 virtual ~AudioInput() {} 00031 00032 virtual bool Open(uint sample_bits, uint sample_rate, uint channels) = 0; 00033 virtual bool IsOpen(void) = 0; 00034 virtual void Close(void) = 0; 00035 00036 virtual bool Start(void) = 0; 00037 virtual bool Stop(void) = 0; 00038 00039 virtual int GetBlockSize(void) = 0; 00040 virtual int GetSamples(void *buf, uint nbytes) = 0; 00041 virtual int GetNumReadyBytes(void) = 0; 00042 00043 // Factory function 00044 static AudioInput *CreateDevice(const QByteArray &device); 00045 00046 protected: 00047 AudioInput(const QString &device); 00048 00049 QByteArray m_audio_device; 00050 int m_audio_channels; 00051 int m_audio_sample_bits; 00052 int m_audio_sample_rate; 00053 }; 00054 #endif /* _AUDIOINPUT_H_ */
1.6.3