Find
C
ase-sensitive
R
egexp search
Path
mozilla-central
/
third_party
/
rust
/
alsa
/
src
/
direct
Navigation
Enable keyboard shortcuts
Name
Description
Size
asound_ioctl.rs
automatically generated by rust-bindgen
201437
ffi.rs
RO: state - SNDRV_PCM_STATE_XXXX
2340
pcm.rs
! This module bypasses alsa-lib and directly read and write into memory mapped kernel memory. In case of the sample memory, this is in many cases the DMA buffers that is transferred to the sound card. The reasons for doing this are: Minimum overhead where it matters most: let alsa-lib do the code heavy setup - then steal its file descriptor and deal with sample streaming from Rust. RT-safety to the maximum extent possible. Creating/dropping any of these structs causes syscalls, but function calls on these are just read and write from memory. No syscalls, no memory allocations, not even loops (with the exception of `MmapPlayback::write` that loops over samples to write). Possibility to allow Send + Sync for structs It's a fun experiment and an interesting deep dive into how alsa-lib does things. Note: Not all sound card drivers support this direct method of communication; although almost all modern/common ones do. It only works with hardware devices though (such as "hw:xxx" device strings), don't expect it to work with, e g, the PulseAudio plugin or so. For an example of how to use this mode, look in the "synth-example" directory.
22588