libtinyalsa-mixer(3)

๐Ÿ“ฆ version 2.0.0, in alpine 3.24

๐ŸŽ€ libtinyalsa-mixer(3) ๐ŸŽ€

okay so bestie, this is the libtinyalsa-mixer page from the Library Functions Manual โ€” it's literally the mixer interface tea โ˜•โœจ.


๐Ÿ’– NAME ๐Ÿ’–

libtinyalsa-mixer โ€” Mixer Interface ๐Ÿ’…

  • all the macros, structures, and functions that make up the mixer interface, no cap ๐Ÿซถ

โœจ SYNOPSIS โœจ

okay so here's the cast list, main character energy only ๐Ÿ‘‘

๐Ÿงธ Data Structures

  • struct mixer_ctl โ€” a mixer control ๐ŸŽ›๏ธ
  • struct mixer โ€” a mixer handle โœ‹

๐ŸŒธ Enumerations

  • enum mixer_ctl_type โ€” mixer control type.
enum mixer_ctl_type { MIXER_CTL_TYPE_BOOL, MIXER_CTL_TYPE_INT,
           MIXER_CTL_TYPE_ENUM, MIXER_CTL_TYPE_BYTE, MIXER_CTL_TYPE_IEC958,
           MIXER_CTL_TYPE_INT64, MIXER_CTL_TYPE_UNKNOWN, MIXER_CTL_TYPE_MAX }

โญ Functions

  • void mixer_close (struct mixer *mixer) โ€” closes a mixer that came from mixer_open โ€” bye-bye handle ๐Ÿ’จ
  • struct mixer * mixer_open (unsigned int card) โ€” opens a mixer for a given card ๐ŸŽด
  • const char * mixer_get_name (const struct mixer *mixer) โ€” gets the name of the mixer's card ๐Ÿท๏ธ
  • unsigned int mixer_get_num_ctls (const struct mixer *mixer) โ€” gets the number of mixer controls for a given mixer ๐Ÿ”ข
  • unsigned int mixer_get_num_ctls_by_name (const struct mixer *mixer, const char *name) โ€” gets the number of mixer controls that go by a specified name, for a given mixer โ€” count 'em ๐Ÿ‘€
  • int mixer_subscribe_events (struct mixer *mixer, int subscribe) โ€” subscribes for the mixer events ๐Ÿ“ฌ
  • int mixer_wait_event (struct mixer *mixer, int timeout) โ€” waits for mixer events, lowkey patient vibes โณ
  • int mixer_consume_event (struct mixer *mixer) โ€” consumes a mixer event ๐Ÿฝ๏ธ
  • int mixer_read_event (struct mixer *mixer, struct mixer_ctl_event *event) โ€” reads a mixer control event ๐Ÿ“–
  • const struct mixer_ctl * mixer_get_ctl_const (const struct mixer *mixer, unsigned int id) โ€” gets a mixer control handle by the mixer control's id ๐Ÿ”Ž
  • struct mixer_ctl * mixer_get_ctl (struct mixer *mixer, unsigned int id) โ€” gets a mixer control handle by the mixer control's id ๐Ÿ”
  • struct mixer_ctl * mixer_get_ctl_by_name (struct mixer *mixer, const char *name) โ€” gets the first instance of a mixer control handle by the mixer control's name ๐Ÿฅ‡
  • struct mixer_ctl * mixer_get_ctl_by_name_and_index (struct mixer *mixer, const char *name, unsigned int index) โ€” gets an instance of a mixer control handle by the mixer control's name and index ๐ŸŽฏ
  • void mixer_ctl_update (struct mixer_ctl *ctl) โ€” updates the control's info ๐Ÿ”„
  • int mixer_ctl_is_access_tlv_rw (const struct mixer_ctl *ctl) โ€” checks the control for TLV Read/Write access ๐Ÿ•ต๏ธ
  • unsigned int mixer_ctl_get_id (const struct mixer_ctl *ctl) โ€” gets the control's ID ๐Ÿ†”
  • const char * mixer_ctl_get_name (const struct mixer_ctl *ctl) โ€” gets the name of the control ๐Ÿท๏ธ
  • enum mixer_ctl_type mixer_ctl_get_type (const struct mixer_ctl *ctl) โ€” gets the value type of the control ๐Ÿงฌ
  • const char * mixer_ctl_get_type_string (const struct mixer_ctl *ctl) โ€” gets the string that describes the value type of the control ๐Ÿ”ค
  • unsigned int mixer_ctl_get_num_values (const struct mixer_ctl *ctl) โ€” gets the number of values in the control ๐Ÿ”ข
  • int mixer_ctl_get_percent (const struct mixer_ctl *ctl, unsigned int id) โ€” gets a percentage representation of a specified control value ๐Ÿ’ฏ
  • int mixer_ctl_set_percent (struct mixer_ctl *ctl, unsigned int id, int percent) โ€” sets the value of a control by percent, specified by the value id ๐ŸŽš๏ธ
  • int mixer_ctl_get_value (const struct mixer_ctl *ctl, unsigned int id) โ€” gets the value of a control ๐ŸŽ›๏ธ
  • int mixer_ctl_get_array (const struct mixer_ctl *ctl, void *array, size_t count) โ€” gets the contents of a control's value array ๐Ÿงบ
  • int mixer_ctl_set_value (struct mixer_ctl *ctl, unsigned int id, int value) โ€” sets the value of a control, specified by the value id ๐ŸŽš๏ธ
  • int mixer_ctl_set_array (struct mixer_ctl *ctl, const void *array, size_t count) โ€” sets the contents of a control's value array ๐Ÿงบ
  • int mixer_ctl_get_range_min (const struct mixer_ctl *ctl) โ€” gets the minimum value of a control โฌ‡๏ธ
  • int mixer_ctl_get_range_max (const struct mixer_ctl *ctl) โ€” gets the maximum value of a control โฌ†๏ธ
  • unsigned int mixer_ctl_get_num_enums (const struct mixer_ctl *ctl) โ€” gets the number of enumerated items in the control ๐Ÿ”ข
  • const char * mixer_ctl_get_enum_string (struct mixer_ctl *ctl, unsigned int enum_id) โ€” gets the string representation of an enumerated item ๐Ÿ”ค
  • int mixer_ctl_set_enum_by_string (struct mixer_ctl *ctl, const char *string) โ€” sets an enumeration value by string value ๐Ÿช„

