MercurySoundDriverALSA.h

Go to the documentation of this file.
00001 #ifndef MERCURYSOUNDDRIVERALSA_H
00002 #define MERCURYSOUNDDRIVERALSA_H
00003 
00004 #include <alsa/asoundlib.h>
00005 #include "MercurySoundSourceWAV.h"
00006 #include "MercurySoundDriver.h"
00007 
00008 class MercurySoundDriverALSA : public MercurySoundDriver
00009 {
00010     public:
00011         MercurySoundDriverALSA();
00012         virtual ~MercurySoundDriverALSA();
00013         
00014         virtual void Init();
00015         
00016         static void ALSACallback(snd_async_handler_t *pcm_callback);
00017         
00018         void Start();
00019         
00020     private:
00021         virtual void WriteSoundFrames();
00022         
00023         virtual void Cleanup();
00024         void SetupSWParams();
00025         void SetupHWParams();
00026         
00027         void Recover(int error);
00028         
00029         snd_pcm_t* m_pcmHandle;
00030 };
00031 
00032 #endif
00033 
00034 /* 
00035  * Copyright (c) 2007 Joshua Allen
00036  * All rights reserved.
00037  *
00038  * Redistribution and use in source and binary forms, with or
00039  * without modification, are permitted provided that the following
00040  * conditions are met:
00041  *  -   Redistributions of source code must retain the above
00042  *      copyright notice, this list of conditions and the following disclaimer.
00043  *  -   Redistributions in binary form must reproduce the above copyright
00044  *      notice, this list of conditions and the following disclaimer in
00045  *      the documentation and/or other materials provided with the distribution.
00046  *  -   Neither the name of the Mercury Engine nor the names of its
00047  *      contributors may be used to endorse or promote products derived from
00048  *      this software without specific prior written permission.
00049  *
00050  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00051  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00052  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00053  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00054  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00055  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00056  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00057  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00058  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00059  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00060  */

Hosted by SourceForge.net Logo