Skip to content

Commit

Permalink
Merge pull request #94514 from adamscott/fix-new-stream-types-playing
Browse files Browse the repository at this point in the history
Fix new stream types `mix()` not returning 0 when inactive
  • Loading branch information
akien-mga committed Jul 22, 2024
2 parents eb6c914 + b22783b commit f640ba6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
5 changes: 1 addition & 4 deletions modules/interactive_music/audio_stream_interactive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions modules/interactive_music/audio_stream_playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
7 changes: 2 additions & 5 deletions modules/interactive_music/audio_stream_synchronized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f640ba6

Please sign in to comment.