๐Ÿ’ซ Detailed Description ๐Ÿ’ซ

okay so fr fr, this is all the macros, structures, and functions that make up the mixer interface โ€” the whole friend group, together ๐Ÿ’œ.

๐ŸŒˆ Enumeration Type Documentation ๐ŸŒˆ

๐Ÿฆ‹ enum mixer_ctl_type ๐Ÿฆ‹

mixer control type, periodt. the way that this enum just labels every control vibe? iconic ๐Ÿ’…

๐Ÿ“ Enumerator

  • MIXER_CTL_TYPE_BOOL โ€” boolean control type โœ…
  • MIXER_CTL_TYPE_INT โ€” integer control type ๐Ÿ”ข
  • MIXER_CTL_TYPE_ENUM โ€” an enumerated control type ๐Ÿ“‹
  • MIXER_CTL_TYPE_INT64 โ€” a 64 bit integer control type ๐Ÿงฎ
  • MIXER_CTL_TYPE_UNKNOWN โ€” unknown control type โ“
  • MIXER_CTL_TYPE_MAX โ€” end of the enumeration (not a control type) ๐Ÿ›‘

๐ŸŒธ Function Documentation ๐ŸŒธ

okay bestie, this is the function-by-function tour. every signature, parameter, return value, and weird little typo is staying exactly where it belongs โ€” we're just making it cute ๐Ÿ’…


๐Ÿงน mixer_close

void mixer_close (struct mixer * mixer)

Closes a mixer returned by mixer_open. she's done, she's logging off, bye ๐Ÿ‘‹

  • mixer โ€” A mixer handle.

Returns: nothing, it's void โ€” she just leaves.


๐ŸŽง mixer_consume_event

int mixer_consume_event (struct mixer * mixer)

Consume a mixer event. If mixer_subscribe_events has been called, mixer_wait_event will identify when a control value has changed. This function will clear a single event from the mixer so that further events can be alerted. one event at a time, no cap โœจ

  • mixer โ€” A mixer handle.

