36 audio_debug(
"create_NullAudioManager()");
41Create_AudioManager_proc *AudioManager::_create_AudioManager =
nullptr;
44register_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);
184set_speaker_setup(SpeakerModeCategory cat) {
217void 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) {
224void 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) {
231void AudioManager::audio_3d_set_distance_factor(PN_stdfloat factor) {
238PN_stdfloat AudioManager::audio_3d_get_distance_factor()
const {
246void AudioManager::audio_3d_set_doppler_factor(PN_stdfloat factor) {
253PN_stdfloat AudioManager::audio_3d_get_doppler_factor()
const {
261void AudioManager::audio_3d_set_drop_off_factor(PN_stdfloat factor) {
268PN_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);
299 pathname =
Filename(Filename::from_os_specific(sysdir),
Filename(
"drivers/gm.dls"));
306 return Filename(
"/System/Library/Components/CoreAudio.component/Contents/Resources/gs_instruments.dls");
317output(std::ostream &out)
const {
325write(std::ostream &out)
const {
326 out << (*this) <<
"\n";
333set_speaker_configuration(LVecBase3 *speaker1, LVecBase3 *speaker2, LVecBase3 *speaker3, LVecBase3 *speaker4, LVecBase3 *speaker5, LVecBase3 *speaker6, LVecBase3 *speaker7, LVecBase3 *speaker8, LVecBase3 *speaker9) {
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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.
get_dls_pathname
Returns the full pathname to the DLS file, as specified by the Config.prc file, or the default for th...
virtual void shutdown()
Call this at exit time to shut down the audio system.
virtual bool configure_filters(FilterProperties *config)
Configures the global DSP filter chain.
virtual void update()
Must be called every frame.
The name of a file, such as a texture file or an Egg file.
std::string to_os_specific() const
Converts the filename from our generic Unix-like convention (forward slashes starting with the root a...
bool make_true_case()
On a case-insensitive operating system (e.g.
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,...
Stores a configuration for a set of audio DSP filters.
const ConfigVector & get_config()
Intended for use by AudioManager and AudioSound implementations: allows access to the config vector.
void ref() const
Explicitly increments the reference count.
TypeHandle is the identifier used to differentiate C++ class types.
A hierarchy of directories and files that appears to be one continuous file system,...
bool resolve_filename(Filename &filename, const DSearchPath &searchpath, const std::string &default_extension=std::string()) const
Searches the given search path for the filename.
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.