00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef USE_ALSA09
00024
00025
00026 #include <sys/types.h>
00027 #include <alsa/asoundlib.h>
00028
00029
00030 #ifndef AUDIOA_HH
00031 #define AUDIOA_HH
00032
00033 #define AA_MODE_PLAY SND_PCM_STREAM_PLAYBACK
00034 #define AA_MODE_RECORD SND_PCM_STREAM_CAPTURE
00035
00036
00040 class clAudioA2
00041 {
00042 unsigned int uiActRate;
00043 unsigned int uiActBufSize;
00044 unsigned int uiActFragSize;
00045 unsigned int uiActFragCount;
00046 size_t uiFrameSize;
00047 snd_output_t *sndoutErr;
00048 snd_pcm_t *sndpcmPcm;
00049 snd_pcm_info_t *sndpcmInfo;
00050 snd_pcm_hw_params_t *sndpcmHwParams;
00051 snd_pcm_sw_params_t *sndpcmSwParams;
00052 public:
00053 clAudioA2 ();
00054 ~clAudioA2 ();
00055
00056 snd_pcm_t *GetPcmHandle ()
00057 {
00058 return sndpcmPcm;
00059 }
00060
00066 bool CardOpen (int);
00070 void CardClose ();
00077 const char *CardGetName (int);
00084 const char *CardGetLongName (int);
00090 int CardGetChannelCount ();
00091
00099 bool PcmOpen (const char *, snd_pcm_stream_t eMode);
00103 void PcmClose ();
00114 bool PcmSetSetup (int, int, int, int, int);
00120 int PcmGetChannels ();
00126 int PcmGetSampleRate ();
00132 int PcmGetBits ();
00138 int PcmGetBufferSize ();
00144 int PcmGetFragmentSize ();
00150 int PcmGetFragmentCount ();
00156 int PcmGetStatus ();
00162 const char *PcmGetStatusStr (int);
00168 const char *PcmGetName ();
00174 bool PcmLink (clAudioA2 &);
00180 bool PcmUnlink ();
00186 bool PcmPrepare ();
00192 bool PcmStart ();
00198 bool PcmReset ();
00204 bool PcmDrain ();
00212 int PcmRead (void *, int);
00220 int PcmWrite (const void *, int);
00221 };
00222
00223 #endif
00224
00225 #endif // USE_ALSA09