diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-11-22 04:10:35 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2023-01-22 21:19:57 +0000 |
commit | 5b27e2255a8bbb8645f089b8e721343bba5bd396 (patch) | |
tree | bd29ddf9d2a0c07b1541ad4bace7ff4aedcb3c14 /apps/misc.h | |
parent | 15c4447b6681cadba960aa9275592049afa96893 (diff) | |
download | rockbox-5b27e2255a8bbb8645f089b8e721343bba5bd396.tar.gz rockbox-5b27e2255a8bbb8645f089b8e721343bba5bd396.zip |
Add perceptual volume adjustment
The perceived loudness change of a change in volume depends
on the listening volume: at high volumes a 1 dB increment is
noticeable, but at low volumes a larger increment is needed
to get a comparable change in loudness.
Perceptual volume adjustment accounts for this fact, and
divides the hardware volume range into a number of steps.
Each step changes the dB volume by a variable amount, with
most of the steps concentrated at higher volumes. This
makes it possible to sweep over the entire hardware volume
range quickly, without losing the ability to finely adjust
the volume at normal listening levels.
Use "Volume Adjustment Mode" in the system settings menu
to select perceptual volume mode. The number of steps used
is controlled by "Number of Volume Steps". (Number of steps
has no effect in direct adjustment mode.)
It's still possible to set a specific dB volume level from
the sound settings menu when perceptual volume is enabled,
and perceptual volume does not affect the volume displayed
by themes.
Change-Id: I6f91fd3f7c5e2d323a914e47b5653033e92b4b3b
Diffstat (limited to 'apps/misc.h')
-rw-r--r-- | apps/misc.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/misc.h b/apps/misc.h index 72b8735c8a..b7a9a5c42c 100644 --- a/apps/misc.h +++ b/apps/misc.h | |||
@@ -137,8 +137,22 @@ void check_bootfile(bool do_rolo); | |||
137 | #endif | 137 | #endif |
138 | #endif | 138 | #endif |
139 | 139 | ||
140 | enum volume_adjust_mode | ||
141 | { | ||
142 | VOLUME_ADJUST_DIRECT, /* adjust in units of the volume step size */ | ||
143 | VOLUME_ADJUST_PERCEPTUAL, /* adjust using perceptual steps */ | ||
144 | }; | ||
145 | |||
146 | /* min/max values for global_settings.volume_adjust_norm_steps */ | ||
147 | #define MIN_NORM_VOLUME_STEPS 10 | ||
148 | #define MAX_NORM_VOLUME_STEPS 100 | ||
149 | |||
140 | /* check range, set volume and save settings */ | 150 | /* check range, set volume and save settings */ |
141 | void setvol(void); | 151 | void setvol(void); |
152 | void set_normalized_volume(int vol); | ||
153 | int get_normalized_volume(void); | ||
154 | void adjust_volume(int steps); | ||
155 | void adjust_volume_ex(int steps, enum volume_adjust_mode mode); | ||
142 | 156 | ||
143 | #ifdef HAVE_LCD_COLOR | 157 | #ifdef HAVE_LCD_COLOR |
144 | int hex_to_rgb(const char* hex, int* color); | 158 | int hex_to_rgb(const char* hex, int* color); |