feat(alsa): duplex stream support - #1347
Merged
Merged
Conversation
Opens capture and playback from the same pcm_id and drives both from one worker thread. Links them via snd_pcm_link() where possible; virtual PCMs (default, pulse, asym) don't support that, so linking failure is tolerated and both handles are started and polled independently instead.
roderickvd
force-pushed
the
feat/alsa-duplex
branch
from
September 7, 2026 19:49
c52ce36 to
dfe0aa4
Compare
This was referenced Sep 7, 2026
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.
This PR adds native duplex support for ALSA. It works well on my laptop, which isn't a whole lot of testing, but at least it's something.
Capture and playback open on the same
pcm_idand negotiate matching period sizes. Where the driver and hardware support it,snd_pcm_link()ties the two together so they also start/pause/stop/recover together. When they don't (e.g. anasymPCM spanning two cards), it proceeds unlinked instead of refusing the stream - they could be slaved to an external clock without cpal ever knowing.src/host/alsa/mod.rswas getting really large so as a separate commit that was split into submodules.