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;
Member | Description |
---|---|
interleave | If set, stream contains interleaved samples. |
format | Format number. See SND_PCM_SFMT_* constants. |
rate | Requested rate in Hz. |
voices | Number of voices (1-N). |
special | Special (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;
Member | Description |
---|---|
channel | Specifies channel (direction). Can be SND_PCM_CHANNEL_PLAYBACK or SND_PCM_CHANNEL_CAPTURE. |
mode | Specifies channel mode. Can be SND_PCM_MODE_STREAM or SND_PCM_MODE_BLOCK. |
format | Specifies data format. |
digital | Specifies digital setup. |
start_mode | Specifies start mode. See to SND_PCM_START_* contants. |
stop_mode | Specifies stop mode. See to SND_PCM_STOP_* contants. |
time | If set, the driver offers the time in the status structure, when the transfer begun. The time is in gettimeofday format. |
ust_time | If set, the driver offers the time in the status structure, when the transfer begun. The time is in UST format. |
sync | Specifies the synchronization group. This group is used in the snd_pcm_sync_go call. |
queue_size | Specifies queue size in bytes for the stream mode. The queue size may specify the final transfer latency. |
fill | Specifies the fill mode. See SND_PCM_FILL_* constants. |
max_fill | Specifies the count of bytes to be filled ahead with silence. |
frag_size | Specifies the size of fragment in bytes. |
frags_min | Capture: Specifies the minimum filled fragments to allow wakeup (usually one). Playback: Specifies the minimum free fragments to allow wakeup (usually one). |
frags_max | Playback: Specifies the maximum filled fragments to allow wakeup. Value also specifies the maximum used fragments plus one. |
Value (start condition) | Description |
---|---|
SND_PCM_START_DATA | Start when some data are written (playback) or requested (capture). |
SND_PCM_START_FULL | Start when whole queue is filled (playback). |
SND_PCM_START_GO | Start on the go command. |
Value (stop condition) | Description |
---|---|
SND_PCM_STOP_STOP | Stop when underrun/overrun occurs. |
SND_PCM_STOP_ERASE | Stop and erase whole buffer when overrun (capture only). |
SND_PCM_STOP_ROLLOVER | Rollover when overrun/underrun occurs. |
Value (fill mode) | Description |
---|---|
SND_PCM_FILL_NONE | Do not fill the buffer with silence samples. |
SND_PCM_FILL_SILENCE_WHOLE | Fill the whole buffer with silence. |
SND_PCM_FILL_SILENCE | Fill the partial buffer with silence. |