Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StereoEnhancer code style enhancements #98457

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions servers/audio/effects/audio_effect_stereo_enhance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
betalars marked this conversation as resolved.
Show resolved Hide resolved
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++;
}
}
Expand Down
Loading