mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-12-16 08:56:42 -05:00
Added snd_pcm_sw_params_get_boundary() function.
Implemented refine function in dmix.
This commit is contained in:
parent
073dff1ba1
commit
7c5e5f5728
3 changed files with 41 additions and 21 deletions
|
|
@ -790,6 +790,7 @@ size_t snd_pcm_sw_params_sizeof(void);
|
||||||
int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr);
|
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_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);
|
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
|
#ifndef ALSA_LIBRARY_BUILD
|
||||||
#ifdef ALSA_PCM_NEW_SW_PARAMS_API
|
#ifdef ALSA_PCM_NEW_SW_PARAMS_API
|
||||||
|
|
|
||||||
|
|
@ -1700,7 +1700,7 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
|
||||||
#ifndef PIC
|
#ifndef PIC
|
||||||
extern void *snd_pcm_open_symbols(void);
|
extern void *snd_pcm_open_symbols(void);
|
||||||
#endif
|
#endif
|
||||||
void *h;
|
void *h = NULL;
|
||||||
if (snd_config_get_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
char *val;
|
char *val;
|
||||||
id = NULL;
|
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;
|
*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
|
* \brief Get boundary for ring pointers from a software configuration container
|
||||||
* \param params Software configuration container
|
* \param params Software configuration container
|
||||||
* \param val Returned boundary in frames
|
* \param val Returned boundary in frames
|
||||||
|
|
|
||||||
|
|
@ -453,10 +453,47 @@ static int snd_pcm_dmix_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
||||||
return 0;
|
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)
|
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_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<<SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) |
|
||||||
|
(1<<SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED) |
|
||||||
|
(1<<SNDRV_PCM_ACCESS_RW_INTERLEAVED) |
|
||||||
|
(1<<SNDRV_PCM_ACCESS_RW_NONINTERLEAVED),
|
||||||
|
0, 0, 0 } };
|
||||||
|
|
||||||
|
snd_mask_refine(hw_param_mask(params, SND_PCM_HW_PARAM_ACCESS), &access);
|
||||||
|
snd_mask_refine_set(hw_param_mask(params, SND_PCM_HW_PARAM_FORMAT),
|
||||||
|
snd_mask_value(hw_param_mask(hw_params, SND_PCM_HW_PARAM_FORMAT)));
|
||||||
|
//snd_mask_none(hw_param_mask(params, SND_PCM_HW_PARAM_SUBFORMAT));
|
||||||
|
snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_CHANNELS),
|
||||||
|
snd_interval_value(hw_param_interval(hw_params, SND_PCM_HW_PARAM_CHANNELS)));
|
||||||
|
snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_RATE),
|
||||||
|
snd_interval_value(hw_param_interval(hw_params, SND_PCM_HW_PARAM_RATE)));
|
||||||
|
snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_BUFFER_SIZE),
|
||||||
|
snd_interval_value(hw_param_interval(hw_params, SND_PCM_HW_PARAM_BUFFER_SIZE)));
|
||||||
|
snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_BUFFER_TIME),
|
||||||
|
snd_interval_value(hw_param_interval(hw_params, SND_PCM_HW_PARAM_BUFFER_TIME)));
|
||||||
|
snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_PERIOD_SIZE),
|
||||||
|
snd_interval_value(hw_param_interval(hw_params, SND_PCM_HW_PARAM_PERIOD_SIZE)));
|
||||||
|
snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_PERIOD_TIME),
|
||||||
|
snd_interval_value(hw_param_interval(hw_params, SND_PCM_HW_PARAM_PERIOD_TIME)));
|
||||||
|
snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_PERIODS),
|
||||||
|
snd_interval_value(hw_param_interval(hw_params, SND_PCM_HW_PARAM_PERIODS)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue