Panda3D
 All Classes Functions Variables Enumerations
config_openalAudio.cxx
1 // Filename: config_openalAudio.cxx
2 // Created by: cort
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 
17 #include "config_openalAudio.h"
18 #include "openalAudioManager.h"
19 #include "openalAudioSound.h"
20 #include "pandaSystem.h"
21 #include "dconfig.h"
22 
23 ConfigureDef(config_openalAudio);
24 NotifyCategoryDef(openalAudio, ":audio");
25 
26 ConfigureFn(config_openalAudio) {
27  init_libOpenALAudio();
28 }
29 
30 ConfigVariableString openal_device
31 ("openal-device", "",
32  PRC_DESC("Specify the OpenAL device string for audio playback (no quotes). If this "
33  "is not specified, the OpenAL default device is used."));
34 
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: init_libOpenALAudio
38 // Description: Initializes the library. This must be called at
39 // least once before any of the functions or classes in
40 // this library can be used. Normally it will be
41 // called by the static initializers and need not be
42 // called explicitly, but special cases exist.
43 ////////////////////////////////////////////////////////////////////
44 void
45 init_libOpenALAudio() {
46  static bool initialized = false;
47  if (initialized) {
48  return;
49  }
50 
51  initialized = true;
52  OpenALAudioManager::init_type();
53  OpenALAudioSound::init_type();
54 
56  ps->add_system("OpenAL");
57  ps->add_system("audio");
58  ps->set_system_tag("audio", "implementation", "OpenAL");
59 }
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: get_audio_manager_func_openal_audio
63 // Description: This function is called when the dynamic library is
64 // loaded; it should return the Create_AudioManager
65 // function appropriate to create an OpenALAudioManager.
66 ///////////////////////////////////////////////////////////////////
67 Create_AudioManager_proc *
68 get_audio_manager_func_openal_audio() {
69  init_libOpenALAudio();
70  return &Create_OpenALAudioManager;
71 }
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
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 a string 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.