diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-11-13 18:16:33 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-11-13 18:17:19 -0300 |
commit | 65111ba99699a400be1d26ef54ae5580377caabf (patch) | |
tree | 30b7b6ad7594b4850f73222e595fac2d0b1282cc /servers | |
parent | 5613aa489e754db3645dfe1215572b78be7e8bd4 (diff) |
Ability to remove buses while they are being used on 2D and 3D stream players. Fixes #15115
Diffstat (limited to 'servers')
-rw-r--r-- | servers/audio_server.cpp | 8 | ||||
-rw-r--r-- | servers/audio_server.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 33d1e72669..6fd996c3d3 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -460,6 +460,14 @@ void AudioServer::_mix_step() { to_mix = buffer_size; } +bool AudioServer::thread_has_channel_mix_buffer(int p_bus, int p_buffer) const { + if (p_bus < 0 || p_bus >= buses.size()) + return false; + if (p_buffer < 0 || p_buffer >= buses[p_bus]->channels.size()) + return false; + return true; +} + AudioFrame *AudioServer::thread_get_channel_mix_buffer(int p_bus, int p_buffer) { ERR_FAIL_INDEX_V(p_bus, buses.size(), NULL); diff --git a/servers/audio_server.h b/servers/audio_server.h index b12ca6e589..52fa84e3e6 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -282,6 +282,7 @@ public: } //do not use from outside audio thread + bool thread_has_channel_mix_buffer(int p_bus, int p_buffer) const; AudioFrame *thread_get_channel_mix_buffer(int p_bus, int p_buffer); int thread_get_mix_buffer_size() const; int thread_find_bus_index(const StringName &p_name); |