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

AudioA2.hh

Go to the documentation of this file.
00001 /*
00002 
00003     ALSA audio I/O
00004     Copyright (C) 2000-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 #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             /* - Internal stuff - */
00056             snd_pcm_t *GetPcmHandle ()
00057                 {
00058                     return sndpcmPcm;
00059                 }
00060             /* - Card specifics - */
00066             bool CardOpen (int);
00070             void CardClose ();
00077             const char *CardGetName (int);
00084             const char *CardGetLongName (int);
00090             int CardGetChannelCount ();
00091             /* - Device specifics - */
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

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