Panda3D
 All Classes Functions Variables Enumerations
config_milesAudio.cxx
1 // Filename: config_milesAudio.cxx
2 // Created by: skyler
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 #ifdef HAVE_RAD_MSS //[
17 
18 #include "config_milesAudio.h"
19 #include "milesAudioManager.h"
20 #include "milesAudioSound.h"
21 #include "milesAudioSample.h"
22 #include "milesAudioSequence.h"
23 #include "milesAudioStream.h"
24 #include "pandaSystem.h"
25 #include "dconfig.h"
26 
27 ConfigureDef(config_milesAudio);
28 NotifyCategoryDef(milesAudio, ":audio");
29 
30 ConfigureFn(config_milesAudio) {
31  init_libMilesAudio();
32 }
33 
34 ConfigVariableBool miles_audio_force_midi_reset
35 ("audio-force-midi-reset", true);
36 
37 ConfigVariableInt miles_audio_expand_mp3_threshold
38 ("miles-audio-expand-mp3-threshold", 16384,
39  PRC_DESC("This enables a Miles workaround in which small MP3 files are "
40  "expanded in-memory at load time into WAV format, which can "
41  "work around problems with Miles being unable to correctly "
42  "report the length of, or seek within, a variable bit-rate encoded "
43  "MP3 file. Any MP3 file whose length in bytes is less than "
44  "this value will be expanded. This only applies to files "
45  "within the miles-audio-preload-threshold."));
46 
47 ConfigVariableInt miles_audio_preload_threshold
48 ("miles-audio-preload-threshold", -1,
49  PRC_DESC("This should be no smaller "
50  "than miles-audio-expand-mp3-threshold. Files that are smaller "
51  "than this number of bytes will be preloaded and kept "
52  "resident in memory, while files that are this size or larger "
53  "will be streamed from disk. Set this to -1 to preload "
54  "every file."));
55 
56 ConfigVariableBool miles_audio_panda_threads
57 ("miles-audio-panda-threads", true,
58  PRC_DESC("Set this true to service Miles background audio via Panda's "
59  "threading interface, instead of Miles' built-in threading "
60  "interface. This gives Panda more control over the threading, "
61  "and ensures better lock protection within Panda. This has "
62  "no meaning unless Panda is compiled with thread support."));
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: init_libMilesAudio
66 // Description: Initializes the library. This must be called at
67 // least once before any of the functions or classes in
68 // this library can be used. Normally it will be
69 // called by the static initializers and need not be
70 // called explicitly, but special cases exist.
71 ////////////////////////////////////////////////////////////////////
72 void
73 init_libMilesAudio() {
74  static bool initialized = false;
75  if (initialized) {
76  return;
77  }
78  initialized = true;
79  MilesAudioManager::init_type();
80  MilesAudioSound::init_type();
81  MilesAudioSample::init_type();
82  MilesAudioSequence::init_type();
83  MilesAudioStream::init_type();
84 
86  ps->add_system("Miles");
87  ps->add_system("audio");
88  ps->set_system_tag("audio", "implementation", "Miles");
89 }
90 
91 ////////////////////////////////////////////////////////////////////
92 // Function: get_audio_manager_func_miles_audio
93 // Description: This function is called when the dynamic library is
94 // loaded; it should return the Create_AudioManager
95 // function appropriate to create a MilesAudioManager.
96 ///////////////////////////////////////////////////////////////////
97 Create_AudioManager_proc *
98 get_audio_manager_func_miles_audio() {
99  init_libMilesAudio();
100  return &Create_MilesAudioManager;
101 }
102 
103 #endif //]
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
This is a convenience class to specialize ConfigVariable as a boolean type.
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.