Fix handling of stereo audio within audiodelays.Delay when freq_shift=True
#10252
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@gamblor21 @dhalbert for interest.
This has been an issue that I've been aware of since the inclusion of
audiodelaysin 9.2.0. Echo buffer positions weren't being properly managed when handling stereo input/output. I've resolved this issue by separating the echo buffer into two halves (left + right) and offsetting the buffer where necessary. I've done my best to supportsingle_channel_outputas well, but I'm not exactly sure how to test that (I2SOut uses left/right pairs).I've also found a minor bug when constructing
audiodelays.Echowithdelay_ms <= 0 || delay_ms > max_delay_mswhereecho_buffer_lengthwould not be set and remain as the default of 0. The effect of this issue wasn't too major, but I've resolved it by always settingecho_buffer_lengthduringrecalculate_delayand limiting it to the acceptable range.Because each
freq_shiftmode handles the buffer differently now, I've added it so that the fullecho_bufferand buffer positions are reset whenever the mode is changed to avoid potential audio abnormalities.The example in #9874 now does not exhibit any issues. I've also tested this code with variable
delay_msvalues, and the frequency shifting works with full channel separation.Fixes #9874.