summaryrefslogtreecommitdiff
path: root/apps/misc.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-11-22 19:19:01 +0000
committerAidan MacDonald <amachronic@protonmail.com>2023-01-22 15:43:00 -0500
commitdc839639620352c5fa9b63db6679126ec5bcfba8 (patch)
treec551d2e6586b0439003a8c0bba66e0d349cc680d /apps/misc.h
parent66519000f47cfb5c58be68ab2335b7cbc0bce35b (diff)
downloadrockbox-dc839639620352c5fa9b63db6679126ec5bcfba8.tar.gz
rockbox-dc839639620352c5fa9b63db6679126ec5bcfba8.zip
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
Diffstat (limited to 'apps/misc.h')
-rw-r--r--apps/misc.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/misc.h b/apps/misc.h
index 403a8c53ac..72b8735c8a 100644
--- a/apps/misc.h
+++ b/apps/misc.h
@@ -238,4 +238,12 @@ int core_load_bmp(const char *filename, struct bitmap *bm, const int bmformat,
238 ssize_t *buf_reqd, struct buflib_callbacks *ops); 238 ssize_t *buf_reqd, struct buflib_callbacks *ops);
239#endif 239#endif
240 240
241/* Convert a volume (in tenth dB) in the range [min_vol, max_vol]
242 * to a normalized linear value in the range [0, max_norm]. */
243long to_normalized_volume(long vol, long min_vol, long max_vol, long max_norm);
244
245/* Inverse of to_normalized_volume(), returns the volume in tenth dB
246 * for the given normalized volume. */
247long from_normalized_volume(long norm, long min_vol, long max_vol, long max_norm);
248
241#endif /* MISC_H */ 249#endif /* MISC_H */