libtinyalsa-mixer - Mixer Interface

NAME  SYNOPSIS  Data Structures  Enumerations  Functions  Detailed Description  Enumeration Type Documentation  enum mixer_ctl_type  Function Documentation  void mixer_close (struct mixer * mixer)  int mixer_consume_event (struct mixer * mixer)  int mixer_ctl_get_array (const struct mixer_ctl * ctl, void * array, size_tcount)  const char * mixer_ctl_get_enum_string (struct mixer_ctl * ctl, unsignedint enum_id)  unsigned int mixer_ctl_get_id (const struct mixer_ctl * ctl)  const char * mixer_ctl_get_name (const struct mixer_ctl * ctl)  unsigned int mixer_ctl_get_num_enums (const struct mixer_ctl * ctl)  unsigned int mixer_ctl_get_num_values (const struct mixer_ctl * ctl)  int mixer_ctl_get_percent (const struct mixer_ctl * ctl, unsigned int id)  int mixer_ctl_get_range_max (const struct mixer_ctl * ctl)  int mixer_ctl_get_range_min (const struct mixer_ctl * ctl)  enum mixer_ctl_type mixer_ctl_get_type (const struct mixer_ctl * ctl)  const char * mixer_ctl_get_type_string (const struct mixer_ctl * ctl)  int mixer_ctl_get_value (const struct mixer_ctl * ctl, unsigned int id)  int mixer_ctl_is_access_tlv_rw (const struct mixer_ctl * ctl)  int mixer_ctl_set_array (struct mixer_ctl * ctl, const void * array, size_tcount)  int mixer_ctl_set_enum_by_string (struct mixer_ctl * ctl, const char *string)  int mixer_ctl_set_percent (struct mixer_ctl * ctl, unsigned int id, intpercent)  int mixer_ctl_set_value (struct mixer_ctl * ctl, unsigned int id, intvalue)  void mixer_ctl_update (struct mixer_ctl * ctl)  struct mixer_ctl * mixer_get_ctl (struct mixer * mixer, unsigned int id)  struct mixer_ctl * mixer_get_ctl_by_name (struct mixer * mixer, const char* name)  struct mixer_ctl * mixer_get_ctl_by_name_and_index (struct mixer * mixer,const char * name, unsigned int index)  const struct mixer_ctl * mixer_get_ctl_const (const struct mixer * mixer,unsigned int id)  const char * mixer_get_name (const struct mixer * mixer)  unsigned int mixer_get_num_ctls (const struct mixer * mixer)  unsigned int mixer_get_num_ctls_by_name (const struct mixer * mixer, constchar * name)  struct mixer * mixer_open (unsigned int card)  int mixer_read_event (struct mixer * mixer, struct mixer_ctl_event * event)  int mixer_subscribe_events (struct mixer * mixer, int subscribe)  int mixer_wait_event (struct mixer * mixer, int timeout)  Author 

NAME

libtinyalsa-mixer − Mixer Interface

− All macros, structures and functions that make up the mixer interface.

SYNOPSIS

Data Structures

struct mixer_ctl
A mixer control.
struct mixer
A mixer handle.

Enumerations

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 }
Mixer control type.

Functions

void mixer_close (struct mixer *mixer)
Closes a mixer returned by mixer_open.
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.
int mixer_subscribe_events (struct mixer *mixer, int subscribe)
Subscribes for the mixer events.
int mixer_wait_event (struct mixer *mixer, int timeout)
Wait for mixer events.
int mixer_consume_event (struct mixer *mixer)
Consume a mixer event.
int mixer_read_event (struct mixer *mixer, struct mixer_ctl_event *event)
Read 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 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 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 index.
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 index.
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 an control.
int mixer_ctl_get_range_max (const struct mixer_ctl *ctl)
Gets the maximum value of an control.
unsigned int mixer_ctl_get_num_enums (const struct mixer_ctl *ctl)
Get 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)
Set an enumeration value by string value.

Detailed Description

All macros, structures and functions that make up the mixer interface.

Enumeration Type Documentation

enum mixer_ctl_type

Mixer control type.

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

