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

Audio.hh

Go to the documentation of this file.
00001 /*
00002 
00003     Class for OSS audio IO operations
00004     Copyright (c) 1998-2002 Jussi Laako
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 */
00021 
00022 
00023 #ifndef USE_OSSLITE
00024 #include "sys/soundcard.h"
00025 #else
00026 #include <sys/soundcard.h>
00027 #endif
00028 
00029 
00030 #ifndef AUDIO_HH
00031     #define AUDIO_HH
00032 
00033     #ifndef BUF_SIZE
00034         #define BUF_SIZE        4096
00035     #endif
00036 
00037 
00038     enum
00039     {
00040         AUDIO_READ = 0,
00041         AUDIO_WRITE = 1,
00042         AUDIO_DUPLEX = 2
00043     };
00044 
00045 
00049     class clAudio
00050     {
00051             int iDevH;
00052             int iErrorCode;
00053         public:
00054             clAudio ();
00055             clAudio (const char *, int *, int *, int *, int);
00056             ~clAudio ();
00069             bool Open (const char *, int *, int *, int *, int);
00073             void Close ();
00082             bool SetParams (int *, int *, int *);
00089             bool SetFormat (int *);
00096             bool SetChannels (int *);
00103             bool SetSampleRate (int *);
00111             int Read (void *, int);
00119             int Write (const void *, int);
00125             bool Sync ();
00132             bool Reset ();
00138             bool Post ();
00144             int GetFragmentSize ();
00148             bool SubDivide (int *);
00155             bool SetFragment (int, int);
00161             int GetFormats ();
00168             bool GetInBufInfo (audio_buf_info *);
00175             bool GetOutBufInfo (audio_buf_info *);
00182             bool GetInBufStat (count_info *);
00189             bool GetOutBufStat (count_info *);
00195             int GetCaps ();
00201             bool SetDuplex ();
00207             bool SetNonBlock ();
00213             bool SetSynchronous ();
00219             int GetTrigger ();
00226             bool SetTrigger (int);
00233             bool MapInBuffer (buffmem_desc *);
00240             bool MapOutBuffer (buffmem_desc *);
00246             int GetOutDelay ();
00247             #ifndef USE_OSSLITE
00248 
00256             bool GetErrorInfo (audio_errinfo *);
00257             #endif
00258 
00263             int GetVersion ();
00267             void DeIntStereo (const signed short *, signed short *, 
00268                 signed short *, unsigned int);
00270             void DeIntStereo (const unsigned char *, unsigned char *, 
00271                 unsigned char *, unsigned int);
00273             void IntStereo (signed short *, const signed short *,
00274                 const signed short *, unsigned int);
00276             void IntStereo (unsigned char *, const unsigned char *,
00277                 const unsigned char *, unsigned int);
00283             int GetHandle() { return iDevH; }
00289             int GetError() { return iErrorCode; }
00291             int GetErrno() { return iErrorCode; }
00292    };
00293    
00294 
00295 #endif
00296 

Generated on Sun Oct 26 19:11:18 2003 for HASAS by doxygen 1.3.3