Panda3D
config_milesAudio.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file config_milesAudio.cxx
10  * @author skyler
11  */
12 
13 #include "pandabase.h"
14 #ifdef HAVE_RAD_MSS //[
15 
16 #include "config_milesAudio.h"
17 #include "milesAudioManager.h"
18 #include "milesAudioSound.h"
19 #include "milesAudioSample.h"
20 #include "milesAudioSequence.h"
21 #include "milesAudioStream.h"
22 #include "pandaSystem.h"
23 #include "dconfig.h"
24 
25 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_MILES_AUDIO)
26  #error Buildsystem error: BUILDING_MILES_AUDIO not defined
27 #endif
28 
29 ConfigureDef(config_milesAudio);
30 NotifyCategoryDef(milesAudio, ":audio");
31 
32 ConfigureFn(config_milesAudio) {
33  init_libMilesAudio();
34 }
35 
36 ConfigVariableBool miles_audio_force_midi_reset
37 ("audio-force-midi-reset", true);
38 
39 ConfigVariableInt miles_audio_expand_mp3_threshold
40 ("miles-audio-expand-mp3-threshold", 16384,
41  PRC_DESC("This enables a Miles workaround in which small MP3 files are "
42  "expanded in-memory at load time into WAV format, which can "
43  "work around problems with Miles being unable to correctly "
44  "report the length of, or seek within, a variable bit-rate encoded "
45  "MP3 file. Any MP3 file whose length in bytes is less than "
46  "this value will be expanded. This only applies to files "
47  "within the miles-audio-preload-threshold."));
48 
49 ConfigVariableInt miles_audio_preload_threshold
50 ("miles-audio-preload-threshold", -1,
51  PRC_DESC("This should be no smaller "
52  "than miles-audio-expand-mp3-threshold. Files that are smaller "
53  "than this number of bytes will be preloaded and kept "
54  "resident in memory, while files that are this size or larger "
55  "will be streamed from disk. Set this to -1 to preload "
56  "every file."));
57 
58 ConfigVariableBool miles_audio_panda_threads
59 ("miles-audio-panda-threads", true,
60  PRC_DESC("Set this true to service Miles background audio via Panda's "
61  "threading interface, instead of Miles' built-in threading "
62  "interface. This gives Panda more control over the threading, "
63  "and ensures better lock protection within Panda. This has "
64  "no meaning unless Panda is compiled with thread support."));
65 
66 /**
67  * Initializes the library. This must be called at least once before any of
68  * the functions or classes in this library can be used. Normally it will be
69  * called by the static initializers and need not be called explicitly, but
70  * 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  * This function is called when the dynamic library is loaded; it should
93  * return the Create_AudioManager function appropriate to create a
94  * MilesAudioManager.
95  */
96 Create_AudioManager_proc *
97 get_audio_manager_func_miles_audio() {
98  init_libMilesAudio();
99  return &Create_MilesAudioManager;
100 }
101 
102 #endif //]
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:26
This is a convenience class to specialize ConfigVariable as a boolean type.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void add_system(const std::string &system)
Intended for use by each subsystem to register itself at startup.
void set_system_tag(const std::string &system, const std::string &tag, const std::string &value)
Intended for use by each subsystem to register its set of capabilities at startup.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a convenience class to specialize ConfigVariable as an integer type.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.