snd_pcm_hw_param_set(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

snd_pcm_hw_param_set β€” bestie, this is the little kernel helper that sets an ALSA PCM hardware parameter for you πŸ’… (the original page literally leaves the one-liner blank, so we're just vibing with the function name, iykyk)

🌸 SYNOPSIS 🌸

int snd_pcm_hw_param_set (struct snd_pcm_substream *pcm , struct
       snd_pcm_hw_params *params , snd_pcm_hw_param_t var , unsigned int val ,
       int dir );

πŸŽ€ ARGUMENTS πŸŽ€

  • pcm β€” the PCM instance, aka the main character of this whole operation 🫢
  • params β€” the hw_params instance, where all the config-space lore lives
  • var β€” the parameter to retrieve, no cap
  • val β€” the value to set, the moment we've all been waiting for ⭐
  • dir β€” pointer to the direction, which is -1, 0, 1, or NULL (yes, NULL is allowed, she's flexible like that πŸ™ˆ)

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: there's a configuration space, and it's defined by PARAMS. Inside that space, this function removes from PAR all the values that are != VAL β€” literally just yeeting everything that isn't the value you asked for πŸ’€. The configuration space gets reduced accordingly, which is iconic behaviour honestly.

Then it returns VAL… or -EINVAL if the configuration space ends up empty 😭 (empty config space = no vibes = error, periodt).

Heads up bestie: the original wording here is short and a little cryptic β€” PAR vs PARAMS, and returning VAL or -EINVAL. That's exactly what it says, so I'm not gonna invent extra lore. 🧚

🌈 SEE ALSO 🌈

Kernel file ./sound/core/oss/pcm_oss.c, plus these absolute queens:


And that's the whole page, bestie β€” not me finishing up a whole kernel API doc πŸŽ€ this one's filed under ./sound/core/oss, dated October 2026, and it's snd_pcm_hw_param_set(9) forever and always πŸ’–βœ¨

πŸ“¦ where this page comes from