fix audiospeed.SpeedChanger direct playback, fixes #11020#11022
Merged
Conversation
Fix by setting "single_buffer = false". When single_buffer = true, the DMA driver sets up a hardware loop that resets the read address back to buffer[0] at full DMA speed, never calling get_buffer again. This caused SpeedChanger to replay its first 128-frame output buffer indefinitely when connected directly to audioio/audiobusio. Setting single_buffer = false enables the double-buffering path w/ DMA interrupts, which keeps calling get_buffer() so the phase accumulator can advance through the source audio correctly. Using AudioMixer as an intermediary masks the bug since Mixer/mix_down_one_voice() calls get_buffer() on its voices directly, bypassing the single_buffer optimization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix by setting "single_buffer = false".
When single_buffer = true, the DMA driver sets up a hardware loop that resets the read address back to buffer[0] at full DMA speed, never calling get_buffer again. This caused SpeedChanger to replay its first 128-frame output buffer indefinitely when connected directly to audioio/audiobusio.
Setting single_buffer = false enables the double-buffering path w/ DMA interrupts, which keeps calling get_buffer() so the phase accumulator can advance through the source audio correctly.
Using AudioMixer as an intermediary masks the bug since Mixer/mix_down_one_voice() calls get_buffer() on its voices directly, bypassing the single_buffer optimization.