summaryrefslogtreecommitdiff
path: root/servers/audio
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-01 13:53:04 +0200
committerGitHub <noreply@github.com>2019-07-01 13:53:04 +0200
commit380bf04566f21d9da9c8894f9ea8c03001daae0f (patch)
tree6f2a4b9102f9b2a4e37f6ec3fbdec6562e2ad830 /servers/audio
parent771aa9a779ab9d8effde70f8338a476e53c8e6d3 (diff)
parent1c2ba35074b226d93f3b6c71cc3b94e7fc6e2e4e (diff)
Merge pull request #29413 from YeldhamDev/global_rate_scale
Add 'global_rate_scale' to the AudioServer
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/audio_stream.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index 388346b67c..17f5e158a7 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -49,8 +49,9 @@ void AudioStreamPlaybackResampled::_begin_resample() {
void AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
float target_rate = AudioServer::get_singleton()->get_mix_rate();
+ float global_rate_scale = AudioServer::get_singleton()->get_global_rate_scale();
- uint64_t mix_increment = uint64_t(((get_stream_sampling_rate() * p_rate_scale) / double(target_rate)) * double(FP_LEN));
+ uint64_t mix_increment = uint64_t(((get_stream_sampling_rate() * p_rate_scale) / double(target_rate * global_rate_scale)) * double(FP_LEN));
for (int i = 0; i < p_frames; i++) {