Returns: 1 on success. 0, if no pending event. -errno on failure.


๐Ÿ“ mixer_ctl_get_array

int mixer_ctl_get_array (const struct mixer_ctl * ctl, void * array, size_t count)

Gets the contents of a control's value array. very "give me the whole squad" energy ๐Ÿซถ

  • ctl โ€” An initialized control handle.
  • array โ€” A pointer to write the array data to. The size of this array must be equal to the number of items in the array multiplied by the size of each item.
  • count โ€” The number of items in the array. This parameter must match the number of items in the control. The number of items in the control may be accessed via mixer_ctl_get_num_values.

Returns: On success, zero. On failure, non-zero.


๐ŸŒˆ mixer_ctl_get_enum_string

const char * mixer_ctl_get_enum_string (struct mixer_ctl * ctl, unsigned int enum_id)

Gets the string representation of an enumerated item. it's giving "translate the enum for me please" ๐Ÿ’–

  • ctl โ€” An initialized control handle.
  • enum_id โ€” The index of the enumerated value.

Returns: A string representation of the enumerated item.


๐ŸŽ€ mixer_ctl_get_id

unsigned int mixer_ctl_get_id (const struct mixer_ctl * ctl)

Gets the control's ID. every control needs a little name tag, iykyk โœจ

  • ctl โ€” An initialized control handle.

Returns: On success, the control's ID is returned. On error, UINT_MAX is returned instead.


๐Ÿฆ‹ mixer_ctl_get_name

const char * mixer_ctl_get_name (const struct mixer_ctl * ctl)

Gets the name of the control. main character identification moment ๐Ÿ‘‘

  • ctl โ€” An initialized control handle.

Returns: On success, the name of the control. On error, NULL.


๐Ÿ’œ mixer_ctl_get_num_enums

unsigned int mixer_ctl_get_num_enums (const struct mixer_ctl * ctl)

Get the number of enumerated items in the control. counting the enum girlies one by one ๐Ÿ”ข

  • ctl โ€” An initialized control handle.

Returns: The number of enumerated items in the control.


๐Ÿงš mixer_ctl_get_num_values

unsigned int mixer_ctl_get_num_values (const struct mixer_ctl * ctl)

Gets the number of values in the control. how many little values are we working with? let's find out ๐Ÿ’ซ

  • ctl โ€” An initialized control handle.

Returns: The number of values in the mixer control.


๐ŸŒธ mixer_ctl_get_percent

int mixer_ctl_get_percent (const struct mixer_ctl * ctl, unsigned int id)

Gets a percentage representation of a specified control value. turning the vibe into a %, iconic ๐Ÿ“ˆ

  • ctl โ€” An initialized control handle.
  • id โ€” The index of the value within the control.

Returns: On success, the percentage representation of the control value. On failure, -EINVAL is returned.


๐Ÿ”ฅ mixer_ctl_get_range_max

int mixer_ctl_get_range_max (const struct mixer_ctl * ctl)

Gets the maximum value of an control. The control must have an integer type. The type of the control can be checked with mixer_ctl_get_type. yes, "an control" โ€” she said what she said ๐Ÿ’€

  • ctl โ€” An initialized control handle.

Returns: On success, the maximum value of the control. On failure, -EINVAL.


๐ŸŒˆ mixer_ctl_get_range_min

int mixer_ctl_get_range_min (const struct mixer_ctl * ctl)

Gets the minimum value of an control. The control must have an integer type. The type of the control can be checked with mixer_ctl_get_type. the lower bound bestie, the floor, the starting line โœจ

  • ctl โ€” An initialized control handle.

Returns: On success, the minimum value of the control. On failure, -EINVAL.


๐ŸŽ€ mixer_ctl_get_type

enum mixer_ctl_type mixer_ctl_get_type (const struct mixer_ctl * ctl)

Gets the value type of the control. type check, but make it mixer ๐Ÿ’…

  • ctl โ€” An initialized control handle.

Returns: On success, the type of mixer control. On failure, it returns MIXER_CTL_TYPE_UNKNOWN.


๐Ÿฆ‹ mixer_ctl_get_type_string

