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

SoundFactory.h

Go to the documentation of this file.
00001 /****************** <SNX heading BEGIN do not edit this line> *****************
00002  *
00003  * sonix
00004  *
00005  * Original Authors:
00006  *   Kevin Meinert
00007  *
00008  * -----------------------------------------------------------------
00009  * File:          $RCSfile: SoundFactory.h,v $
00010  * Date modified: $Date: 2003/11/30 04:54:05 $
00011  * Version:       $Revision: 1.29 $
00012  * -----------------------------------------------------------------
00013  *
00014  ****************** <SNX heading END do not edit this line> ******************/
00015 
00016 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00017  *
00018  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00019  *
00020  * Original Authors:
00021  *   Allen Bierbaum, Christopher Just,
00022  *   Patrick Hartling, Kevin Meinert,
00023  *   Carolina Cruz-Neira, Albert Baker
00024  *
00025  * This library is free software; you can redistribute it and/or
00026  * modify it under the terms of the GNU Library General Public
00027  * License as published by the Free Software Foundation; either
00028  * version 2 of the License, or (at your option) any later version.
00029  *
00030  * This library is distributed in the hope that it will be useful,
00031  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00032  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00033  * Library General Public License for more details.
00034  *
00035  * You should have received a copy of the GNU Library General Public
00036  * License along with this library; if not, write to the
00037  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00038  * Boston, MA 02111-1307, USA.
00039  *
00040  *************** <auto-copyright.pl END do not edit this line> ***************/
00041 
00042 /* Generated by Together */
00043 
00044 #ifndef SNXSOUNDFACTORY_H
00045 #define SNXSOUNDFACTORY_H
00046 
00047 #include <snx/snxConfig.h>
00048 
00049 #include <string>
00050 #include <vpr/Util/Singleton.h>
00051 #include <vpr/DynLoad/Library.h>
00052 #include <vpr/DynLoad/LibraryFinder.h>
00053 
00054 #include <vpr/DynLoad/Library.h>
00055 #include "snx/ISoundImplementation.h"
00056 
00057 namespace snx
00058 {
00059 
00060 class SNX_CLASS_API SoundFactory
00061 {
00062 public:
00063    void errorOutput(vpr::LibraryPtr lib, const char* test);
00064 
00065    bool isPlugin(vpr::LibraryPtr lib);
00066 
00067    void loadPlugins(vpr::LibraryFinder::LibraryList libs);
00068 
00069    void unloadPlugins();
00070 
00077    void createImplementation( const std::string& apiName,
00078                               snx::ISoundImplementation* &mImplementation );
00079 
00080    // pass valid pointer to a sound implementation with a name it's refered to
00081    // or... pass NULL to unregister/delete apiName...
00082    void reg(const std::string& apiName, snx::ISoundImplementation* impl);
00083 
00084    std::map< std::string, snx::ISoundImplementation* > mRegisteredImplementations;
00085    std::vector<vpr::LibraryPtr> mPlugins;
00086 
00087 private:
00088    SoundFactory();
00089 
00091    /*#  snx::ISoundImplementation lnkSoundImplementation; */
00092 
00094    /*#  snx::StubSoundImplementation lnksnx::StubSoundImplementation; */
00095 
00097    /*#  snx::AudioWorksSoundImplementation lnksnx::AudioWorksSoundImplementation; */
00098 
00100    /*#  snx::OpenALSoundImplementation lnksnx::OpenALSoundImplementation; */
00101 
00106    /*#  snx::ISoundImplementation lnkSoundImplementation1; */
00107 
00108    vprSingletonHeader(SoundFactory);
00109 };
00110 
00111 template <class _type>
00112 class SoundFactoryReg
00113 {
00114 public:
00115    _type mSoundAPI;
00116    std::string mNameOfAPI;
00117    SoundFactoryReg( const std::string& apiName ) : mSoundAPI(), mNameOfAPI( apiName )
00118    {
00119       mSoundAPI.setName( mNameOfAPI );
00120       snx::SoundFactory::instance()->reg( mNameOfAPI, &mSoundAPI );
00121    }
00122    virtual ~SoundFactoryReg()
00123    {
00124       mSoundAPI.setName( "unavailable/deleted/nomore" );
00125       snx::SoundFactory::instance()->reg( mNameOfAPI, NULL );
00126    }
00127 };
00128 
00129 } // end namespace
00130 
00131 
00132 #endif //SNXSOUNDFACTORY_H

Generated on Sun May 2 14:39:26 2004 for Juggler Sonix by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002