mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Add helpers for converting to/from normalized (perceptual) volume
These routines were taken from alsamixer and converted to fixed point for Rockbox. Change-Id: I64e8bf08da02b1e6e3ef10fdc78254bf8e87ff20
This commit is contained in:
parent
66519000f4
commit
dc83963962
3 changed files with 132 additions and 0 deletions
|
@ -238,4 +238,12 @@ int core_load_bmp(const char *filename, struct bitmap *bm, const int bmformat,
|
|||
ssize_t *buf_reqd, struct buflib_callbacks *ops);
|
||||
#endif
|
||||
|
||||
/* Convert a volume (in tenth dB) in the range [min_vol, max_vol]
|
||||
* to a normalized linear value in the range [0, max_norm]. */
|
||||
long to_normalized_volume(long vol, long min_vol, long max_vol, long max_norm);
|
||||
|
||||
/* Inverse of to_normalized_volume(), returns the volume in tenth dB
|
||||
* for the given normalized volume. */
|
||||
long from_normalized_volume(long norm, long min_vol, long max_vol, long max_norm);
|
||||
|
||||
#endif /* MISC_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue