Panda3D

config_fmodAudio.cxx

00001 // Filename: config_fmodAudio.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_FMODEX //[
00017 
00018 #include "config_fmodAudio.h"
00019 #include "audioManager.h"
00020 #include "fmodAudioManager.h"
00021 #include "fmodAudioSound.h"
00022 #include "pandaSystem.h"
00023 #include "dconfig.h"
00024 
00025 ConfigureDef(config_fmodAudio);
00026 NotifyCategoryDef(fmodAudio, ":audio");
00027 
00028 ConfigureFn(config_fmodAudio) {
00029   init_libFmodAudio();
00030 }
00031 
00032 ConfigVariableInt fmod_audio_preload_threshold
00033 ("fmod-audio-preload-threshold", 1048576,
00034  PRC_DESC("Files that are smaller "
00035           "than this number of bytes will be preloaded and kept "
00036           "resident in memory, while files that are this size or larger "
00037           "will be streamed from disk.  Set this to -1 to preload "
00038           "every file."));
00039 
00040 ////////////////////////////////////////////////////////////////////
00041 //     Function: init_libFmodAudio
00042 //  Description: Initializes the library.  This must be called at
00043 //               least once before any of the functions or classes in
00044 //               this library can be used.  Normally it will be
00045 //               called by the static initializers and need not be
00046 //               called explicitly, but special cases exist.
00047 ////////////////////////////////////////////////////////////////////
00048 void
00049 init_libFmodAudio() {
00050   static bool initialized = false;
00051   if (initialized) {
00052     return;
00053   }
00054 
00055   initialized = true;
00056   FmodAudioManager::init_type();
00057   FmodAudioSound::init_type();
00058 
00059   PandaSystem *ps = PandaSystem::get_global_ptr();
00060   ps->add_system("FMOD");
00061   ps->add_system("audio");
00062   ps->set_system_tag("audio", "implementation", "FMOD");
00063 }
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 //     Function: get_audio_manager_func_fmod_audio
00067 //  Description: This function is called when the dynamic library is
00068 //               loaded; it should return the Create_AudioManager
00069 //               function appropriate to create a FmodAudioManager.
00070 ///////////////////////////////////////////////////////////////////
00071 Create_AudioManager_proc *
00072 get_audio_manager_func_fmod_audio() {
00073   init_libFmodAudio();
00074   return &Create_FmodAudioManager;
00075 }
00076 
00077 #endif //]
 All Classes Functions Variables Enumerations