Skip to content

feat(alsa): duplex stream support - #1347

Open
roderickvd wants to merge 5 commits into
masterfrom
feat/alsa-duplex
Open

feat(alsa): duplex stream support#1347
roderickvd wants to merge 5 commits into
masterfrom
feat/alsa-duplex

Conversation

@roderickvd

Copy link
Copy Markdown
Member

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_id and 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. an asym PCM 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.rs was getting really large so as a separate commit that was split into submodules.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant