Remove sleep_min and tick

The sleep_min and tick are removed features from the kernel.
This patch cleans the corresponding part in alsa-lib.
This commit is contained in:
Takashi Iwai 2008-01-08 18:36:18 +01:00
parent cf15e49d84
commit 679cea4125
9 changed files with 64 additions and 144 deletions

View file

@ -669,18 +669,6 @@ int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *
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);
@ -709,8 +697,6 @@ int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uf
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);
@ -1103,6 +1089,19 @@ int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
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));
/** \} */

View file

@ -345,15 +345,6 @@ The timestamp mode specifies, if timestamps are activated. Currently, only
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
@ -792,7 +783,6 @@ int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
snd_interval_copy(&params->intervals[SND_PCM_HW_PARAM_BUFFER_TIME - SND_PCM_HW_PARAM_FIRST_INTERVAL], &pcm->buffer_time);
snd_interval_set_value(&params->intervals[SND_PCM_HW_PARAM_BUFFER_SIZE - SND_PCM_HW_PARAM_FIRST_INTERVAL], pcm->buffer_size);
snd_interval_set_value(&params->intervals[SND_PCM_HW_PARAM_BUFFER_BYTES - SND_PCM_HW_PARAM_FIRST_INTERVAL], (pcm->buffer_size * frame_bits) / 8);
snd_interval_set_value(&params->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;
@ -887,7 +877,6 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
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;
@ -1779,7 +1768,6 @@ int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out)
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;
}
@ -1799,7 +1787,6 @@ int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out)
}
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);
@ -5059,7 +5046,7 @@ int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *
/**
* \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
@ -5068,16 +5055,17 @@ int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *
* 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
@ -5086,16 +5074,17 @@ int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned
* 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
@ -5104,16 +5093,17 @@ int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsig
* 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
@ -5122,13 +5112,13 @@ int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsig
*
* 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
@ -5137,13 +5127,13 @@ int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params
*
* 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)
@ -5152,13 +5142,13 @@ int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
*
* 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)
@ -5167,13 +5157,13 @@ int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *par
*
* 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)
@ -5184,13 +5174,13 @@ int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *par
*
* 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
@ -5200,16 +5190,16 @@ int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *
* 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
@ -5219,16 +5209,16 @@ int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *pa
* 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
@ -5238,12 +5228,12 @@ int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
* 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;
}
/**
@ -5290,7 +5280,7 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
}
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;
@ -5313,7 +5303,6 @@ int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out)
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);
@ -5509,37 +5498,34 @@ int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm
}
/**
* \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;
}
@ -5555,9 +5541,7 @@ int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned
* 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)
@ -6365,7 +6349,7 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_
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;
@ -6434,7 +6418,7 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
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;

View file

@ -817,10 +817,8 @@ static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
COPY_SLAVE(period_size);
COPY_SLAVE(period_time);
COPY_SLAVE(periods);
COPY_SLAVE(tick_time);
COPY_SLAVE(tstamp_mode);
COPY_SLAVE(period_step);
COPY_SLAVE(sleep_min);
COPY_SLAVE(avail_min);
COPY_SLAVE(start_threshold);
COPY_SLAVE(stop_threshold);
@ -1170,10 +1168,8 @@ static void copy_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
COPY_SLAVE(period_size);
COPY_SLAVE(period_time);
COPY_SLAVE(periods);
COPY_SLAVE(tick_time);
COPY_SLAVE(tstamp_mode);
COPY_SLAVE(period_step);
COPY_SLAVE(sleep_min);
COPY_SLAVE(avail_min);
COPY_SLAVE(start_threshold);
COPY_SLAVE(stop_threshold);

View file

@ -85,10 +85,10 @@ typedef struct {
unsigned int period_size;
unsigned int period_time;
snd_interval_t periods;
unsigned int tick_time;
unsigned int tick_time; /* not used */
snd_pcm_tstamp_t tstamp_mode;
unsigned int period_step;
unsigned int sleep_min;
unsigned int sleep_min; /* not used */
unsigned int avail_min;
unsigned int start_threshold;
unsigned int stop_threshold;

View file