const char * mixer_ctl_get_type_string (const struct mixer_ctl * ctl)

Gets the string that describes the value type of the control. same type info, but in a string outfit ๐ŸŽ€

  • ctl โ€” An initialized control handle.

Returns: On success, a string describing type of mixer control.


โญ mixer_ctl_get_value

int mixer_ctl_get_value (const struct mixer_ctl * ctl, unsigned int id)

Gets the value of a control. the moment we've all been waiting for: the actual value ๐Ÿ”ฅ

  • ctl โ€” An initialized control handle.
  • id โ€” The index of the control value.

Returns: On success, the specified value is returned. On failure, -EINVAL is returned.


๐Ÿ’€ mixer_ctl_is_access_tlv_rw

int mixer_ctl_is_access_tlv_rw (const struct mixer_ctl * ctl)

Checks the control for TLV Read/Write access. is she TLV read/write coded? let's check ๐Ÿ‘€

  • ctl โ€” An initialized control handle.

Returns: On success, non-zero. On failure, zero.


๐Ÿ“ mixer_ctl_set_array

int mixer_ctl_set_array (struct mixer_ctl * ctl, const void * array, size_t count)

Sets the contents of a control's value array. dropping the whole array in, no crumbs left behind ๐Ÿซถ

  • ctl โ€” An initialized control handle.
  • array โ€” The array containing control values.
  • count โ€” The number of values in the array. This must match the number of values in the control. The number of values in a control may be accessed via mixer_ctl_get_num_values.

Returns: On success, zero. On failure, non-zero.


๐ŸŽ€ mixer_ctl_set_enum_by_string

int mixer_ctl_set_enum_by_string (struct mixer_ctl * ctl, const char * string)

Set an enumeration value by string value. name the enum and set it, cute and direct โœจ

  • ctl โ€” An enumerated mixer control.
  • string โ€” The string representation of an enumeration.

Returns: On success, zero. On failure, zero. yes bestie, both zero โ€” that's literally what the page says ๐Ÿ’€


๐ŸŒธ mixer_ctl_set_percent

int mixer_ctl_set_percent (struct mixer_ctl * ctl, unsigned int id, int percent)

Sets the value of a control by percent, specified by the value index. setting the vibe level from 0 to 100 ๐ŸŽš๏ธ

  • ctl โ€” An initialized control handle.
  • id โ€” The index of the value to set.
  • percent โ€” A percentage value between 0 and 100.

Returns: On success, zero is returned. On failure, non-zero is returned.


๐Ÿ”ฅ mixer_ctl_set_value

int mixer_ctl_set_value (struct mixer_ctl * ctl, unsigned int id, int value)

Sets the value of a control, specified by the value index. one value, one index, one moment ๐Ÿ’…

  • ctl โ€” An initialized control handle.
  • id โ€” The index of the value within the control.
  • value โ€” The value to set. This must be in a range specified by mixer_ctl_get_range_min and mixer_ctl_get_range_max.

Returns: On success, zero is returned. On failure, non-zero is returned.


๐Ÿงš mixer_ctl_update

void mixer_ctl_update (struct mixer_ctl * ctl)

Updates the control's info. This is useful for a program that may be idle for a period of time. refresh her info, she's been sitting here for a minute ๐Ÿ•ฐ๏ธ

  • ctl โ€” An initialized control handle.

Returns: nothing, void era.


๐ŸŽง mixer_get_ctl

struct mixer_ctl * mixer_get_ctl (struct mixer * mixer, unsigned int id)

Gets a mixer control handle, by the mixer control's id. For const access, see mixer_get_ctl_const. ID girlies rise ๐Ÿซถ

  • mixer โ€” An initialized mixer handle.
  • id โ€” The control's id in the given mixer.

Returns: A handle to the mixer control.


๐Ÿฆ‹ mixer_get_ctl_by_name

struct mixer_ctl * mixer_get_ctl_by_name (struct mixer * mixer, const char * name)

Gets the first instance of mixer control handle, by the mixer control's name. first match only, bestie โ€” don't get it twisted โœจ

  • mixer โ€” An initialized mixer handle.
  • name โ€” The control's name in the given mixer.

Returns: A handle to the mixer control.


