Merge pull request #43316 from YeldhamDev/rate_scale_wav_fix

Fix WAV resources ignoring the AudioServer's 'global_rate_scale' value
This commit is contained in:
Rémi Verschelde 2020-11-16 15:52:48 +01:00 committed by GitHub
commit d105c718fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -261,7 +261,8 @@ void AudioStreamPlaybackSample::mix(AudioFrame *p_buffer, float p_rate_scale, in
sign = -1;
}
float base_rate = AudioServer::get_singleton()->get_mix_rate();
float global_rate_scale = AudioServer::get_singleton()->get_global_rate_scale();
float base_rate = AudioServer::get_singleton()->get_mix_rate() * global_rate_scale;
float srate = base->mix_rate;
srate *= p_rate_scale;
float fincrement = srate / base_rate;