diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-07-01 13:53:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 13:53:04 +0200 |
commit | 380bf04566f21d9da9c8894f9ea8c03001daae0f (patch) | |
tree | 6f2a4b9102f9b2a4e37f6ec3fbdec6562e2ad830 /servers/audio | |
parent | 771aa9a779ab9d8effde70f8338a476e53c8e6d3 (diff) | |
parent | 1c2ba35074b226d93f3b6c71cc3b94e7fc6e2e4e (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.cpp | 3 |
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++) { |