00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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