summaryrefslogtreecommitdiff
path: root/apps/plugins/mikmod/mikmod.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-11-22 04:10:35 +0000
committerAidan MacDonald <amachronic@protonmail.com>2023-01-22 21:19:57 +0000
commit5b27e2255a8bbb8645f089b8e721343bba5bd396 (patch)
treebd29ddf9d2a0c07b1541ad4bace7ff4aedcb3c14 /apps/plugins/mikmod/mikmod.c
parent15c4447b6681cadba960aa9275592049afa96893 (diff)
downloadrockbox-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/plugins/mikmod/mikmod.c')
-rw-r--r--apps/plugins/mikmod/mikmod.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/apps/plugins/mikmod/mikmod.c b/apps/plugins/mikmod/mikmod.c
index 6622b5fdb6..65633c0ad1 100644
--- a/apps/plugins/mikmod/mikmod.c
+++ b/apps/plugins/mikmod/mikmod.c
@@ -710,7 +710,6 @@ static void mm_errorhandler(void)
710 710
711static int playfile(char* filename) 711static int playfile(char* filename)
712{ 712{
713 int vol = 0;
714 int button; 713 int button;
715 int retval = PLUGIN_OK; 714 int retval = PLUGIN_OK;
716 bool changingpos = false; 715 bool changingpos = false;
@@ -789,13 +788,8 @@ static int playfile(char* filename)
789 } 788 }
790 break; 789 break;
791 } 790 }
792 vol = rb->global_settings->volume; 791
793 if (vol < rb->sound_max(SOUND_VOLUME)) 792 rb->adjust_volume(1);
794 {
795 vol++;
796 rb->sound_set(SOUND_VOLUME, vol);
797 rb->global_settings->volume = vol;
798 }
799 break; 793 break;
800 794
801 case ACTION_WPS_VOLDOWN: 795 case ACTION_WPS_VOLDOWN:
@@ -808,13 +802,8 @@ static int playfile(char* filename)
808 } 802 }
809 break; 803 break;
810 } 804 }
811 vol = rb->global_settings->volume; 805
812 if (vol > rb->sound_min(SOUND_VOLUME)) 806 rb->adjust_volume(-1);
813 {
814 vol--;
815 rb->sound_set(SOUND_VOLUME, vol);
816 rb->global_settings->volume = vol;
817 }
818 break; 807 break;
819 808
820 case ACTION_WPS_SKIPPREV: 809 case ACTION_WPS_SKIPPREV: