Panda3D
config_fmodAudio.cxx
1 // Filename: config_fmodAudio.cxx
2 // Created by: cort
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "pandabase.h"
16 
17 #include "config_fmodAudio.h"
18 #include "audioManager.h"
19 #include "fmodAudioManager.h"
20 #include "fmodAudioSound.h"
21 #include "pandaSystem.h"
22 #include "dconfig.h"
23 
24 ConfigureDef(config_fmodAudio);
25 NotifyCategoryDef(fmodAudio, ":audio");
26 
27 ConfigureFn(config_fmodAudio) {
28  init_libFmodAudio();
29 }
30 
31 ConfigVariableInt fmod_audio_preload_threshold
32 ("fmod-audio-preload-threshold", 1048576,
33  PRC_DESC("Files that are smaller "
34  "than this number of bytes will be preloaded and kept "
35  "resident in memory, while files that are this size or larger "
36  "will be streamed from disk. Set this to -1 to preload "
37  "every file."));
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: init_libFmodAudio
41 // Description: Initializes the library. This must be called at
42 // least once before any of the functions or classes in
43 // this library can be used. Normally it will be
44 // called by the static initializers and need not be
45 // called explicitly, but special cases exist.
46 ////////////////////////////////////////////////////////////////////
47 void
48 init_libFmodAudio() {
49  static bool initialized = false;
50  if (initialized) {
51  return;
52  }
53 
54  initialized = true;
55  FmodAudioManager::init_type();
56  FmodAudioSound::init_type();
57 
59  ps->add_system("FMOD");
60  ps->add_system("audio");
61  ps->set_system_tag("audio", "implementation", "FMOD");
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: get_audio_manager_func_fmod_audio
66 // Description: This function is called when the dynamic library is
67 // loaded; it should return the Create_AudioManager
68 // function appropriate to create a FmodAudioManager.
69 ///////////////////////////////////////////////////////////////////
70 Create_AudioManager_proc *
71 get_audio_manager_func_fmod_audio() {
72  init_libFmodAudio();
73  return &Create_FmodAudioManager;
74 }
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
This class is used as a namespace to group several global properties of Panda.
Definition: pandaSystem.h:29
void add_system(const string &system)
Intended for use by each subsystem to register itself at startup.
This is a convenience class to specialize ConfigVariable as an integer type.
void set_system_tag(const string &system, const string &tag, const string &value)
Intended for use by each subsystem to register its set of capabilities at startup.