snd_pcm_channel_params

Name

snd_pcm_channel_params -- set PCM communication parameters

Synopsis

int snd_pcm_channel_params(snd_pcm_t *handle, snd_pcm_channel_params_t *params);

Description

Setup the transfer parameters according to params structure. All members are write-only. Function may be called in SND_PCM_STATUS_NOTREADY (initial) and SND_PCM_STATUS_READY states, otherwise -EBADFD error is returned. Function returns zero if successful, otherwise it returns an error code.

If the parameters are valid (zero is returned), then the driver state is changed to SND_PCM_STATUS_READY.

typedef struct snd_pcm_format {
        int interleave: 1;
        int format;
        int rate;
        int voices;
        int special;
        char reserved[16];
} snd_pcm_format_t;

MemberDescription
interleaveIf set, stream contains interleaved samples.
formatFormat number. See SND_PCM_SFMT_* constants.
rateRequested rate in Hz.
voicesNumber of voices (1-N).
specialSpecial (custom) description of format. This member is used when SND_PCM_SFMT_SPECIAL is used.

typedef struct snd_pcm_channel_params {
        int channel;
        int mode;
        snd_pcm_format_t format;
        snd_pcm_digital_t digital;
        int start_mode;
        int stop_mode;
        int time: 1,
            ust_time: 1;
        union {
                struct {
                        int queue_size;
                        int fill;
                        int max_fill;
                } stream;
                struct {
                        int frag_size;
                        int frags_min;
                        int frags_max;
                } block;
        } buf;
        char reserved[64];
} snd_pcm_channel_params_t;

MemberDescription
channelSpecifies channel (direction). Can be SND_PCM_CHANNEL_PLAYBACK or SND_PCM_CHANNEL_CAPTURE.
modeSpecifies channel mode. Can be SND_PCM_MODE_STREAM or SND_PCM_MODE_BLOCK.
formatSpecifies data format.
digitalSpecifies digital setup.
start_modeSpecifies start mode. See to SND_PCM_START_* contants.
stop_modeSpecifies stop mode. See to SND_PCM_STOP_* contants.
timeIf set, the driver offers the time in the status structure, when the transfer begun. The time is in gettimeofday format.
ust_timeIf set, the driver offers the time in the status structure, when the transfer begun. The time is in UST format.
syncSpecifies the synchronization group. This group is used in the snd_pcm_sync_go call.
queue_sizeSpecifies queue size in bytes for the stream mode. The queue size may specify the final transfer latency.
fillSpecifies the fill mode. See SND_PCM_FILL_* constants.
max_fillSpecifies the count of bytes to be filled ahead with silence.
frag_sizeSpecifies the size of fragment in bytes.
frags_minCapture: Specifies the minimum filled fragments to allow wakeup (usually one). Playback: Specifies the minimum free fragments to allow wakeup (usually one).
frags_maxPlayback: Specifies the maximum filled fragments to allow wakeup. Value also specifies the maximum used fragments plus one.

Value (start condition)Description
SND_PCM_START_DATAStart when some data are written (playback) or requested (capture).
SND_PCM_START_FULLStart when whole queue is filled (playback).
SND_PCM_START_GOStart on the go command.

Value (stop condition)Description
SND_PCM_STOP_STOPStop when underrun/overrun occurs.
SND_PCM_STOP_ERASEStop and erase whole buffer when overrun (capture only).
SND_PCM_STOP_ROLLOVERRollover when overrun/underrun occurs.

Value (fill mode)Description
SND_PCM_FILL_NONEDo not fill the buffer with silence samples.
SND_PCM_FILL_SILENCE_WHOLEFill the whole buffer with silence.
SND_PCM_FILL_SILENCEFill the partial buffer with silence.