๐Ÿ’œ mixer_get_ctl_by_name_and_index

struct mixer_ctl * mixer_get_ctl_by_name_and_index (struct mixer * mixer, const char * name, unsigned int index)

Gets an instance of mixer control handle, by the mixer control's name and index. For instance, if two controls have the name of 'Volume', then and index of 1 would return the second control. (yes, "then and index" โ€” the page said it, not me ๐Ÿ˜ญ)

  • mixer โ€” An initialized mixer handle.
  • name โ€” The control's name in the given mixer.
  • index โ€” The control's index.

Returns: A handle to the mixer control.


๐ŸŽ€ mixer_get_ctl_const

const struct mixer_ctl * mixer_get_ctl_const (const struct mixer * mixer, unsigned int id)

Gets a mixer control handle, by the mixer control's id. For non-const access, see mixer_get_ctl. const-correct queen ๐Ÿ‘‘

  • mixer โ€” An initialized mixer handle.
  • id โ€” The control's id in the given mixer.

Returns: A handle to the mixer control.


๐ŸŒˆ mixer_get_name

const char * mixer_get_name (const struct mixer * mixer)

Gets the name of the mixer's card. not the control, the card โ€” read her properly ๐Ÿ’ณ

  • mixer โ€” An initialized mixer handle.

Returns: The name of the mixer's card.


โญ mixer_get_num_ctls

unsigned int mixer_get_num_ctls (const struct mixer * mixer)

Gets the number of mixer controls for a given mixer. counting the controls like they're้™้‡ edition ๐Ÿ‘€

  • mixer โ€” An initialized mixer handle.

Returns: The number of mixer controls for the given mixer.


๐Ÿ“ mixer_get_num_ctls_by_name

unsigned int mixer_get_num_ctls_by_name (const struct mixer * mixer, const char * name)

Gets the number of mixer controls, that go by a specified name, for a given mixer. all the same-name girlies accounted for ๐Ÿ’…

  • mixer โ€” An initialized mixer handle.
  • name โ€” The name of the mixer control.

Returns: The number of mixer controls, specified by name, for the given mixer.


๐Ÿ”ฅ mixer_open

struct mixer * mixer_open (unsigned int card)

Opens a mixer for a given card. new mixer, new me, let's gooo โœจ

  • card โ€” The card to open the mixer for.

Returns: An initialized mixer handle.


๐ŸŽง mixer_read_event

int mixer_read_event (struct mixer * mixer, struct mixer_ctl_event * event)

Read a mixer control event. Try to read an control event from mixer. event output goes into the event parameter โ€” if there is an event read form the mixer, this function will fill the event data into it. "form" is their word, we're keeping it ๐Ÿ’€

  • mixer โ€” A mixer handle.
  • event โ€” Output parameter. If there is an event read form the mixer, this function will fill the event data into it.

Returns: 1 on success. 0, if no pending event. -errno on failure.


๐ŸŒธ mixer_subscribe_events

int mixer_subscribe_events (struct mixer * mixer, int subscribe)

Subscribes for the mixer events. get on the event list, bestie ๐Ÿ“ฌ

  • mixer โ€” A mixer handle.
  • subscribe โ€” value indicating subscribe or unsubscribe for events.

Returns: On success, zero. On failure, non-zero.


๐Ÿฆ‹ mixer_wait_event

int mixer_wait_event (struct mixer * mixer, int timeout)

Wait for mixer events. the waiting room, but for mixer events โณ

  • mixer โ€” A mixer handle.
  • timeout โ€” timout value (their spelling, not mine).

Returns: On success, 1. On failure, -errno. On timeout, 0.


๐Ÿ‘‘ Author ๐Ÿ‘‘

Generated automatically by Doxygen for TinyALSA from the source code. automated icon behavior, honestly ๐Ÿค–โœจ


source/version: TinyALSA, Version 1.1.0 ยท page: libtinyalsa-mixer(3) ยท date: not in this footer, so we're calling her timeless ๐Ÿ’œ

stay hydrated, go check your mixer controls, and remember: every event deserves to be consumed responsibly ๐ŸŽ€๐Ÿ’–

๐Ÿ“ฆ where this page comes from