diff --git a/panda/src/audio/audioManager.cxx b/panda/src/audio/audioManager.cxx index 991abd187d..00e9c8d3b2 100644 --- a/panda/src/audio/audioManager.cxx +++ b/panda/src/audio/audioManager.cxx @@ -74,7 +74,11 @@ create_AudioManager() { } } } - return (*_create_AudioManager)(); + PT(AudioManager) am = (*_create_AudioManager)(); + if (!am->is_valid()) { + am = create_NullAudioManger(); + } + return am; } diff --git a/panda/src/audiotraits/milesAudioManager.cxx b/panda/src/audiotraits/milesAudioManager.cxx index 13f0cf8450..c5add623c2 100644 --- a/panda/src/audiotraits/milesAudioManager.cxx +++ b/panda/src/audiotraits/milesAudioManager.cxx @@ -30,7 +30,7 @@ int MilesAudioManager::_active_managers; HDLSFILEID MilesAudioManager::_dls_field; PT(AudioManager) Create_AudioManager() { - audio_debug("Create_AudioManger()"); + audio_debug("Create_AudioManger() Miles."); return new MilesAudioManager(); } @@ -38,7 +38,7 @@ PT(AudioManager) Create_AudioManager() { //////////////////////////////////////////////////////////////////// // Function: MilesAudioManager::MilesAudioManager // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// MilesAudioManager:: MilesAudioManager() { @@ -66,8 +66,8 @@ MilesAudioManager() { AIL_MSS_version(version, 8); audio_debug(" Mss32.dll Version: "<first<<"\""); AIL_quick_unload(i->second); @@ -287,7 +287,7 @@ uncache_a_sound() { //////////////////////////////////////////////////////////////////// // Function: MilesAudioManager::most_recently_used // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MilesAudioManager:: most_recently_used(const string& path) { @@ -306,25 +306,25 @@ most_recently_used(const string& path) { //////////////////////////////////////////////////////////////////// // Function: MilesAudioManager::clear_cache // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MilesAudioManager:: clear_cache() { audio_debug("MilesAudioManager::clear_cache()"); - assert(is_valid()); + if (_is_valid) { assert(is_valid()); } SoundMap::iterator i=_sounds.begin(); for (; i!=_sounds.end(); ++i) { AIL_quick_unload(i->second); } _sounds.clear(); _lru.clear(); - assert(is_valid()); + if (_is_valid) { assert(is_valid()); } } //////////////////////////////////////////////////////////////////// // Function: MilesAudioManager::set_cache_limit // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MilesAudioManager:: set_cache_limit(int count) { @@ -341,7 +341,7 @@ set_cache_limit(int count) { //////////////////////////////////////////////////////////////////// // Function: MilesAudioManager::get_cache_limit // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// int MilesAudioManager:: get_cache_limit() { @@ -353,7 +353,7 @@ get_cache_limit() { //////////////////////////////////////////////////////////////////// // Function: MilesAudioManager::release_sound // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MilesAudioManager:: release_sound(MilesAudioSound* audioSound) { @@ -412,7 +412,7 @@ set_active(bool active) { //////////////////////////////////////////////////////////////////// // Function: MilesAudioManager::get_active // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// bool MilesAudioManager:: get_active() { @@ -427,11 +427,11 @@ get_active() { // 'result' from the Windows registry. //////////////////////////////////////////////////////////////////// void MilesAudioManager:: -get_registry_entry(HKEY base, const char* subKeyName, +get_registry_entry(HKEY base, const char* subKeyName, const char* keyName, string& result) { // Create a key to access the registry: HKEY key; - long r=RegCreateKeyEx(base, subKeyName, 0, "", + long r=RegCreateKeyEx(base, subKeyName, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, NULL); if (r==ERROR_SUCCESS) { DWORD len=0; @@ -472,7 +472,7 @@ get_registry_entry(HKEY base, const char* subKeyName, //////////////////////////////////////////////////////////////////// void MilesAudioManager:: get_gm_file_path(string& result) { - get_registry_entry(HKEY_LOCAL_MACHINE, + get_registry_entry(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\DirectMusic", "GMFilePath", result); audio_debug("MilesAudioManager::get_gm_file_path() result out=\""<