snd_switch_t

Updated: May 06, 2022

Information about a mixer's switch

Synopsis:

#include <sys/asound_common.h>

typedef struct snd_switch
{
    int32_t iface;
    int32_t device;
    int32_t channel;
    char    name[36];
    uint32_t type;
    uint32_t subtype;
    uint32_t zero[2];
    union
    {
        uint32_t enable:1;

        struct
        {
            uint8_t data;
            uint8_t low;
            uint8_t high;
        }
        byte;

        struct
        {
            uint16_t data;
            uint16_t low;
            uint16_t high;
        }
        word;

        struct
        {
            uint32_t data;
            uint32_t low;
            uint32_t high;
        }
        dword;

        struct
        {
            uint32_t data;
            uint32_t items[30];
            uint32_t items_cnt;
        }
        list;

        struct
        {
            struct 
            {
                uint16_t input[15];
                uint16_t output[15];
                uint16_t cnt;    /* Read-only (configured by driver); defines
                                    the number of concurrent routes supported
                                    through the switch */
            } active;

            /* The below items are read-only (configured by driver) to
               communicate the inputs and outputs connected to the switch */
            uint16_t inputs[15];
            uint16_t inputs_cnt;
            uint16_t outputs[15];
            uint16_t outputs_cnt;
        }
        routing_list;

        struct
        {
            uint16_t selected_items[30];
            uint16_t selected_items_cnt;
            uint16_t items[30];
            uint16_t items_cnt;
        }
        multi_selection_list;

        struct
        {
            uint8_t selection;
            char    strings[11][11];
            uint8_t strings_cnt;
        }
        string_11;

        uint8_t raw[32];
        uint8_t reserved[128];      /* must be filled with zeroes */
    }
    value;
    uint8_t reserved[128];      /* must be filled with zeroes */
}
snd_switch_t;

Description:

The snd_switch_t structure describes the switches for a mixer. You can fill this structure by calling snd_ctl_mixer_switch_read().

The members include:

iface
The audio interface associated with the switch.
device
The device number associated with the switch.
channel
Currently only set to 0.
name
The text name of the switch.
type
The kind of switch. The following types are supported:
Type Union member Description
SND_SW_TYPE_BOOLEAN enable A simple on and off switch
SND_SW_TYPE_BYTE byte An 8-bit value constrained between a minimum and maximum setting
SND_SW_TYPE_DWORD dword A 32-bit value constrained between a minimum and maximum setting
SND_SW_TYPE_LIST list A 32-bit value selected from a list of values. The items_cnt argument is the number of valid items in the array.
SND_SW_TYPE_MULTI_SEL_LIST multi_selection_list A multiselection list switch; see below.
SND_SW_TYPE_ROUTING_LIST routing_list A routing list switch; see below.
SND_SW_TYPE_STRING_11 string_11 An array of string selections with a maximum length of 11 bytes. The strings_cnt argument is the number of valid strings in the array. The selection argument is the index of the selected string.
SND_SW_TYPE_WORD word A 16-bit value constrained between a minimum and maximum setting
subtype
The switch's subtype. The following types are supported:
SND_SW_SUBTYPE_DEC
Display the value in decimal notation.
SND_SW_SUBTYPE_HEXA
Display the value in hexadecimal notation.

SND_SW_TYPE_ROUTING_LIST and SND_SW_TYPE_MULTI_SEL_LIST are similar:

Classification:

QNX Neutrino