Updated: May 06, 2022

Mixer group control structure


typedef struct snd_mixer_group_s
    snd_mixer_gid_t gid;
    uint32_t    caps;
    uint64_t    channel_mask;
    int32_t     min, max;
        uint32_t    values[32];
            uint32_t    front_left;
            uint32_t    front_right;
            uint32_t    front_center;
            uint32_t    rear_left;
            uint32_t    rear_right;
            uint32_t    woofer;
            uint8_t     reserved[128]; /* must be filled with zeroes */
        }       names;
    }       volume;
    uint64_t    mute;
    uint64_t    capture;
    int32_t     capture_group;

    int32_t     elements_size, elements, elements_over;
    snd_mixer_eid_t *pelements;
    uint16_t    change_duration;    /* milliseconds */
    uint16_t    spare;
    int32_t     min_dB, max_dB;
    int32_t     dB_scale_factor;
    uint32_t    balance_min;
    uint32_t    balance_max;
    uint32_t    balance_level;
    uint32_t    fade_level;
    uint8_t     reserved[99];       /* must be filled with zero */
}       snd_mixer_group_t;


The snd_mixer_group_t structure is the control structure for a mixer group. You can get the information for a group by calling snd_mixer_group_read(), and set it by calling snd_mixer_group_write().

Some structure members are read-only and are ignored for snd_mixer_group_write() calls. The change_duration member is write-only and ignored for snd_mixer_group_read() calls.

The members of this structure include:

A snd_mixer_gid_t structure that identifies the group. This structure includes the group name and index.
The capabilities of the group, expressed through any combination of these flags. Read only:
  • SND_MIXER_GRPCAP_VOLUME — the group has at least one volume control.
  • SND_MIXER_GRPCAP_JOINTLY_VOLUME — all channel volume levels for the group must be the same (ganged).
  • SND_MIXER_GRPCAP_MUTE — the group has at least one mute control.
  • SND_MIXER_GRPCAP_JOINTLY_MUTE — all channel mute settings for the group must be the same (ganged).
  • SND_MIXER_GRPCAP_CAPTURE — the group can be captured (recorded).
  • SND_MIXER_GRPCAP_JOINTLY_CAPTURE — all channel capture settings for the group must be the same (ganged).
  • SND_MIXER_GRPCAP_EXCL_CAPTURE — only one group on this device can be captured at a time.
  • SND_MIXER_GRPCAP_BALANCE — group has balance controls.
  • SND_MIXER_GRPCAP_FADE — group has fade controls.
  • SND_MIXER_GRPCAP_PLAY_GRP — the group is a playback group.
  • SND_MIXER_GRPCAP_CAP_GRP — the group is a capture group.
  • SND_MIXER_GRPCAP_SUBCHANNEL — the group is a subchannel control. It exists only while a PCM subchannel is allocated by an application.
The mapped bits that correspond to the channels contained in this group. Read only.

For example, for stereo right and left speakers, bits 1 and 2 (00011) are mapped; for the center speaker, bit 3 (00100) is mapped.

For complete mapping information, see the SND_MIXER_CHN_MASK_* definitions in asound_common.h.

min, max
The minimum and maximum values that define the volume range. Note that the minimum doesn't have to be zero. Read only.
A structure that contains the volume level for each channel in the group. You can access the values accessed directly by name or indirectly through the array of values.
Note: If the group is jointly volumed, all volume values must be the same; setting different values results in undefined behavior.
A bit mask that specifies the mute state of the group channels. If the bit corresponding to the channel is set, the channel is muted.
Note: If the group is jointly muted, all mute bits must be the same; setting the bits differently results in undefined behavior.
A bit mask that specifies the capture state of the group channels. If the bit corresponding to the channel is set, the channel is being captured. If the group is exclusively capture, setting capture on this group means that another group is no longer being captured.
Note: If the group is jointly captured, all capture bits must be the same; setting the bits differently results in undefined behavior.
Not currently used.
The size of the memory block pointed to by pelements in units of snd_mixer_eid_t. Read only.
The number of element IDs that are currently valid in pelements. Read only.
The number of element IDs that were not returned in pelements because it wasn't large enough. Read only.
A pointer to a region of memory (allocated by the calling application) that's used to store an array of element IDs. This is an array of snd_mixer_eid_t structures.

The elements that are returned are the component elements that make up the group identified by gid.

The number of milliseconds over which to ramp the volume. Write only.
min_dB, max_dB
The minimum and maximum sound levels, in decibels. Read only.
The value by which min_dB and max_dB have been scaled. Read only.
The minimum balance. Read only. See “Balance and fade controls.”
The maximum balance. Read only.
The balance level.
The fade level.

Balance and fade controls

The balance and fade controls work like a slider where 0% corresponds to the left (balance) or front (fade) channel and 100% to the right (balance) or rear (fade) channel. At 50%, the balance or fade control applies no attenuation to any channels. A value less than 50% is closer to left or front and attenuates right or rear, and a value greater than 50% is closer to right or rear and attenuates left or front. For the center channel, moving the balance away from 50% in either direction causes an attenuation. The woofer and low-frequency effects (LFE) channels are treated like a rear channel — they are attenuated when you fade towards the front.

The balance_min member corresponds to a 0% value for the range and balance_max corresponds to a 100% value. For example, if balance_min is 0 and balance_max is 200, a balance_level of 100 balances the volume.


QNX Neutrino