snd_pcm_set_sync_per_card(9)
π snd_pcm_set_sync_per_card β the Kernel API Manual tea, bestie edition
okay so real talk, we're in the Kernel API Manual today and the star of the show is snd_pcm_set_sync_per_card. yes it's a long name. no we're not scared of it. let's go π«Ά
β¨ NAME β¨
snd_pcm_set_sync_per_card β sets the PCM sync id, and it uses the card number to do it π
πΈ SYNOPSIS πΈ
void snd_pcm_set_sync_per_card (struct snd_pcm_substream *substream ,
struct snd_pcm_hw_params *params , const unsigned char *id , unsigned
int len );
like, that's the whole vibe. void, four args, no notes. slay.
π ARGUMENTS π
substreamβ the pcm substream, literally the thing we're working on π¦paramsβ modified hardware parameters. yes, modified. they get changed, that's the point β¨idβ the identifier, max 12 bytes. twelve. not thirteen. don't push it πlenβ identifier length, also max 12 bytes. same energy π
π₯ DESCRIPTION π₯
So what it does: it sets the PCM sync identifier for the card, with zero padding. that's the whole assignment and it ate π
Now, important part β user space or any user should use this 16-byte identifier for a comparison only, just to check if two IDs are similar or different. comparison only. that's it. no reading into it, no zodiac sign energy, no interpretation π
Special case, and this one's iconic: if the identifier is only zeros, the interpretation for that combination is β empty (not set). periodt. and the contents of the identifier should not be interpreted in any other way. like, at all. fr fr.
The synchronization ID must be unique per clock source β usually that's one sound card, but multiple soundcards may use one PCM word clock source, which means they're fully synchronized. cute little clock family πΈ
This routine composes that ID using the card number in the first four bytes plus a 12-byte additional ID. and here's the warning bestie, listen up: when some other ID composition is used (e.g. for multiple sound cards), make sure that composition does not clash with this composition scheme. no clashing. we don't do clashing π
π SEE ALSO π
Kernel file ./sound/core/pcm_lib.c β and the whole friend group:
snd_pcm_set_ops(9)snd_interval_refine(9)snd_interval_div(9)snd_interval_muldivk(9)snd_interval_mulkdiv(9)snd_interval_ratnum(9)snd_interval_ratden(9)snd_interval_list(9)snd_interval_ranges(9)snd_pcm_hw_rule_add(9)snd_pcm_hw_constraint_mask(9)snd_pcm_hw_constraint_mask64(9)snd_pcm_hw_constraint_integer(9)snd_pcm_hw_constraint_minmax(9)snd_pcm_hw_constraint_list(9)snd_pcm_hw_constraint_ranges(9)snd_pcm_hw_constraint_ratnums(9)snd_pcm_hw_constraint_ratdens(9)snd_pcm_hw_constraint_msbits(9)snd_pcm_hw_constraint_step(9)snd_pcm_hw_constraint_pow2(9)snd_pcm_hw_rule_noresample(9)snd_pcm_hw_param_value(9)snd_pcm_hw_param_first(9)snd_pcm_hw_param_last(9)snd_pcm_hw_params_bits(9)snd_pcm_lib_ioctl(9)snd_pcm_period_elapsed_under_stream_lock(9)snd_pcm_period_elapsed(9)snd_pcm_add_chmap_ctls(9)
like okay that's a lot of friends but we love them all π§
aaaand that's the page!! mwah π this little beauty lives in ./sound/core, dated October 2026, and it's part of the snd_pcm_set_sync_per_card(9) era β go forth and sync responsibly, bestie πβ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms