Fix handling of stereo audio within audiodelays
when freq_shift=True
#9876
+48
−75
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 @jepler for interest.
This has been an issue that I've been aware of since the inclusion of
audiodelays
in 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_output
as 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.Echo
withdelay_ms <= 0 || delay_ms > max_delay_ms
whereecho_buffer_length
would 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_length
duringrecalculate_delay
and limiting it to the acceptable range.Because each
freq_shift
mode handles the buffer differently now, I've added it so that the fullecho_buffer
and 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_ms
values, and the frequency shifting works with full channel separation.Fixes #9874.