mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
ctl: add an API to set dimension levels to element information
In a former commit, 'struct snd_ctl_elem_info' is used as a 'container' to transfer extra fields of element information for APIs to add an element set. The extra fields should be filled in advance of call of the APIs. Currently, dimension level is in the extra fields and no APIs to set it. This commit adds an API to set dimension level to the information structure. This API is expected to be used in advance of usage of APIs to add an element set, for nothing others. When the information structure is extended in future, then the similar APIs shall be added for the new feature. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
f9e6011255
commit
16812b70da
2 changed files with 32 additions and 0 deletions
|
|
@ -2457,6 +2457,36 @@ int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int
|
|||
}
|
||||
use_default_symbol_version(__snd_ctl_elem_info_get_dimension, snd_ctl_elem_info_get_dimension, ALSA_0.9.3);
|
||||
|
||||
/**
|
||||
* \brief Set width to a specified dimension level of given element information.
|
||||
* \param info Information of an element.
|
||||
* \param dimension Dimension width for each level by member unit.
|
||||
* \return Zero on success, otherwise a negative error code.
|
||||
*
|
||||
* \par Errors:
|
||||
* <dl>
|
||||
* <dt>-EINVAL
|
||||
* <dd>Invalid arguments are given as parameters.
|
||||
* </dl>
|
||||
*/
|
||||
int snd_ctl_elem_info_set_dimension(snd_ctl_elem_info_t *info,
|
||||
const int dimension[4])
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (info == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(info->dimen.d); i++) {
|
||||
if (dimension[i] < 0)
|
||||
return -EINVAL;
|
||||
|
||||
info->dimen.d[i] = dimension[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get CTL element identifier of a CTL element id/info
|
||||
* \param obj CTL element id/info
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue