Added snd_ctl_elem_info_get_dimensions() and snd_ctl_elem_info_get_dimension() functions.

This commit is contained in:
Jaroslav Kysela 2003-04-01 13:58:09 +00:00
parent 2978d18323
commit 368918b453
5 changed files with 67 additions and 11 deletions

View file

@ -1543,7 +1543,7 @@ int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj)
}
/**
* \brief Get info about values passing policy from a CTL element id/info
* \brief (DEPRECATED) Get info about values passing policy from a CTL element value
* \param obj CTL element id/info
* \return 0 if element value need to be passed by contents, 1 if need to be passed with a pointer
*/
@ -1552,6 +1552,7 @@ int snd_ctl_elem_info_is_indirect(const snd_ctl_elem_info_t *obj)
assert(obj);
return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_INDIRECT);
}
link_warning(snd_ctl_elem_info_is_indirect, "Warning: snd_ctl_elem_info_is_indirect is deprecated, do not use it");
/**
* \brief Get owner of a locked element
@ -1682,6 +1683,49 @@ const char *snd_ctl_elem_info_get_item_name(const snd_ctl_elem_info_t *obj)
return obj->value.enumerated.name;
}
/**
* \brief Get count of dimensions for given element
* \param obj CTL element id/info
* \return zero value if no dimensions are defined, otherwise positive value with count of dimensions
*/
#ifndef DOXYGEN
int INTERNAL(snd_ctl_elem_info_get_dimensions)(const snd_ctl_elem_info_t *obj)
#else
int snd_ctl_elem_info_get_dimensions(const snd_ctl_elem_info_t *obj)
#endif
{
int i;
assert(obj);
if (obj->access & SNDRV_CTL_ELEM_ACCESS_DINDIRECT)
return 0; /* FIXME: implement indirect access as well */
for (i = 3; i >= 0; i++)
if (obj->dimen.d[0])
break;
return i >= 0 ? i + 1 : 0;
}
use_default_symbol_version(__snd_ctl_elem_info_get_dimensions, snd_ctl_elem_info_get_dimensions, ALSA_0.9.3);
/**
* \brief Get specified of dimension width for given element
* \param obj CTL element id/info
* \return zero value if no dimension width is defined, otherwise positive value with with of specified dimension
*/
#ifndef DOXYGEN
int INTERNAL(snd_ctl_elem_info_get_dimension)(const snd_ctl_elem_info_t *obj, unsigned int idx)
#else
int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int idx)
#endif
{
assert(obj);
if (obj->access & SNDRV_CTL_ELEM_ACCESS_DINDIRECT)
return 0; /* FIXME: implement indirect access as well */
if (idx >= 3)
return 0;
return obj->dimen.d[0];
}
use_default_symbol_version(__snd_ctl_elem_info_get_dimension, snd_ctl_elem_info_get_dimension, ALSA_0.9.3);
/**
* \brief Get CTL element identifier of a CTL element id/info
* \param obj CTL element id/info

View file

@ -39,7 +39,7 @@ const char *_snd_module_control_hw = "";
#endif
#define SNDRV_FILE_CONTROL "/dev/snd/controlC%i"
#define SNDRV_CTL_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)
#define SNDRV_CTL_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 2)
typedef struct {
int card;