mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 14:12:51 +00:00
Fix AudioStreamRandomizer.random_volume_offset_db not working
This commit is contained in:
parent
37ee293be8
commit
34eba41aea
@ -810,7 +810,11 @@ void AudioStreamPlaybackRandomizer::tag_used_streams() {
|
|||||||
|
|
||||||
int AudioStreamPlaybackRandomizer::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
|
int AudioStreamPlaybackRandomizer::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
|
||||||
if (playing.is_valid()) {
|
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 {
|
} else {
|
||||||
for (int i = 0; i < p_frames; i++) {
|
for (int i = 0; i < p_frames; i++) {
|
||||||
p_buffer[i] = AudioFrame(0, 0);
|
p_buffer[i] = AudioFrame(0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user