@ -294,7 +294,6 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
int fd = hw->fd, err;
if ((snd_pcm_tstamp_t) params->tstamp_mode == pcm->tstamp_mode &&
params->period_step == pcm->period_step &&
params->sleep_min == pcm->sleep_min &&
params->start_threshold == pcm->start_threshold &&
params->stop_threshold == pcm->stop_threshold &&
params->silence_threshold == pcm->silence_threshold &&

View file

@ -186,10 +186,8 @@ struct _snd_pcm {
snd_pcm_uframes_t period_size;
unsigned int period_time; /* period duration */
snd_interval_t periods;
unsigned int tick_time;
snd_pcm_tstamp_t tstamp_mode; /* timestamp mode */
unsigned int period_step;
unsigned int sleep_min;
snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
snd_pcm_uframes_t start_threshold;
snd_pcm_uframes_t stop_threshold;
@ -806,22 +804,8 @@ int INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(snd_pcm_t *pcm, snd_pcm_hw_
int INTERNAL(snd_pcm_hw_params_set_buffer_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int INTERNAL(snd_pcm_hw_params_set_buffer_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
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_min)(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, 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 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_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_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
int INTERNAL(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 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_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);

View file

@ -2309,7 +2309,6 @@ int _snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
INTERNAL(snd_pcm_hw_params_get_period_time)(params, &pcm->period_time, 0);
INTERNAL(snd_pcm_hw_params_get_period_size)(params, &pcm->period_size, 0);
INTERNAL(snd_pcm_hw_params_get_buffer_size)(params, &pcm->buffer_size);
INTERNAL(snd_pcm_hw_params_get_tick_time)(params, &pcm->tick_time, 0);
pcm->sample_bits = snd_pcm_format_physical_width(pcm->format);
pcm->frame_bits = pcm->sample_bits * pcm->channels;
fb = pcm->frame_bits;

View file

@ -539,8 +539,7 @@ static int snd_pcm_share_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
SND_PCM_HW_PARBIT_PERIOD_TIME |
SND_PCM_HW_PARBIT_BUFFER_SIZE |
SND_PCM_HW_PARBIT_BUFFER_TIME |
SND_PCM_HW_PARBIT_PERIODS |
SND_PCM_HW_PARBIT_TICK_TIME);
SND_PCM_HW_PARBIT_PERIODS);
const snd_pcm_access_mask_t *access_mask = snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS);
if (!snd_pcm_access_mask_test(access_mask, SND_PCM_ACCESS_RW_INTERLEAVED) &&
!snd_pcm_access_mask_test(access_mask, SND_PCM_ACCESS_RW_NONINTERLEAVED) &&
@ -570,8 +569,7 @@ static int snd_pcm_share_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
SND_PCM_HW_PARBIT_PERIOD_TIME |
SND_PCM_HW_PARBIT_BUFFER_SIZE |
SND_PCM_HW_PARBIT_BUFFER_TIME |
SND_PCM_HW_PARBIT_PERIODS |
SND_PCM_HW_PARBIT_TICK_TIME);
SND_PCM_HW_PARBIT_PERIODS);
snd_pcm_access_mask_t access_mask;
const snd_pcm_access_mask_t *saccess_mask = snd_pcm_hw_param_get_mask(sparams, SND_PCM_HW_PARAM_ACCESS);
snd_pcm_access_mask_any(&access_mask);
@ -639,11 +637,6 @@ static int snd_pcm_share_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
goto _err;
err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_BUFFER_SIZE,
spcm->buffer_size, 0);
if (err < 0)
goto _err;
err = _snd_pcm_hw_param_set_minmax(params, SND_PCM_HW_PARAM_TICK_TIME,
spcm->tick_time, 0,
spcm->tick_time, 1);
_err:
if (err < 0) {
SNDERR("slave is already running with incompatible setup");

View file

@ -48,8 +48,6 @@ int latency_min = 32; /* in frames / 2 */
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;
@ -136,7 +134,6 @@ int setparams_set(snd_pcm_t *handle,
{
int err;
snd_pcm_uframes_t val;
unsigned int sleep_min = 0;
err = snd_pcm_hw_params(handle, params);
if (err < 0) {
@ -153,33 +150,10 @@ int setparams_set(snd_pcm_t *handle,
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));
@ -465,7 +439,6 @@ void help(void)
"-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"
);
@ -502,7 +475,6 @@ int main(int argc, char *argv[])
{"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},
@ -518,7 +490,7 @@ int main(int argc, char *argv[])
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':
@ -570,10 +542,6 @@ int main(int argc, char *argv[])
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;
@ -605,7 +573,7 @@ int main(int argc, char *argv[])
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) {
@ -638,8 +606,6 @@ int main(int argc, char *argv[])
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);