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 should be no smaller "
00050           "than miles-audio-expand-mp3-threshold.  Files that are smaller "
00051           "than this number of bytes will be preloaded and kept "
00052           "resident in memory, while files that are this size or larger "
00053           "will be streamed from disk.  Set this to -1 to preload "
00054           "every file."));
00055 
00056 ConfigVariableBool miles_audio_panda_threads
00057 ("miles-audio-panda-threads", true,
00058  PRC_DESC("Set this true to service Miles background audio via Panda's "
00059           "threading interface, instead of Miles' built-in threading "
00060           "interface.  This gives Panda more control over the threading, "
00061           "and ensures better lock protection within Panda.  This has "
00062           "no meaning unless Panda is compiled with thread support."));
00063 
00064 ////////////////////////////////////////////////////////////////////
00065 //     Function: init_libMilesAudio
00066 //  Description: Initializes the library.  This must be called at
00067 //               least once before any of the functions or classes in
00068 //               this library can be used.  Normally it will be
00069 //               called by the static initializers and need not be
00070 //               called explicitly, but special cases exist.
00071 ////////////////////////////////////////////////////////////////////
00072 void
00073 init_libMilesAudio() {
00074   static bool initialized = false;
00075   if (initialized) {
00076     return;
00077   }
00078   initialized = true;
00079   MilesAudioManager::init_type();
00080   MilesAudioSound::init_type();
00081   MilesAudioSample::init_type();
00082   MilesAudioSequence::init_type();
00083   MilesAudioStream::init_type();
00084 
00085   PandaSystem *ps = PandaSystem::get_global_ptr();
00086   ps->add_system("Miles");
00087   ps->add_system("audio");
00088   ps->set_system_tag("audio", "implementation", "Miles");
00089 }
00090 
00091 ////////////////////////////////////////////////////////////////////
00092 //     Function: get_audio_manager_func_miles_audio
00093 //  Description: This function is called when the dynamic library is
00094 //               loaded; it should return the Create_AudioManager
00095 //               function appropriate to create a MilesAudioManager.
00096 ///////////////////////////////////////////////////////////////////
00097 Create_AudioManager_proc *
00098 get_audio_manager_func_miles_audio() {
00099   init_libMilesAudio();
00100   return &Create_MilesAudioManager;
00101 }
00102 
00103 #endif //]
 All Classes Functions Variables Enumerations