Panda3D
config_openalAudio.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_openalAudio.cxx
10  * @author cort
11  */
12 
13 #include "pandabase.h"
14 
15 #include "config_openalAudio.h"
16 #include "openalAudioManager.h"
17 #include "openalAudioSound.h"
18 #include "pandaSystem.h"
19 #include "dconfig.h"
20 
21 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_OPENAL_AUDIO)
22  #error Buildsystem error: BUILDING_OPENAL_AUDIO not defined
23 #endif
24 
25 ConfigureDef(config_openalAudio);
26 NotifyCategoryDef(openalAudio, ":audio");
27 
28 ConfigureFn(config_openalAudio) {
30 }
31 
32 ConfigVariableString openal_device
33 ("openal-device", "",
34  PRC_DESC("Specify the OpenAL device string for audio playback (no quotes). If this "
35  "is not specified, the OpenAL default device is used."));
36 
37 ConfigVariableInt openal_buffer_delete_retries
38 ("openal-buffer-delete-retries", 5,
39  PRC_DESC("If deleting a buffer fails due to still being in use, the OpenAL "
40  "sound plugin will wait a moment and retry deletion, with an "
41  "exponentially-increasing delay for each try. This number "
42  "specifies how many repeat tries (not counting the initial try) "
43  "should be made before giving up and raising an error."));
44 
45 ConfigVariableDouble openal_buffer_delete_delay
46 ("openal-buffer-delete-delay", 0.001,
47  PRC_DESC("If deleting a buffer fails due to still being in use, the OpenAL "
48  "sound plugin will wait a moment and retry deletion, with an "
49  "exponentially-increasing delay for each try. This number "
50  "specifies how long, in seconds, the OpenAL plugin will wait after "
51  "its first failed try. The second try will be double this "
52  "delay, the third quadruple, and so on."));
53 
54 
55 /**
56  * Initializes the library. This must be called at least once before any of
57  * the functions or classes in this library can be used. Normally it will be
58  * called by the static initializers and need not be called explicitly, but
59  * special cases exist.
60  */
61 void
63  static bool initialized = false;
64  if (initialized) {
65  return;
66  }
67 
68  initialized = true;
69  OpenALAudioManager::init_type();
70  OpenALAudioSound::init_type();
71 
72  AudioManager::register_AudioManager_creator(&Create_OpenALAudioManager);
73 
75  ps->add_system("OpenAL");
76  ps->add_system("audio");
77  ps->set_system_tag("audio", "implementation", "OpenAL");
78 }
79 
80 /**
81  * This function is called when the dynamic library is loaded; it should
82  * return the Create_AudioManager function appropriate to create an
83  * OpenALAudioManager.
84  */
85 Create_AudioManager_proc *
89 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
AudioManager * Create_OpenALAudioManager()
Factory Function.
This class is used as a namespace to group several global properties of Panda.
Definition: pandaSystem.h:26
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a convenience class to specialize ConfigVariable as a floating- point type.
This is a convenience class to specialize ConfigVariable as a string type.
void init_libOpenALAudio()
Initializes the library.
void add_system(const std::string &system)
Intended for use by each subsystem to register itself at startup.
Create_AudioManager_proc * get_audio_manager_func_openal_audio()
This function is called when the dynamic library is loaded; it should return the Create_AudioManager ...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a convenience class to specialize ConfigVariable as an integer type.