diff options
author | Michael Alexsander <michaelalexsander@protonmail.com> | 2020-05-07 13:46:33 -0300 |
---|---|---|
committer | Michael Alexsander <michaelalexsander@protonmail.com> | 2021-08-07 12:32:42 -0300 |
commit | 4bef90039989c585086ba232fc58119dccf333ee (patch) | |
tree | 355fdd75071d5370d32be99e953a2129ac2f8b07 /scene | |
parent | 3177da1d053a6132668e12a8d8af82366f5c4ac9 (diff) |
Invert how `global_rate_scale` value works, and rename it to `playback_speed_scale`
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/audio_stream_sample.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 8ffd2df112..ef070589e4 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -261,11 +261,11 @@ void AudioStreamPlaybackSample::mix(AudioFrame *p_buffer, float p_rate_scale, in sign = -1; } - float global_rate_scale = AudioServer::get_singleton()->get_global_rate_scale(); - float base_rate = AudioServer::get_singleton()->get_mix_rate() * global_rate_scale; + float base_rate = AudioServer::get_singleton()->get_mix_rate(); float srate = base->mix_rate; srate *= p_rate_scale; - float fincrement = srate / base_rate; + float playback_speed_scale = AudioServer::get_singleton()->get_playback_speed_scale(); + float fincrement = (srate * playback_speed_scale) / base_rate; int32_t increment = int32_t(MAX(fincrement * MIX_FRAC_LEN, 1)); increment *= sign; |