36 audio_debug(
"create_NullAudioManager()");
41 Create_AudioManager_proc *AudioManager::_create_AudioManager =
nullptr;
44 register_AudioManager_creator(Create_AudioManager_proc* proc) {
45 nassertv(_create_AudioManager ==
nullptr || _create_AudioManager == proc);
46 _create_AudioManager = proc;
51 audio_debug(
"create_AudioManager()\n audio_library_name=\""<<audio_library_name<<
"\"");
53 if (_create_AudioManager !=
nullptr) {
57 if (!am->is_exact_type(NullAudioManager::get_class_type()) && !am->is_valid()) {
58 audio_error(
" " << am->get_type() <<
" is not valid, will use NullAudioManager");
59 am = create_NullAudioManager();
64 static bool lib_load =
false;
67 if (!audio_library_name.empty() && audio_library_name !=
"null") {
68 Filename dl_name = Filename::dso_filename(
69 "lib" +
string(audio_library_name) +
".so");
71 audio_debug(
" dl_name=\""<<dl_name<<
"\"");
72 void *handle = load_dso(get_plugin_path().get_value(), dl_name);
73 if (handle ==
nullptr) {
74 audio_error(
" load_dso(" << dl_name <<
") failed, will use NullAudioManager");
75 audio_error(
" "<<load_dso_error());
76 nassertr(_create_AudioManager ==
nullptr,
nullptr);
80 string lib_name = audio_library_name;
81 if (lib_name.substr(0, 2) ==
"p3") {
82 lib_name = lib_name.substr(2);
84 string symbol_name =
"get_audio_manager_func_" + lib_name;
85 void *dso_symbol = get_dso_symbol(handle, symbol_name);
86 if (audio_cat.is_debug()) {
88 <<
"symbol of " << symbol_name <<
" = " << dso_symbol <<
"\n";
91 if (dso_symbol ==
nullptr) {
95 audio_error(
" Audio library did not provide get_audio_manager_func, will use NullAudioManager");
97 typedef Create_AudioManager_proc *FuncType();
98 Create_AudioManager_proc *factory_func = (*(FuncType *)dso_symbol)();
101 if (_create_AudioManager ==
nullptr) {
102 AudioManager::register_AudioManager_creator(factory_func);
109 if (_create_AudioManager ==
nullptr) {
110 _create_AudioManager = create_NullAudioManager;
114 if (!am->is_exact_type(NullAudioManager::get_class_type()) && !am->is_valid()) {
115 audio_error(
" " << am->get_type() <<
" is not valid, will use NullAudioManager");
116 am = create_NullAudioManager();
126 if (_null_sound !=
nullptr) {
136 _null_sound =
nullptr;
156 if (_null_sound ==
nullptr) {
160 if (result !=
nullptr) {
162 nassertr(_null_sound != new_sound,
nullptr);
165 nassertr(_null_sound !=
nullptr,
nullptr);
175 get_speaker_setup() {
184 set_speaker_setup(SpeakerModeCategory cat) {
217 void AudioManager::audio_3d_set_listener_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz, PN_stdfloat fx, PN_stdfloat fy, PN_stdfloat fz, PN_stdfloat ux, PN_stdfloat uy, PN_stdfloat uz) {
224 void AudioManager::audio_3d_get_listener_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz, PN_stdfloat *fx, PN_stdfloat *fy, PN_stdfloat *fz, PN_stdfloat *ux, PN_stdfloat *uy, PN_stdfloat *uz) {
231 void AudioManager::audio_3d_set_distance_factor(PN_stdfloat factor) {
238 PN_stdfloat AudioManager::audio_3d_get_distance_factor()
const {
246 void AudioManager::audio_3d_set_doppler_factor(PN_stdfloat factor) {
253 PN_stdfloat AudioManager::audio_3d_get_doppler_factor()
const {
261 void AudioManager::audio_3d_set_drop_off_factor(PN_stdfloat factor) {
268 PN_stdfloat AudioManager::audio_3d_get_drop_off_factor()
const {
280 Filename dls_filename = audio_dls_file;
281 if (!dls_filename.empty()) {
292 string os_filename = WindowsRegistry::get_string_value(
"SOFTWARE\\Microsoft\\DirectMusic",
"GMFilePath",
"");
294 if (!os_filename.empty()) {
297 char sysdir[MAX_PATH+1];
298 GetSystemDirectory(sysdir,MAX_PATH+1);
304 #elif defined(IS_OSX) 306 return Filename(
"/System/Library/Components/CoreAudio.component/Contents/Resources/gs_instruments.dls");
317 output(std::ostream &out)
const {
325 write(std::ostream &out)
const {
326 out << (*this) <<
"\n";
333 set_speaker_configuration(LVecBase3 *speaker1, LVecBase3 *speaker2, LVecBase3 *speaker3, LVecBase3 *speaker4, LVecBase3 *speaker5, LVecBase3 *speaker6, LVecBase3 *speaker7, LVecBase3 *speaker8, LVecBase3 *speaker9) {
virtual bool configure_filters(FilterProperties *config)
Configures the global DSP filter chain.
A hierarchy of directories and files that appears to be one continuous file system,...
PT(AudioSound) AudioManager
Returns a special NullAudioSound object that has all the interface of a normal sound object,...
Stores a configuration for a set of audio DSP filters.
bool make_true_case()
On a case-insensitive operating system (e.g.
bool resolve_filename(Filename &filename, const DSearchPath &searchpath, const std::string &default_extension=std::string()) const
Searches the given search path for the filename.
const ConfigVector & get_config()
Intended for use by AudioManager and AudioSound implementations: allows access to the config vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void update()
Must be called every frame.
The name of a file, such as a texture file or an Egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void ref() const
Explicitly increments the reference count.
virtual void shutdown()
Call this at exit time to shut down the audio system.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
std::string to_os_specific() const
Converts the filename from our generic Unix-like convention (forward slashes starting with the root a...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void unref_delete(RefCountType *ptr)
This global helper function will unref the given ReferenceCount object, and if the reference count re...
virtual void set_speaker_configuration(LVecBase3 *speaker1, LVecBase3 *speaker2=nullptr, LVecBase3 *speaker3=nullptr, LVecBase3 *speaker4=nullptr, LVecBase3 *speaker5=nullptr, LVecBase3 *speaker6=nullptr, LVecBase3 *speaker7=nullptr, LVecBase3 *speaker8=nullptr, LVecBase3 *speaker9=nullptr)
For use only with Miles.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static Pointer compare_and_exchange_ptr(Pointer &mem, Pointer old_value, Pointer new_value)
Atomic compare and exchange.
static Filename from_os_specific(const std::string &os_specific, Type type=T_general)
This named constructor returns a Panda-style filename (that is, using forward slashes,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.