int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
-int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
-int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
-int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
-int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-
#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */
int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val);
-int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val);
-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_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
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));
+int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val) __attribute__((deprecated));
+int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val) __attribute__((deprecated));
+int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
/** \} */
modes are known. The mmap mode means that timestamp is taken
on every period time boundary.
-\par Minimal sleep
-
-This parameters means the minimum of ticks to sleep using a standalone
-timer (usually the system timer). The tick resolution can be obtained
-via the function #snd_pcm_hw_params_get_tick_time(). This
-function can be used to fine-tune the transfer acknowledge process. It could
-be useful especially when some hardware does not support small transfer
-periods.
-
\par Transfer align
The read / write transfers can be aligned to this sample count. The modulo
snd_interval_copy(¶ms->intervals[SND_PCM_HW_PARAM_BUFFER_TIME - SND_PCM_HW_PARAM_FIRST_INTERVAL], &pcm->buffer_time);
snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_BUFFER_SIZE - SND_PCM_HW_PARAM_FIRST_INTERVAL], pcm->buffer_size);
snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_BUFFER_BYTES - SND_PCM_HW_PARAM_FIRST_INTERVAL], (pcm->buffer_size * frame_bits) / 8);
- snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_TICK_TIME - SND_PCM_HW_PARAM_FIRST_INTERVAL], pcm->tick_time);
params->info = pcm->info;
params->msbits = pcm->msbits;
params->rate_num = pcm->rate_num;
return err;
pcm->tstamp_mode = params->tstamp_mode;
pcm->period_step = params->period_step;
- pcm->sleep_min = params->sleep_min;
pcm->avail_min = params->avail_min;
pcm->start_threshold = params->start_threshold;
pcm->stop_threshold = params->stop_threshold;
snd_output_printf(out, " buffer_size : %lu\n", pcm->buffer_size);
snd_output_printf(out, " period_size : %lu\n", pcm->period_size);
snd_output_printf(out, " period_time : %u\n", pcm->period_time);
- snd_output_printf(out, " tick_time : %u\n", pcm->tick_time);
return 0;
}
}
snd_output_printf(out, " tstamp_mode : %s\n", snd_pcm_tstamp_mode_name(pcm->tstamp_mode));
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, " start_threshold : %ld\n", pcm->start_threshold);
snd_output_printf(out, " stop_threshold : %ld\n", pcm->stop_threshold);
/**
- * \brief Extract tick time from a configuration space
+ * \brief (DEPRECATED) Extract tick time from a configuration space
* \param params Configuration space
* \param val Returned approximate tick duration in us
* \param dir Sub unit direction
* Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
*/
#ifndef DOXYGEN
-int INTERNAL(snd_pcm_hw_params_get_tick_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+int INTERNAL(snd_pcm_hw_params_get_tick_time)(const snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val, int *dir ATTRIBUTE_UNUSED)
#else
int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
#endif
{
- return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
+ *val = 0;
+ return 0;
}
/**
- * \brief Extract minimum tick time from a configuration space
+ * \brief (DEPRECATED) Extract minimum tick time from a configuration space
* \param params Configuration space
* \param val Returned approximate minimum tick duration in us
* \param dir Sub unit direction
* Exact value is <,=,> the returned one following dir (-1,0,1)
*/
#ifndef DOXYGEN
-int INTERNAL(snd_pcm_hw_params_get_tick_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+int INTERNAL(snd_pcm_hw_params_get_tick_time_min)(const snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val, int *dir ATTRIBUTE_UNUSED)
#else
int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
#endif
{
- return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
+ *val = 0;
+ return 0;
}
/**
- * \brief Extract maximum tick time from a configuration space
+ * \brief (DEPRECATED) Extract maximum tick time from a configuration space
* \param params Configuration space
* \param val Returned approximate maximum tick duration in us
* \param dir Sub unit direction
* Exact value is <,=,> the returned one following dir (-1,0,1)
*/
#ifndef DOXYGEN
-int INTERNAL(snd_pcm_hw_params_get_tick_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+int INTERNAL(snd_pcm_hw_params_get_tick_time_max)(const snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val, int *dir ATTRIBUTE_UNUSED)
#else
int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
#endif
{
- return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
+ *val = 0;
+ return 0;
}
/**
- * \brief Verify if a tick time is available inside a configuration space for a PCM
+ * \brief (DEPRECATED) Verify if a tick time is available inside a configuration space for a PCM
* \param pcm PCM handle
* \param params Configuration space
* \param val approximate tick duration in us
*
* Wanted exact value is <,=,> val following dir (-1,0,1)
*/
-int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
+int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int val, int dir ATTRIBUTE_UNUSED)
{
- return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
+ return val ? -EINVAL : 0;
}
/**
- * \brief Restrict a configuration space to contain only one tick time
+ * \brief (DEPRECATED) Restrict a configuration space to contain only one tick time
* \param pcm PCM handle
* \param params Configuration space
* \param val approximate tick duration in us
*
* Wanted exact value is <,=,> val following dir (-1,0,1)
*/
-int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
+int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int dir ATTRIBUTE_UNUSED)
{
- return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
+ return 0;
}
/**
- * \brief Restrict a configuration space with a minimum tick time
+ * \brief (DEPRECATED) Restrict a configuration space with a minimum tick time
* \param pcm PCM handle
* \param params Configuration space
* \param val approximate minimum tick duration in us (on return filled with actual minimum)
*
* Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)
*/
-int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val ATTRIBUTE_UNUSED, int *dir ATTRIBUTE_UNUSED)
{
- return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
+ return 0;
}
/**
- * \brief Restrict a configuration space with a maximum tick time
+ * \brief (DEPRECATED) Restrict a configuration space with a maximum tick time
* \param pcm PCM handle
* \param params Configuration space
* \param val approximate maximum tick duration in us (on return filled with actual maximum)
*
* Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)
*/
-int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val ATTRIBUTE_UNUSED, int *dir ATTRIBUTE_UNUSED)
{
- return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
+ return 0;
}
/**
- * \brief Restrict a configuration space to have tick times in a given range
+ * \brief (DEPRECATED) Restrict a configuration space to have tick times in a given range
* \param pcm PCM handle
* \param params Configuration space
* \param min approximate minimum tick duration in us (on return filled with actual minimum)
*
* Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)
*/
-int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
+int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *min ATTRIBUTE_UNUSED, int *mindir ATTRIBUTE_UNUSED, unsigned int *max ATTRIBUTE_UNUSED, int *maxdir ATTRIBUTE_UNUSED)
{
- return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, min, mindir, max, maxdir);
+ return 0;
}
/**
- * \brief Restrict a configuration space to have tick time nearest to a target
+ * \brief (DEPRECATED) Restrict a configuration space to have tick time nearest to a target
* \param pcm PCM handle
* \param params Configuration space
* \param val approximate target tick duration in us / returned chosen approximate target tick duration in us
* target/chosen exact value is <,=,> val following dir (-1,0,1)
*/
#ifndef DOXYGEN
-int INTERNAL(snd_pcm_hw_params_set_tick_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+int INTERNAL(snd_pcm_hw_params_set_tick_time_near)(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val ATTRIBUTE_UNUSED, int *dir ATTRIBUTE_UNUSED)
#else
int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
#endif
{
- return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
+ return 0;
}
/**
- * \brief Restrict a configuration space to contain only its minimum tick time
+ * \brief (DEPRECATED) Restrict a configuration space to contain only its minimum tick time
* \param pcm PCM handle
* \param params Configuration space
* \param val Returned approximate minimum tick duration in us
* Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
*/
#ifndef DOXYGEN
-int INTERNAL(snd_pcm_hw_params_set_tick_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+int INTERNAL(snd_pcm_hw_params_set_tick_time_first)(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val ATTRIBUTE_UNUSED, int *dir ATTRIBUTE_UNUSED)
#else
int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
#endif
{
- return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
+ return 0;
}
/**
- * \brief Restrict a configuration space to contain only its maximum tick time
+ * \brief (DEPRECATED) Restrict a configuration space to contain only its maximum tick time
* \param pcm PCM handle
* \param params Configuration space
* \param val Returned approximate maximum tick duration in us
* Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
*/
#ifndef DOXYGEN
-int INTERNAL(snd_pcm_hw_params_set_tick_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+int INTERNAL(snd_pcm_hw_params_set_tick_time_last)(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val ATTRIBUTE_UNUSED, int *dir ATTRIBUTE_UNUSED)
#else
int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
#endif
{
- return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
+ return 0;
}
/**
}
params->tstamp_mode = pcm->tstamp_mode;
params->period_step = pcm->period_step;
- params->sleep_min = pcm->sleep_min;
+ params->sleep_min = 0;
params->avail_min = pcm->avail_min;
params->xfer_align = 1;
params->start_threshold = pcm->start_threshold;
snd_output_printf(out, "xrun_mode: %s\n", snd_pcm_xrun_mode_name(snd_pcm_sw_params_get_xrun_mode(params)));
snd_output_printf(out, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(params->tstamp_mode));
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, "silence_threshold: %lu\n", params->silence_threshold);
snd_output_printf(out, "silence_size: %lu\n", params->silence_size);
}
/**
- * \brief Set minimum number of ticks to sleep inside a software configuration container
+ * \brief (DEPRECATED) Set minimum number of ticks to sleep inside a software configuration container
* \param pcm PCM handle
* \param params Software configuration container
* \param val Minimum ticks to sleep or 0 to disable the use of tick timer
* \return 0 otherwise a negative error code
*/
#ifndef DOXYGEN
-int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, unsigned int val)
+int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED)
#else
int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val)
#endif
{
- assert(pcm && params);
- params->sleep_min = val;
return 0;
}
/**
- * \brief Get minimum numbers of ticks to sleep from a software configuration container
+ * \brief (DEPRECATED) Get minimum numbers of ticks to sleep from a software configuration container
* \param params Software configuration container
* \param val returned minimum number of ticks to sleep or 0 if tick timer is disabled
* \return 0 otherwise a negative error code
*/
#ifndef DOXYGEN
-int INTERNAL(snd_pcm_sw_params_get_sleep_min)(const snd_pcm_sw_params_t *params, unsigned int *val)
+int INTERNAL(snd_pcm_sw_params_get_sleep_min)(const snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val)
#else
int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val)
#endif
{
- assert(params && val);
- *val = params->sleep_min;
+ *val = 0;
return 0;
}
* sound cards can only accept power of 2 frame counts (i.e. 512,
* 1024, 2048). You cannot use this as a high resolution timer - it
* is limited to how often the sound card hardware raises an
- * interrupt. Note that you can greatly improve the reponses using
- * \ref snd_pcm_sw_params_set_sleep_min where another timing source
- * is used.
+ * interrupt.
*/
#ifndef DOXYGEN
int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
snd_pcm_uframes_t frames;
snd_pcm_sframes_t avail;
_again:
- if (pcm->sleep_min == 0 && state == SND_PCM_STATE_RUNNING) {
+ if (state == SND_PCM_STATE_RUNNING) {
err = snd_pcm_hwsync(pcm);
if (err < 0)
goto _end;
snd_pcm_uframes_t frames;
snd_pcm_sframes_t avail;
_again:
- if (pcm->sleep_min == 0 && state == SND_PCM_STATE_RUNNING) {
+ if (state == SND_PCM_STATE_RUNNING) {
err = snd_pcm_hwsync(pcm);
if (err < 0)
goto _end;
int latency_max = 2048; /* in frames / 2 */
int loop_sec = 30; /* seconds */
int block = 0; /* block mode */
-int tick_time = 0; /* disabled, otherwise in us */
-int tick_time_ok = 0;
int use_poll = 0;
int resample = 1;
unsigned long loop_limit;
{
int err;
snd_pcm_uframes_t val;
- unsigned int sleep_min = 0;
err = snd_pcm_hw_params(handle, params);
if (err < 0) {
printf("Unable to set start threshold mode for %s: %s\n", id, snd_strerror(err));
return err;
}
- tick_time_ok = 0;
- if (tick_time > 0) {
- unsigned int time, ttime;
- snd_pcm_hw_params_get_period_time(params, &time, NULL);
- snd_pcm_hw_params_get_tick_time(params, &ttime, NULL);
- if (time < ttime) {
- printf("Skipping to set minimal sleep: period time < tick time\n");
- } else if (ttime <= 0) {
- printf("Skipping to set minimal sleep: tick time <= 0 (%i)\n", ttime);
- } else {
- sleep_min = tick_time / ttime;
- if (sleep_min <= 0)
- sleep_min = 1;
- err = snd_pcm_sw_params_set_sleep_min(handle, swparams, sleep_min);
- if (err < 0) {
- printf("Unable to set minimal sleep %i for %s: %s\n", sleep_min, id, snd_strerror(err));
- return err;
- }
- tick_time_ok = sleep_min * ttime;
- }
- }
if (!block)
val = 4;
else
snd_pcm_hw_params_get_period_size(params, &val, NULL);
- if (tick_time_ok > 0)
- val = 16;
err = snd_pcm_sw_params_set_avail_min(handle, swparams, val);
if (err < 0) {
printf("Unable to set avail min for %s: %s\n", id, snd_strerror(err));
"-E,--period period size in frames\n"
"-s,--seconds duration of test in seconds\n"
"-b,--block block mode\n"
-"-t,--time maximal tick time in us\n"
"-p,--poll use poll (wait for event - reduces CPU usage)\n"
"-e,--effect apply an effect (bandpass filter sweep)\n"
);
{"period", 1, NULL, 'E'},
{"seconds", 1, NULL, 's'},
{"block", 0, NULL, 'b'},
- {"time", 1, NULL, 't'},
{"poll", 0, NULL, 'p'},
{"effect", 0, NULL, 'e'},
{NULL, 0, NULL, 0},
morehelp = 0;
while (1) {
int c;
- if ((c = getopt_long(argc, argv, "hP:C:m:M:F:f:c:r:s:bt:pen", long_option, NULL)) < 0)
+ if ((c = getopt_long(argc, argv, "hP:C:m:M:F:f:c:r:s:bpen", long_option, NULL)) < 0)
break;
switch (c) {
case 'h':
case 'b':
block = 1;
break;
- case 't':
- tick_time = atoi(optarg);
- tick_time = tick_time < 0 ? 0 : tick_time;
- break;
case 'p':
use_poll = 1;
break;
printf("Playback device is %s\n", pdevice);
printf("Capture device is %s\n", cdevice);
printf("Parameters are %iHz, %s, %i channels, %s mode\n", rate, snd_pcm_format_name(format), channels, block ? "blocking" : "non-blocking");
- printf("Wanted tick time: %ius, poll mode: %s\n", tick_time, use_poll ? "yes" : "no");
+ printf("Poll mode: %s\n", use_poll ? "yes" : "no");
printf("Loop limit is %li frames, minimum latency = %i, maximum latency = %i\n", loop_limit, latency_min * 2, latency_max * 2);
if ((err = snd_pcm_open(&phandle, pdevice, SND_PCM_STREAM_PLAYBACK, block ? 0 : SND_PCM_NONBLOCK)) < 0) {
if (setparams(phandle, chandle, &latency) < 0)
break;
showlatency(latency);
- if (tick_time_ok)
- printf("Using tick time %ius\n", tick_time_ok);
if ((err = snd_pcm_link(chandle, phandle)) < 0) {
printf("Streams link error: %s\n", snd_strerror(err));
exit(0);