From 7c5e5f5728a59bcf332be5d80b6a30c4725a32e5 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 5 Feb 2003 21:26:14 +0000 Subject: [PATCH] Added snd_pcm_sw_params_get_boundary() function. Implemented refine function in dmix. --- include/pcm.h | 1 + src/pcm/pcm.c | 22 ++-------------------- src/pcm/pcm_dmix.c | 39 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/include/pcm.h b/include/pcm.h index 052f230b..880c749d 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -790,6 +790,7 @@ size_t snd_pcm_sw_params_sizeof(void); int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr); void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj); void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src); +int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); #ifndef ALSA_LIBRARY_BUILD #ifdef ALSA_PCM_NEW_SW_PARAMS_API diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index b0a894cd..cc09e85a 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -1700,7 +1700,7 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, #ifndef PIC extern void *snd_pcm_open_symbols(void); #endif - void *h; + void *h = NULL; if (snd_config_get_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) { char *val; id = NULL; @@ -4988,25 +4988,7 @@ void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *dst = *src; } -/** - * \brief Set boundary for ring pointers inside a software configuration container - * \param pcm PCM handle - * \param params Software configuration container - * \param val boundary in frames - * \return 0 otherwise a negative error code - */ -#ifndef DOXYGEN -int snd_pcm_sw_params_set_boundary(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val) -#else -int snd_pcm_sw_params_set_boundary(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val) -#endif -{ - assert(pcm && params); - params->boundary = val; - return 0; -} - -/** +/* * \brief Get boundary for ring pointers from a software configuration container * \param params Software configuration container * \param val Returned boundary in frames diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index 9770134d..a19b19f1 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -453,10 +453,47 @@ static int snd_pcm_dmix_info(snd_pcm_t *pcm, snd_pcm_info_t * info) return 0; } +static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params, + snd_pcm_hw_param_t var) +{ + return ¶ms->masks[var - SND_PCM_HW_PARAM_FIRST_MASK]; +} + +static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params, + snd_pcm_hw_param_t var) +{ + return ¶ms->intervals[var - SND_PCM_HW_PARAM_FIRST_INTERVAL]; +} + static int snd_pcm_dmix_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) { snd_pcm_dmix_t *dmix = pcm->private_data; - //snd_interval_refine_set( + snd_pcm_hw_params_t *hw_params = &dmix->shmptr->hw_params; + static snd_mask_t access = { .bits = { + (1<