Panda3D

config_openalAudio.cxx

00001 // Filename: config_openalAudio.cxx
00002 // Created by:  cort
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "pandabase.h"
00016 #ifdef HAVE_OPENAL //[
00017 
00018 
00019 #include "config_openalAudio.h"
00020 #include "openalAudioManager.h"
00021 #include "openalAudioSound.h"
00022 #include "pandaSystem.h"
00023 #include "dconfig.h"
00024 
00025 ConfigureDef(config_openalAudio);
00026 NotifyCategoryDef(openalAudio, ":audio");
00027 
00028 ConfigureFn(config_openalAudio) {
00029   init_libOpenALAudio();
00030 }
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //     Function: init_libOpenALAudio
00034 //  Description: Initializes the library.  This must be called at
00035 //               least once before any of the functions or classes in
00036 //               this library can be used.  Normally it will be
00037 //               called by the static initializers and need not be
00038 //               called explicitly, but special cases exist.
00039 ////////////////////////////////////////////////////////////////////
00040 void
00041 init_libOpenALAudio() {
00042   static bool initialized = false;
00043   if (initialized) {
00044     return;
00045   }
00046   
00047   initialized = true;
00048   OpenALAudioManager::init_type();
00049   OpenALAudioSound::init_type();
00050 
00051   PandaSystem *ps = PandaSystem::get_global_ptr();
00052   ps->add_system("OpenAL");
00053   ps->add_system("audio");
00054   ps->set_system_tag("audio", "implementation", "OpenAL");
00055 }
00056 
00057 ////////////////////////////////////////////////////////////////////
00058 //     Function: get_audio_manager_func_openal_audio
00059 //  Description: This function is called when the dynamic library is
00060 //               loaded; it should return the Create_AudioManager
00061 //               function appropriate to create an OpenALAudioManager.
00062 ///////////////////////////////////////////////////////////////////
00063 Create_AudioManager_proc *
00064 get_audio_manager_func_openal_audio() {
00065   init_libOpenALAudio();
00066   return &Create_OpenALAudioManager;
00067 }
00068 
00069 #endif //]
 All Classes Functions Variables Enumerations