diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-12-14 08:57:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-14 08:57:22 +0100 |
commit | 4148eed9437d8d01afc3cfa69279f2c3d9dc48c6 (patch) | |
tree | fbcc68815d9cbbd8e3c0355630a16cb009459c24 /servers | |
parent | 7e4e9e95e4fb654f99721b093e6ed15d0bacc0d0 (diff) | |
parent | 7d387dc63f75da867a1b9e07cd957b456de99c12 (diff) |
Merge pull request #24324 from volzhs/access-mic
Request mic access only when is needed
Diffstat (limited to 'servers')
-rw-r--r-- | servers/audio/audio_stream.cpp | 7 | ||||
-rw-r--r-- | servers/audio_server.cpp | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 02a0bed964..21073a1cd1 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -30,6 +30,7 @@ #include "audio_stream.h" #include "core/os/os.h" +#include "core/project_settings.h" ////////////////////////////// @@ -184,6 +185,12 @@ float AudioStreamPlaybackMicrophone::get_stream_sampling_rate() { } void AudioStreamPlaybackMicrophone::start(float p_from_pos) { + + if (!GLOBAL_GET("audio/enable_audio_input")) { + WARN_PRINTS("Need to enable Project settings > Audio > Enable Audio Input option to use capturing."); + return; + } + input_ofs = 0; AudioDriver::get_singleton()->capture_start(); diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 0cead5b2ba..0073f9e149 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -172,6 +172,7 @@ int AudioDriverManager::get_driver_count() { } void AudioDriverManager::initialize(int p_driver) { + GLOBAL_DEF_RST("audio/enable_audio_input", false); int failed_driver = -1; // Check if there is a selected driver |