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

FXALContext.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                  OpenAL Context adapter class                                 *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2002 by Sander Jansen.   All Rights Reserved.                   *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 ********************************************************************************/
00022 #ifdef HAVE_LIBOPENAL
00023 #ifndef FXALCONTEXT_H
00024 #define FXALCONTEXT_H
00025 
00026 #ifndef FXID_H
00027 #include <fox/FXId.h>
00028 using namespace FX;
00029 #endif
00030 namespace FXEX {
00031 class FXALDevice;
00032 
00033 /**
00034  * FXALContext is an OpenAL audio context wrapper class.
00035  * An OpenAL audio context is similar to the FXDC abstract drawable class in FOX. It provides
00036  * an interface to the real hardware, in a manner which is device independant.
00037  */
00038 class FXAPI FXALContext : public FXId {
00039   FXDECLARE(FXALContext)
00040 
00041   private:
00042     void *ctx;
00043     FXint frs[3];
00044 
00045   protected:
00046     FXALContext() {}
00047 
00048   protected:
00049     FXALDevice  *pDevice;
00050 
00051   public:
00052     /// create an OpenAL context
00053     FXALContext(FXApp *a,FXALDevice *pDevice,FXint f=-1,FXint r=-1,FXint s=-1);
00054 
00055     /// create resources
00056     virtual void create();
00057 
00058     /// destroy resources
00059     virtual void destroy();
00060 
00061     /// make the context the current
00062     FXbool makeCurrent();
00063 
00064     /// make the context the _NOT_ the current
00065     FXbool makeNonCurrent();
00066 
00067     /// suspend the audio context
00068     void suspend();
00069 
00070     /// process the audio
00071     void process();
00072 
00073     /// dtor
00074     virtual ~FXALContext();
00075   };
00076 
00077 } // namespace FXEX
00078 #endif // FXALCONTEXT_H
00079 #endif