Panda3D

config_milesAudio.cxx

00001 // Filename: config_milesAudio.cxx
00002 // Created by:  skyler
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_RAD_MSS //[
00017 
00018 #include "config_milesAudio.h"
00019 #include "milesAudioManager.h"
00020 #include "milesAudioSound.h"
00021 #include "milesAudioSample.h"
00022 #include "milesAudioSequence.h"
00023 #include "milesAudioStream.h"
00024 #include "pandaSystem.h"
00025 #include "dconfig.h"
00026 
00027 ConfigureDef(config_milesAudio);
00028 NotifyCategoryDef(milesAudio, ":audio");
00029 
00030 ConfigureFn(config_milesAudio) {
00031   init_libMilesAudio();
00032 }
00033 
00034 ConfigVariableBool miles_audio_force_midi_reset
00035 ("audio-force-midi-reset", true);
00036 
00037 ConfigVariableInt miles_audio_expand_mp3_threshold
00038 ("miles-audio-expand-mp3-threshold", 16384,
00039  PRC_DESC("This enables a Miles workaround in which small MP3 files are "
00040           "expanded in-memory at load time into WAV format, which can "
00041           "work around problems with Miles being unable to correctly "
00042           "report the length of, or seek within, a variable bit-rate encoded "
00043           "MP3 file.  Any MP3 file whose length in bytes is less than "
00044           "this value will be expanded.  This only applies to files "
00045           "within the miles-audio-preload-threshold."));
00046 
00047 ConfigVariableInt miles_audio_preload_threshold
00048 ("miles-audio-preload-threshold", -1,
00049  PRC_DESC("This is the last Miles fallback size, and should be no smaller "
00050           "than both miles-audio-expand-mp3-threshold and "
00051           "miles-audio-calc-mp3-threshold.  Files that are smaller "
00052           "than this number of bytes will be preloaded and kept "
00053           "resident in memory, while files that are this size or larger "
00054           "will be streamed from disk.  Set this to -1 to preload "
00055           "every file."));
00056 
00057 ConfigVariableBool miles_audio_panda_threads
00058 ("miles-audio-panda-threads", true,
00059  PRC_DESC("Set this true to service Miles background audio via Panda's "
00060           "threading interface, instead of Miles' built-in threading "
00061           "interface.  This gives Panda more control over the threading, "
00062           "and ensures better lock protection within Panda.  This has "
00063           "no meaning unless Panda is compiled with thread support."));
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 //     Function: init_libMilesAudio
00067 //  Description: Initializes the library.  This must be called at
00068 //               least once before any of the functions or classes in
00069 //               this library can be used.  Normally it will be
00070 //               called by the static initializers and need not be
00071 //               called explicitly, but special cases exist.
00072 ////////////////////////////////////////////////////////////////////
00073 void
00074 init_libMilesAudio() {
00075   static bool initialized = false;
00076   if (initialized) {
00077     return;
00078   }
00079   initialized = true;
00080   MilesAudioManager::init_type();
00081   MilesAudioSound::init_type();
00082   MilesAudioSample::init_type();
00083   MilesAudioSequence::init_type();
00084   MilesAudioStream::init_type();
00085 
00086   PandaSystem *ps = PandaSystem::get_global_ptr();
00087   ps->add_system("Miles");
00088   ps->add_system("audio");
00089   ps->set_system_tag("audio", "implementation", "Miles");
00090 }
00091 
00092 ////////////////////////////////////////////////////////////////////
00093 //     Function: get_audio_manager_func_miles_audio
00094 //  Description: This function is called when the dynamic library is
00095 //               loaded; it should return the Create_AudioManager
00096 //               function appropriate to create a MilesAudioManager.
00097 ///////////////////////////////////////////////////////////////////
00098 Create_AudioManager_proc *
00099 get_audio_manager_func_miles_audio() {
00100   init_libMilesAudio();
00101   return &Create_MilesAudioManager;
00102 }
00103 
00104 #endif //]
 All Classes Functions Variables Enumerations