dB conversion functions from control TLV information
More...
|
int | snd_tlv_parse_dB_info (unsigned int *tlv, unsigned int tlv_size, unsigned int **db_tlvp) |
| Parse TLV stream and retrieve dB information.
|
|
int | snd_tlv_get_dB_range (unsigned int *tlv, long rangemin, long rangemax, long *min, long *max) |
| Get the dB min/max values.
|
|
int | snd_tlv_convert_to_dB (unsigned int *tlv, long rangemin, long rangemax, long volume, long *db_gain) |
| Convert the given raw volume value to a dB gain.
|
|
int | snd_tlv_convert_from_dB (unsigned int *tlv, long rangemin, long rangemax, long db_gain, long *value, int xdir) |
| Convert from dB gain to the corresponding raw value.
|
|
int | snd_ctl_get_dB_range (snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, long *min, long *max) |
| Get the dB min/max values on the given control element.
|
|
int | snd_ctl_convert_to_dB (snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, long volume, long *db_gain) |
| Convert the volume value to dB on the given control element.
|
|
int | snd_ctl_convert_from_dB (snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, long db_gain, long *value, int xdir) |
| Convert from dB gain to the raw volume value on the given control element.
|
|
dB conversion functions from control TLV information
- Author
- Takashi Iwai tiwai.nosp@m.@sus.nosp@m.e.de
- Date
- 2007
◆ snd_ctl_convert_from_dB()
int snd_ctl_convert_from_dB |
( |
snd_ctl_t * | ctl, |
|
|
const snd_ctl_elem_id_t * | id, |
|
|
long | db_gain, |
|
|
long * | value, |
|
|
int | xdir ) |
Convert from dB gain to the raw volume value on the given control element.
- Parameters
-
ctl | the control handler |
id | the element id |
db_gain | the dB gain to convert (in 0.01dB unit) |
value | the pointer to store the converted raw volume value |
xdir | the direction for round-up. The value is round up when this is positive. |
- Returns
- 0 if successful, or a negative error code
◆ snd_ctl_convert_to_dB()
int snd_ctl_convert_to_dB |
( |
snd_ctl_t * | ctl, |
|
|
const snd_ctl_elem_id_t * | id, |
|
|
long | volume, |
|
|
long * | db_gain ) |
Convert the volume value to dB on the given control element.
- Parameters
-
ctl | the control handler |
id | the element id |
volume | the raw volume value to convert |
db_gain | the dB gain (in 0.01dB unit) |
- Returns
- 0 if successful, or a negative error code
◆ snd_ctl_get_dB_range()
int snd_ctl_get_dB_range |
( |
snd_ctl_t * | ctl, |
|
|
const snd_ctl_elem_id_t * | id, |
|
|
long * | min, |
|
|
long * | max ) |
Get the dB min/max values on the given control element.
- Parameters
-
ctl | the control handler |
id | the element id |
min | the pointer to store the minimum dB value (in 0.01dB unit) |
max | the pointer to store the maximum dB value (in 0.01dB unit) |
- Returns
- 0 if successful, or a negative error code
◆ snd_tlv_convert_from_dB()
int snd_tlv_convert_from_dB |
( |
unsigned int * | tlv, |
|
|
long | rangemin, |
|
|
long | rangemax, |
|
|
long | db_gain, |
|
|
long * | value, |
|
|
int | xdir ) |
Convert from dB gain to the corresponding raw value.
- Parameters
-
tlv | the TLV source returned by snd_tlv_parse_dB_info() |
rangemin | the minimum value of the raw volume |
rangemax | the maximum value of the raw volume |
db_gain | the dB gain to convert (in 0.01dB unit) |
value | the pointer to store the converted raw volume value |
xdir | the direction for round-up. The value is round up when this is positive. A negative value means round down. Zero means round-up to nearest. |
- Returns
- 0 if successful, or a negative error code
◆ snd_tlv_convert_to_dB()
int snd_tlv_convert_to_dB |
( |
unsigned int * | tlv, |
|
|
long | rangemin, |
|
|
long | rangemax, |
|
|
long | volume, |
|
|
long * | db_gain ) |
Convert the given raw volume value to a dB gain.
- Parameters
-
tlv | the TLV source returned by snd_tlv_parse_dB_info() |
rangemin | the minimum value of the raw volume |
rangemax | the maximum value of the raw volume |
volume | the raw volume value to convert |
db_gain | the dB gain (in 0.01dB unit) |
- Returns
- 0 if successful, or a negative error code
◆ snd_tlv_get_dB_range()
int snd_tlv_get_dB_range |
( |
unsigned int * | tlv, |
|
|
long | rangemin, |
|
|
long | rangemax, |
|
|
long * | min, |
|
|
long * | max ) |
Get the dB min/max values.
- Parameters
-
tlv | the TLV source returned by snd_tlv_parse_dB_info() |
rangemin | the minimum value of the raw volume |
rangemax | the maximum value of the raw volume |
min | the pointer to store the minimum dB value (in 0.01dB unit) |
max | the pointer to store the maximum dB value (in 0.01dB unit) |
- Returns
- 0 if successful, or a negative error code
◆ snd_tlv_parse_dB_info()
int snd_tlv_parse_dB_info |
( |
unsigned int * | tlv, |
|
|
unsigned int | tlv_size, |
|
|
unsigned int ** | db_tlvp ) |
Parse TLV stream and retrieve dB information.
- Parameters
-
tlv | the TLV source |
tlv_size | the byte size of TLV source |
db_tlvp | the pointer stored the dB TLV information |
- Returns
- The byte size of dB TLV information if found in the given TLV source, -ENOENT if not found, or a negative error code in case of an error.
This function parses the given TLV source and stores the TLV start point if the TLV information regarding dB conversion is found. The stored TLV pointer can be passed to the conversion functions snd_tlv_convert_to_dB(), snd_tlv_convert_from_dB() and snd_tlv_get_dB_range().