[Previous] [Contents] [Next]

snd_pcm_channel_setup()

Get the current PCM setup

Synopsis:

#include <sys/asoundlib.h>

int snd_pcm_channel_setup( 
                    snd_pcm_t * handle, 
                    snd_pcm_channel_setup_t * setup );

Library:

libasound.so

Description:

The snd_pcm_channel_setup() function fills the setup structure with data about the PCM channel settings selected by handle. The channel member specifies the direction. Other members are read-only.

typedef struct snd_pcm_channel_setup
{
    int32_t             channel;
    int32_t             mode;
    snd_pcm_format_t    format;
    snd_pcm_digital_t   digital;
    union
    {
        struct
        {
            int32_t     queue_size;
            uint8_t     reserved[124];      /* must be filled with zero */
        }       stream;
        struct
        {
            int32_t     frag_size;
            int32_t     frags;
            int32_t     frags_min;
            int32_t     frags_max;
            uint8_t     reserved[128];      /* must be filled with zero */
        }       block;
        uint8_t     reserved[128];      /* must be filled with zero */
    }       buf;
    int16_t     msbits_per_sample;
    int16_t     pad1;
    int32_t     mixer_device;           /* mixer device */
    snd_mixer_eid_t *mixer_eid;         /* pcm source mixer element */
    snd_mixer_gid_t *mixer_gid;         /* lowest level mixer group subchn specific */
    uint8_t     reserved[112];      /* must be filled with zero */
}       snd_pcm_channel_setup_t;

where:

channel
Specifies channel direction. One of SND_PCM_CHANNEL_PLAYBACK or SND_PCM_CHANNEL_CAPTURE.
mode
Shows channel mode. One of SND_PCM_MODE_STREAM or SND_PCM_MODE_BLOCK.
format
Shows the used format. Especially rate member may differ from requested one.
digital
Shows the used digital settings.
queue_size
Shows the real queue size (may differ from requested one).
frag_size
Shows the real fragment size (may differ from requested one).
frags
Shows the count of fragments.
frags_min
Capture: Shows the minimum filled fragments to allow wakeup. Playback: Shows the minimum free fragments to allow wakeup.
frags_max
Playback: Specifies the maximum filled fragments to allow wakeup. Value also specifies the maximum used fragments plus one.
msbits_per_sample
Shows how many most significant bits are physically used.
mixer_device
Mixer device for this subchannel.
mixer_eid
Pointer to the mixer element identification for this subchannel.
mixer_gid
Pointer to the mixer group identification for this subchannel.

Returns:

Zero on success, or an error code.

Errors:

-EINVAL
Invalid handle

Examples:

See the example in Configuring the Audio channel in the Playing Audio Data chapter This call is used identically to snd_pcm_plugin_setup().

Classification:

ALSA

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

snd_pcm_plugin_setup()


[Previous] [Contents] [Next]