int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val);
int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
-int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
-int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
int snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val);
int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated));
int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val) __attribute__((deprecated));
snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated));
+int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val) __attribute__((deprecated));
+int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val) __attribute__((deprecated));
/** \} */
SNDMSG("params->avail_min is 0");
return -EINVAL;
}
- if (! params->xfer_align) {
- SNDMSG("params->xfer_align is 0");
- return -EINVAL;
- }
#if 0
/* disable the check below - it looks too restrictive
* (start_threshold is basically independent from avail_min)
return -EINVAL;
}
#endif
- if (params->start_threshold <= pcm->buffer_size &&
- params->start_threshold > (pcm->buffer_size / params->xfer_align) * params->xfer_align) {
- SNDMSG("params->xfer_align problem for start_threshold");
- return -EINVAL;
- }
err = pcm->ops->sw_params(pcm->op_arg, params);
if (err < 0)
return err;
pcm->period_step = params->period_step;
pcm->sleep_min = params->sleep_min;
pcm->avail_min = params->avail_min;
- pcm->xfer_align = params->xfer_align;
pcm->start_threshold = params->start_threshold;
pcm->stop_threshold = params->stop_threshold;
pcm->silence_threshold = params->silence_threshold;
snd_output_printf(out, " period_step : %d\n", pcm->period_step);
snd_output_printf(out, " sleep_min : %d\n", pcm->sleep_min);
snd_output_printf(out, " avail_min : %ld\n", pcm->avail_min);
- snd_output_printf(out, " xfer_align : %ld\n", pcm->xfer_align);
snd_output_printf(out, " start_threshold : %ld\n", pcm->start_threshold);
snd_output_printf(out, " stop_threshold : %ld\n", pcm->stop_threshold);
snd_output_printf(out, " silence_threshold: %ld\n", pcm->silence_threshold);
params->period_step = pcm->period_step;
params->sleep_min = pcm->sleep_min;
params->avail_min = pcm->avail_min;
- params->xfer_align = pcm->xfer_align;
+ params->xfer_align = 1;
params->start_threshold = pcm->start_threshold;
params->stop_threshold = pcm->stop_threshold;
params->silence_threshold = pcm->silence_threshold;
snd_output_printf(out, "period_step: %u\n", params->period_step);
snd_output_printf(out, "sleep_min: %u\n", params->sleep_min);
snd_output_printf(out, "avail_min: %lu\n", params->avail_min);
- snd_output_printf(out, "xfer_align: %lu\n", params->xfer_align);
snd_output_printf(out, "silence_threshold: %lu\n", params->silence_threshold);
snd_output_printf(out, "silence_size: %lu\n", params->silence_size);
snd_output_printf(out, "boundary: %lu\n", params->boundary);
/**
- * \brief Set xfer align inside a software configuration container
+ * \brief (DEPRECATED) Set xfer align inside a software configuration container
* \param pcm PCM handle
* \param params Software configuration container
* \param val Chunk size (frames are attempted to be transferred in chunks)
* \return 0 otherwise a negative error code
*/
#ifndef DOXYGEN
-int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, snd_pcm_uframes_t val ATTRIBUTE_UNUSED)
#else
int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
#endif
{
- assert(pcm && params);
- if (CHECK_SANITY(val % pcm->min_align)) {
- SNDMSG("xfer_align (%ld) is not aligned to min_align (%ld)", val, pcm->min_align);
- return -EINVAL;
- }
- params->xfer_align = val;
return 0;
}
/**
- * \brief Get xfer align from a software configuration container
+ * \brief (DEPRECATED) Get xfer align from a software configuration container
* \param params Software configuration container
* \param val returned chunk size (frames are attempted to be transferred in chunks)
* \return 0 otherwise a negative error code
*/
#ifndef DOXYGEN
-int INTERNAL(snd_pcm_sw_params_get_xfer_align)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+int INTERNAL(snd_pcm_sw_params_get_xfer_align)(const snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, snd_pcm_uframes_t *val)
#else
int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
#endif
{
- assert(params && val);
- *val = params->xfer_align;
+ *val = 1;
return 0;
}
-
/**
* \brief Set start threshold inside a software configuration container
* \param pcm PCM handle
if (size == 0)
return 0;
- if (size > pcm->xfer_align)
- size -= size % pcm->xfer_align;
switch (state) {
case SND_PCM_STATE_PREPARED:
err = avail;
goto _end;
}
- if (((snd_pcm_uframes_t)avail < pcm->avail_min && size > (snd_pcm_uframes_t)avail) ||
- (size >= pcm->xfer_align && (snd_pcm_uframes_t)avail < pcm->xfer_align)) {
-
+ if ((snd_pcm_uframes_t)avail < pcm->avail_min &&
+ size > (snd_pcm_uframes_t)avail) {
if (pcm->mode & SND_PCM_NONBLOCK) {
err = -EAGAIN;
goto _end;
goto _again;
}
- if ((snd_pcm_uframes_t) avail > pcm->xfer_align)
- avail -= avail % pcm->xfer_align;
frames = size;
if (frames > (snd_pcm_uframes_t) avail)
frames = avail;
if (size == 0)
return 0;
- if (size > pcm->xfer_align)
- size -= size % pcm->xfer_align;
switch (state) {
case SND_PCM_STATE_PREPARED:
}
if ((state == SND_PCM_STATE_RUNNING &&
(snd_pcm_uframes_t)avail < pcm->avail_min &&
- size > (snd_pcm_uframes_t)avail) ||
- (size >= pcm->xfer_align &&
- (snd_pcm_uframes_t)avail < pcm->xfer_align)) {
-
+ size > (snd_pcm_uframes_t)avail)) {
if (pcm->mode & SND_PCM_NONBLOCK) {
err = -EAGAIN;
goto _end;
break;
goto _again;
}
- if ((snd_pcm_uframes_t) avail > pcm->xfer_align)
- avail -= avail % pcm->xfer_align;
frames = size;
if (frames > (snd_pcm_uframes_t) avail)
frames = avail;
SNDERR("Unable to set avail min for %s: %s", s, snd_strerror(err));
return err;
}
- /* align all transfers to 1 sample */
- err = snd_pcm_sw_params_set_xfer_align(pcm, swparams, 1);
- if (err < 0) {
- SNDERR("Unable to set transfer align for %s: %s", s, snd_strerror(err));
- return err;
- }
/* write the parameters to the playback device */
err = snd_pcm_sw_params(pcm, swparams);
if (err < 0) {
snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
noise is nearest than this */
snd_pcm_uframes_t silence_size; /* Silence filling size */
- snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
snd_pcm_uframes_t boundary; /* pointers wrap point */
unsigned int info; /* Info for returned setup */
unsigned int msbits; /* used most significant bits */
int INTERNAL(snd_pcm_sw_params_get_sleep_min)(const snd_pcm_sw_params_t *params, unsigned int *val);
int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
int INTERNAL(snd_pcm_sw_params_get_avail_min)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
-int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
-int INTERNAL(snd_pcm_sw_params_get_xfer_align)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
int INTERNAL(snd_pcm_sw_params_get_start_threshold)(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val);
int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);