diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-09-17 22:48:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-17 22:48:22 +0200 |
commit | 53bbc046ee670a1c24b1ec936066857ef6e73dc9 (patch) | |
tree | 912835b1b1872785c0ffadda66d8996f5e7f9823 /platform | |
parent | a00f19a92109ec33de41308e6277b55eb444320d (diff) | |
parent | 7a4c0ff35e10fba5f2686e7fd5623eab31b07a2d (diff) |
Merge pull request #11252 from marcelofg55/fix_noaudio_crash
Fix crash when no audio driver is available
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/os_android.cpp | 7 | ||||
-rw-r--r-- | platform/haiku/os_haiku.cpp | 6 | ||||
-rw-r--r-- | platform/javascript/os_javascript.cpp | 6 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 7 | ||||
-rw-r--r-- | platform/server/os_server.cpp | 8 | ||||
-rw-r--r-- | platform/server/os_server.h | 2 | ||||
-rw-r--r-- | platform/uwp/os_uwp.cpp | 7 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 7 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 33 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 7 |
10 files changed, 8 insertions, 82 deletions
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 1de2608b9e..dbea2d7531 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -137,12 +137,7 @@ void OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int visual_server->init(); // visual_server->cursor_set_visible(false, 0); - AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); - - if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) { - - ERR_PRINT("Initializing audio failed."); - } + AudioDriverManager::initialize(p_audio_driver); physics_server = memnew(PhysicsServerSW); physics_server->init(); diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp index de2f79a0ac..9f2f88bb4e 100644 --- a/platform/haiku/os_haiku.cpp +++ b/platform/haiku/os_haiku.cpp @@ -137,11 +137,7 @@ void OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_ //physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>(); physics_2d_server->init(); - AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); - - if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) { - ERR_PRINT("Initializing audio failed."); - } + AudioDriverManager::initialize(p_audio_driver); power_manager = memnew(PowerHaiku); } diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 543d028576..67d2a6e369 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -464,11 +464,7 @@ void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, i print_line("Init Audio"); AudioDriverManager::add_driver(&audio_driver_javascript); - audio_driver_javascript.set_singleton(); - if (audio_driver_javascript.init() != OK) { - - ERR_PRINT("Initializing audio failed."); - } + AudioDriverManager::initialize(p_audio_driver); RasterizerGLES3::register_config(); RasterizerGLES3::make_current(); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 5a23d76755..111cdb0cf1 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1088,12 +1088,7 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au visual_server->init(); // visual_server->cursor_set_visible(false, 0); - AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); - - if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) { - - ERR_PRINT("Initializing audio failed."); - } + AudioDriverManager::initialize(p_audio_driver); // physics_server = memnew(PhysicsServerSW); diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index e2bb464e76..300c5cffcc 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -62,12 +62,7 @@ void OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int p //visual_server = memnew( VisualServerRaster(rasterizer) ); - AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); - - if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) { - - ERR_PRINT("Initializing audio failed."); - } + AudioDriverManager::initialize(p_audio_driver); sample_manager = memnew(SampleManagerMallocSW); audio_server = memnew(AudioServerSW(sample_manager)); @@ -232,7 +227,6 @@ void OS_Server::run() { OS_Server::OS_Server() { - AudioDriverManager::add_driver(&driver_dummy); //adriver here grab = false; }; diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 8c0ca1a58d..ba12f649be 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -34,7 +34,6 @@ #include "drivers/rtaudio/audio_driver_rtaudio.h" #include "drivers/unix/os_unix.h" #include "main/input_default.h" -#include "servers/audio/audio_driver_dummy.h" #include "servers/audio_server.h" #include "servers/physics_2d/physics_2d_server_sw.h" #include "servers/physics_server.h" @@ -55,7 +54,6 @@ class OS_Server : public OS_Unix { List<String> args; MainLoop *main_loop; - AudioDriverDummy driver_dummy; bool grab; PhysicsServer *physics_server; diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index fd8904fa0a..b909ccccd6 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -268,12 +268,7 @@ void OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_aud joypad = ref new JoypadUWP(input); joypad->register_events(); - AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); - - if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) { - - ERR_PRINT("Initializing audio failed."); - } + AudioDriverManager::initialize(p_audio_driver); power_manager = memnew(PowerUWP); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 62954e1a56..461caf479c 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1081,12 +1081,7 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int power_manager = memnew(PowerWindows); - AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); - - if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) { - - ERR_PRINT("Initializing audio failed."); - } + AudioDriverManager::initialize(p_audio_driver); TRACKMOUSEEVENT tme; tme.cbSize = sizeof(TRACKMOUSEEVENT); diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 4e78e0318c..3e8709a11e 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -313,29 +313,7 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au XFree(xsh); } - AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); - - audio_driver_index = p_audio_driver; - if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) { - - bool success = false; - audio_driver_index = -1; - for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) { - if (i == p_audio_driver) - continue; - AudioDriverManager::get_driver(i)->set_singleton(); - if (AudioDriverManager::get_driver(i)->init() == OK) { - success = true; - print_line("Audio Driver Failed: " + String(AudioDriverManager::get_driver(p_audio_driver)->get_name())); - print_line("Using alternate audio driver: " + String(AudioDriverManager::get_driver(i)->get_name())); - audio_driver_index = i; - break; - } - } - if (!success) { - ERR_PRINT("Initializing audio failed."); - } - } + AudioDriverManager::initialize(p_audio_driver); ERR_FAIL_COND(!visual_server); ERR_FAIL_COND(x11_window == 0); @@ -2189,10 +2167,6 @@ bool OS_X11::is_disable_crash_handler() const { OS_X11::OS_X11() { -#ifdef RTAUDIO_ENABLED - AudioDriverManager::add_driver(&driver_rtaudio); -#endif - #ifdef PULSEAUDIO_ENABLED AudioDriverManager::add_driver(&driver_pulseaudio); #endif @@ -2201,11 +2175,6 @@ OS_X11::OS_X11() { AudioDriverManager::add_driver(&driver_alsa); #endif - if (AudioDriverManager::get_driver_count() == 0) { - WARN_PRINT("No sound driver found... Defaulting to dummy driver"); - AudioDriverManager::add_driver(&driver_dummy); - } - minimized = false; xim_style = 0L; mouse_mode = MOUSE_MODE_VISIBLE; diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 2ba7f07cef..0e2430c650 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -38,11 +38,9 @@ //#include "servers/visual/visual_server_wrap_mt.h" #include "drivers/alsa/audio_driver_alsa.h" #include "drivers/pulseaudio/audio_driver_pulseaudio.h" -#include "drivers/rtaudio/audio_driver_rtaudio.h" #include "joypad_linux.h" #include "main/input_default.h" #include "power_x11.h" -#include "servers/audio/audio_driver_dummy.h" #include "servers/audio_server.h" #include "servers/physics_2d/physics_2d_server_sw.h" #include "servers/physics_2d/physics_2d_server_wrap_mt.h" @@ -154,10 +152,6 @@ class OS_X11 : public OS_Unix { JoypadLinux *joypad; #endif -#ifdef RTAUDIO_ENABLED - AudioDriverRtAudio driver_rtaudio; -#endif - #ifdef ALSA_ENABLED AudioDriverALSA driver_alsa; #endif @@ -165,7 +159,6 @@ class OS_X11 : public OS_Unix { #ifdef PULSEAUDIO_ENABLED AudioDriverPulseAudio driver_pulseaudio; #endif - AudioDriverDummy driver_dummy; Atom net_wm_icon; |