diff --git a/doc/classes/AudioEffectStereoEnhance.xml b/doc/classes/AudioEffectStereoEnhance.xml index f009bec5bba9..0f7cccc5f9fe 100644 --- a/doc/classes/AudioEffectStereoEnhance.xml +++ b/doc/classes/AudioEffectStereoEnhance.xml @@ -11,11 +11,13 @@ - Values greater than 1.0 increase intensity of any panning on audio passing through this effect, whereas values less than 1.0 will decrease the panning intensity. A value of 0.0 will downmix audio to mono. - - + Amplifies the difference between stereo channels, increasing or descreasing existing panning. A value of 0.0 will downmix stereo to mono. Does not affect a mono signal. + Widens sound stage trough phase shifting in cunjuncion with [surround]. Just delays the right channel if [surround] is 0. + + + Widens sound stage trough phase shifting in cunjuncion with [time_pullout_ms]. Just pans sound to the left channel if [time_pullout_ms] is 0. diff --git a/servers/audio/effects/audio_effect_stereo_enhance.cpp b/servers/audio/effects/audio_effect_stereo_enhance.cpp index e0ea97f90fbe..e5448c86b5cd 100644 --- a/servers/audio/effects/audio_effect_stereo_enhance.cpp +++ b/servers/audio/effects/audio_effect_stereo_enhance.cpp @@ -39,34 +39,34 @@ void AudioEffectStereoEnhanceInstance::process(const AudioFrame *p_src_frames, A unsigned int delay_frames = (base->time_pullout / 1000.0) * AudioServer::get_singleton()->get_mix_rate(); for (int i = 0; i < p_frame_count; i++) { - float l = p_src_frames[i].left; - float r = p_src_frames[i].right; + float left = p_src_frames[i].left; + float right = p_src_frames[i].right; - float center = (l + r) / 2.0f; + float center = (left + right) / 2.0f; - l = (center + (l - center) * intensity); - r = (center + (r - center) * intensity); + left = (center + (left - center) * intensity); + right = (center + (right - center) * intensity); if (surround_mode) { - float val = (l + r) / 2.0; + float val = (left + right) / 2.0; delay_ringbuff[ringbuff_pos & ringbuff_mask] = val; float out = delay_ringbuff[(ringbuff_pos - delay_frames) & ringbuff_mask] * surround_amount; - l += out; - r += -out; + left += out; + right += -out; } else { - float val = r; + float val = right; delay_ringbuff[ringbuff_pos & ringbuff_mask] = val; - //r is delayed - r = delay_ringbuff[(ringbuff_pos - delay_frames) & ringbuff_mask]; + //right channel is delayed + right = delay_ringbuff[(ringbuff_pos - delay_frames) & ringbuff_mask]; } - p_dst_frames[i].left = l; - p_dst_frames[i].right = r; + p_dst_frames[i].left = left; + p_dst_frames[i].right = right; ringbuff_pos++; } }