summaryrefslogtreecommitdiffstats
path: root/modules/interactive_music
diff options
context:
space:
mode:
authorAdam Scott <ascott.ca@gmail.com>2024-07-18 11:14:33 -0400
committerAdam Scott <ascott.ca@gmail.com>2024-07-18 11:18:38 -0400
commitb22783b9b378f1fcc7eead0d9340deeebec08c3a (patch)
tree94c0fb8d94ef7d9bd821896dfc4f6c2aeaaf9d22 /modules/interactive_music
parentff8a2780ee777c2456ce42368e1065774c7c4c3f (diff)
downloadredot-engine-b22783b9b378f1fcc7eead0d9340deeebec08c3a.tar.gz
Fix new stream types `mix()` not returning 0 when inactive
Diffstat (limited to 'modules/interactive_music')
-rw-r--r--modules/interactive_music/audio_stream_interactive.cpp5
-rw-r--r--modules/interactive_music/audio_stream_playlist.cpp5
-rw-r--r--modules/interactive_music/audio_stream_synchronized.cpp7
3 files changed, 4 insertions, 13 deletions
diff --git a/modules/interactive_music/audio_stream_interactive.cpp b/modules/interactive_music/audio_stream_interactive.cpp
index d7762295eb..8472c4e352 100644
--- a/modules/interactive_music/audio_stream_interactive.cpp
+++ b/modules/interactive_music/audio_stream_interactive.cpp
@@ -858,10 +858,7 @@ int AudioStreamPlaybackInteractive::mix(AudioFrame *p_buffer, float p_rate_scale
}
if (!active) {
- for (int i = 0; i < p_frames; i++) {
- p_buffer[i] = AudioFrame(0.0, 0.0);
- }
- return p_frames;
+ return 0;
}
int todo = p_frames;
diff --git a/modules/interactive_music/audio_stream_playlist.cpp b/modules/interactive_music/audio_stream_playlist.cpp
index f47035b30c..eb77a4a8d3 100644
--- a/modules/interactive_music/audio_stream_playlist.cpp
+++ b/modules/interactive_music/audio_stream_playlist.cpp
@@ -259,10 +259,7 @@ void AudioStreamPlaybackPlaylist::seek(double p_time) {
int AudioStreamPlaybackPlaylist::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
if (!active) {
- for (int i = 0; i < p_frames; i++) {
- p_buffer[i] = AudioFrame(0.0, 0.0);
- }
- return p_frames;
+ return 0;
}
double time_dec = (1.0 / AudioServer::get_singleton()->get_mix_rate());
diff --git a/modules/interactive_music/audio_stream_synchronized.cpp b/modules/interactive_music/audio_stream_synchronized.cpp
index d0d58fac16..e38a57ba75 100644
--- a/modules/interactive_music/audio_stream_synchronized.cpp
+++ b/modules/interactive_music/audio_stream_synchronized.cpp
@@ -204,11 +204,8 @@ void AudioStreamPlaybackSynchronized::seek(double p_time) {
}
int AudioStreamPlaybackSynchronized::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
- if (active != true) {
- for (int i = 0; i < p_frames; i++) {
- p_buffer[i] = AudioFrame(0.0, 0.0);
- }
- return p_frames;
+ if (!active) {
+ return 0;
}
int todo = p_frames;