void mixer_close (struct mixer * mixer)

Closes a mixer returned by mixer_open.

Parameters

mixer A mixer handle.

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.

Parameters

mixer A mixer handle.

Returns

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

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

Gets the contents of a control’s value array.

Parameters

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.

const char * mixer_ctl_get_enum_string (struct mixer_ctl * ctl, unsignedint enum_id)

Gets the string representation of an enumerated item.

Parameters

ctl An initialized control handle.
enum_id
The index of the enumerated value.

Returns

A string representation of the enumerated item.

unsigned int mixer_ctl_get_id (const struct mixer_ctl * ctl)

Gets the control’s ID.

Parameters

ctl An initialized control handle.

Returns

On success, the control’s ID is returned. On error, UINT_MAX is returned instead.

const char * mixer_ctl_get_name (const struct mixer_ctl * ctl)

Gets the name of the control.

Parameters

ctl An initialized control handle.

Returns

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

unsigned int mixer_ctl_get_num_enums (const struct mixer_ctl * ctl)

Get the number of enumerated items in the control.

Parameters

ctl An initialized control handle.

Returns

The number of enumerated items in the control.

unsigned int mixer_ctl_get_num_values (const struct mixer_ctl * ctl)

Gets the number of values in the control.

Parameters

ctl An initialized control handle

Returns

The number of values in the mixer control

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

Gets a percentage representation of a specified control value.

Parameters

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.

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.

Parameters

ctl An initialized control handle.

Returns

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

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.

Parameters

ctl An initialized control handle.

Returns

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

enum mixer_ctl_type mixer_ctl_get_type (const struct mixer_ctl * ctl)

Gets the value type of the control.

Parameters

ctl An initialized control handle

Returns

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

const char * mixer_ctl_get_type_string (const struct mixer_ctl * ctl)

Gets the string that describes the value type of the control.

Parameters

ctl An initialized control handle

Returns

On success, a string describing type of mixer control.

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

Gets the value of a control.

Parameters

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.

int mixer_ctl_is_access_tlv_rw (const struct mixer_ctl * ctl)

Checks the control for TLV Read/Write access.

Parameters

ctl An initialized control handle.

Returns

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

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

Sets the contents of a control’s value array.

Parameters

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.

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

Set an enumeration value by string value.

Parameters

ctl An enumerated mixer control.
string
The string representation of an enumeration.

Returns

On success, zero. On failure, zero.

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

Sets the value of a control by percent, specified by the value index.

Parameters

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.

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

Sets the value of a control, specified by the value index.

Parameters

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.

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.

Parameters

ctl An initialized control handle.

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

Parameters

mixer An initialized mixer handle.
id
The control’s id in the given mixer.

Returns

A handle to the mixer control.

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.

Parameters

mixer An initialized mixer handle.
name
The control’s name in the given mixer.

Returns

A handle to the mixer control.

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.

Parameters

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.

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

Parameters

mixer An initialized mixer handle.
id
The control’s id in the given mixer.

Returns

A handle to the mixer control.

const char * mixer_get_name (const struct mixer * mixer)

Gets the name of the mixer’s card.

Parameters

mixer An initialized mixer handle.

Returns

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.

Parameters

mixer An initialized mixer handle.

Returns

The number of mixer controls for the given mixer.

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

Gets the number of mixer controls, that go by a specified name, for a given mixer.

Parameters

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.

struct mixer * mixer_open (unsigned int card)

Opens a mixer for a given card.

Parameters

card The card to open the mixer for.

Returns

An initialized mixer handle.

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.

Parameters

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.

int mixer_subscribe_events (struct mixer * mixer, int subscribe)

Subscribes for the mixer events.

Parameters

mixer A mixer handle.
subscribe
value indicating subscribe or unsubscribe for events

Returns

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

int mixer_wait_event (struct mixer * mixer, int timeout)

Wait for mixer events.

Parameters

mixer A mixer handle.
timeout
timout value

Returns

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

Author

Generated automatically by Doxygen for TinyALSA from the source code.


Updated 2024-01-29 - jenkler.se | uex.se