Fix volume interpolation in positional audio nodes
Fixes #22016
(cherry picked from commit ff1fbd2bc5
)
This commit is contained in:
parent
e1ca49b4b6
commit
219ce2f149
|
@ -87,7 +87,7 @@ void AudioStreamPlayer2D::_mix_audio() {
|
||||||
AudioFrame target_volume = stream_paused_fade_out ? AudioFrame(0.f, 0.f) : current.vol;
|
AudioFrame target_volume = stream_paused_fade_out ? AudioFrame(0.f, 0.f) : current.vol;
|
||||||
AudioFrame vol_prev = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol;
|
AudioFrame vol_prev = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol;
|
||||||
AudioFrame vol_inc = (target_volume - vol_prev) / float(buffer_size);
|
AudioFrame vol_inc = (target_volume - vol_prev) / float(buffer_size);
|
||||||
AudioFrame vol = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : current.vol;
|
AudioFrame vol = vol_prev;
|
||||||
|
|
||||||
int cc = AudioServer::get_singleton()->get_channel_count();
|
int cc = AudioServer::get_singleton()->get_channel_count();
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ void AudioStreamPlayer3D::_mix_audio() {
|
||||||
AudioFrame target_volume = stream_paused_fade_out ? AudioFrame(0.f, 0.f) : current.vol[k];
|
AudioFrame target_volume = stream_paused_fade_out ? AudioFrame(0.f, 0.f) : current.vol[k];
|
||||||
AudioFrame vol_prev = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol[k];
|
AudioFrame vol_prev = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol[k];
|
||||||
AudioFrame vol_inc = (target_volume - vol_prev) / float(buffer_size);
|
AudioFrame vol_inc = (target_volume - vol_prev) / float(buffer_size);
|
||||||
AudioFrame vol = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : current.vol[k];
|
AudioFrame vol = vol_prev;
|
||||||
|
|
||||||
if (!AudioServer::get_singleton()->thread_has_channel_mix_buffer(current.bus_index, k))
|
if (!AudioServer::get_singleton()->thread_has_channel_mix_buffer(current.bus_index, k))
|
||||||
continue; //may have been deleted, will be updated on process
|
continue; //may have been deleted, will be updated on process
|
||||||
|
|
Loading…
Reference in New Issue