summaryrefslogtreecommitdiff
path: root/servers/audio/audio_stream.cpp
diff options
context:
space:
mode:
authorMrBlockers <1747505+MrBlockers@users.noreply.github.com>2022-10-26 17:54:31 -0400
committerMrBlockers <1747505+MrBlockers@users.noreply.github.com>2022-12-20 18:48:02 -0500
commit569ead5762cbd8cec1e615e564a62d1fac1aec1d (patch)
treecfa5631a28d306371cc9f22cfbee06255f14ae63 /servers/audio/audio_stream.cpp
parent2a04b18d37de6c6e621db5a9dfd1cd0da5ccb015 (diff)
Add optional arguments to AudioStreamRandomizer
Adds stream and weight parameters to add_stream. By default, weight is 1.0f.
Diffstat (limited to 'servers/audio/audio_stream.cpp')
-rw-r--r--servers/audio/audio_stream.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index 113e728106..84c21f7cd6 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -410,12 +410,12 @@ AudioStreamPlaybackMicrophone::AudioStreamPlaybackMicrophone() {
////////////////////////////////
-void AudioStreamRandomizer::add_stream(int p_index) {
+void AudioStreamRandomizer::add_stream(int p_index, Ref<AudioStream> p_stream, float p_weight) {
if (p_index < 0) {
p_index = audio_stream_pool.size();
}
ERR_FAIL_COND(p_index > audio_stream_pool.size());
- PoolEntry entry{ nullptr, 1.0f };
+ PoolEntry entry{ p_stream, p_weight };
audio_stream_pool.insert(p_index, entry);
emit_signal(SNAME("changed"));
notify_property_list_changed();
@@ -709,7 +709,7 @@ void AudioStreamRandomizer::_get_property_list(List<PropertyInfo> *p_list) const
}
void AudioStreamRandomizer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("add_stream", "index"), &AudioStreamRandomizer::add_stream);
+ ClassDB::bind_method(D_METHOD("add_stream", "index", "stream", "weight"), &AudioStreamRandomizer::add_stream, DEFVAL(1.0));
ClassDB::bind_method(D_METHOD("move_stream", "index_from", "index_to"), &AudioStreamRandomizer::move_stream);
ClassDB::bind_method(D_METHOD("remove_stream", "index"), &AudioStreamRandomizer::remove_stream);