summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-08-14 09:38:41 +0200
committerGitHub <noreply@github.com>2018-08-14 09:38:41 +0200
commit0386054b4c3a26d2eead443650b50d7a2faaefaf (patch)
tree1b513fb1ebf8edb429f959141ab461bdfc2fa85d
parent98da0df8946414c57586c026527070debb4abb69 (diff)
parent14fa84373507590b6a2623ac00b8d85104cce421 (diff)
Merge pull request #20986 from marcelofg55/audio_dummy
Add Dummy AudioDriver into the AudioDriverManager list
-rw-r--r--servers/audio_server.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 14318f282b..f3934e5c01 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -143,14 +143,19 @@ AudioDriver::AudioDriver() {
#endif
}
-AudioDriver *AudioDriverManager::drivers[MAX_DRIVERS];
-int AudioDriverManager::driver_count = 0;
AudioDriverDummy AudioDriverManager::dummy_driver;
+AudioDriver *AudioDriverManager::drivers[MAX_DRIVERS] = {
+ &AudioDriverManager::dummy_driver,
+};
+int AudioDriverManager::driver_count = 1;
void AudioDriverManager::add_driver(AudioDriver *p_driver) {
ERR_FAIL_COND(driver_count >= MAX_DRIVERS);
- drivers[driver_count++] = p_driver;
+ drivers[driver_count - 1] = p_driver;
+
+ // Last driver is always our dummy driver
+ drivers[driver_count++] = &AudioDriverManager::dummy_driver;
}
int AudioDriverManager::get_driver_count() {
@@ -183,14 +188,6 @@ void AudioDriverManager::initialize(int p_driver) {
return;
}
}
-
- // Fallback to our dummy driver
- if (dummy_driver.init() == OK) {
- ERR_PRINT("AudioDriverManager: all drivers failed, falling back to dummy driver");
- dummy_driver.set_singleton();
- } else {
- ERR_PRINT("AudioDriverManager: dummy driver failed to init()");
- }
}
AudioDriver *AudioDriverManager::get_driver(int p_driver) {