Skip to content

Commit

Permalink
Fix AudioStreamRandomizer.random_volume_offset_db not working
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjtxietian committed Oct 14, 2023
1 parent 37ee293 commit 34eba41
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion servers/audio/audio_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,11 @@ void AudioStreamPlaybackRandomizer::tag_used_streams() {

int AudioStreamPlaybackRandomizer::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
if (playing.is_valid()) {
return playing->mix(p_buffer, p_rate_scale * pitch_scale, p_frames);
int mixed_samples = playing->mix(p_buffer, p_rate_scale * pitch_scale, p_frames);
for (int samp = 0; samp < mixed_samples; samp++) {
p_buffer[samp] *= volume_scale;
}
return mixed_samples;
} else {
for (int i = 0; i < p_frames; i++) {
p_buffer[i] = AudioFrame(0, 0);
Expand Down

0 comments on commit 34eba41

Please sign in to comment.