snd_pcm_hw_param_last(9)
π snd_pcm_hw_param_last(9) β the Kernel API Manual moment
okay so bestie, welcome to the snd_pcm_hw_param_last(9) page from the Kernel API Manual. this one is short and sweet and honestly kind of a baddie: it's the "gimme the biggest value you got" of the ALSA hw-params world. let's get into it π
β¨ NAME β¨
snd_pcm_hw_param_last β refine the config space and hand you back the maximum value. no cap, that's the whole gig.
π SYNOPSIS π
int snd_pcm_hw_param_last (struct snd_pcm_substream *pcm , struct
snd_pcm_hw_params *params , snd_pcm_hw_param_t var , int *dir );
π¦ ARGUMENTS π¦
four little besties walk into a function:
pcmβ your PCM instance. the main character, obviously.paramsβ the hw_params instance. this is the vibe check zone we're about to narrow down.varβ the parameter you actually want to retrieve. pick your fighter.dirβ a pointer to the direction, which is-1,0, or1... orNULL, if you're feeling mysterious. π
πΈ DESCRIPTION πΈ
so like, inside the configuration space that params defines, this function takes var and removes all the values that are < maximum. yep, all of them. gone. then it reduces the configuration space accordingly β it literally rewrites the space so the leftovers are what's left. it's giving "spring cleaning but make it interval math" β¨
basically: maximum stays, everything below it gets the boot. periodt.
π₯ RETURN π₯
returns the maximum on success π β or a negative error code on failure. so if you get a negative number back, that's your sign, bestie, something went sideways π
π SEE ALSO π
okay this is the long part and i need you to stay with me β the kernel file lives at ./sound/core/pcm_lib.c, and these are all the friends-of-friends you should also go read (iykyk):
snd_pcm_set_ops(9)snd_pcm_set_sync_per_card(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_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 i said. a whole friend group. read them all, they're iconic π«Ά
lowkey reminder: this one returns the maximum β if you wanted the minimum instead, that's a whole other function, and yes, snd_pcm_hw_param_first(9) is sitting right there in SEE ALSO being all smug about it π
that's the whole page, bestie! π this lil masterpiece comes from the ./sound/core source and is dated October 2026, filed under snd_pcm_hw_param_last(9). go forth and refine your config space β¨ππ
π¦ 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