Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

volume: Apply limits inside sound_set_volume()

This way all paths to setting the volume respect the limits, instead
of only callers of setvol(), which only applies to (some?) interactive
paths.

Change-Id: Ia8ece22aafcb04df33021071cb933eaeb1146502

+12 -12
+2 -12
apps/misc.c
··· 866 866 #endif 867 867 #endif 868 868 869 - /* check range, set volume and save settings */ 869 + /* set volume and save settings */ 870 870 void setvol(void) 871 871 { 872 - const int min_vol = sound_min(SOUND_VOLUME); 873 - const int max_vol = sound_max(SOUND_VOLUME); 874 - int volume = global_status.volume; 875 - if (volume < min_vol) 876 - volume = min_vol; 877 - if (volume > max_vol) 878 - volume = max_vol; 879 - if (volume > global_settings.volume_limit) 880 - volume = global_settings.volume_limit; 881 - 882 - sound_set_volume(volume); 872 + sound_set_volume(global_status.volume); 883 873 global_status.last_volume_change = current_tick; 884 874 status_save(false); 885 875 }
+10
firmware/sound.c
··· 312 312 if (!audio_is_initialized) 313 313 return; 314 314 315 + /* Apply limits */ 316 + const int min_vol = sound_min(SOUND_VOLUME); 317 + const int max_vol = sound_max(SOUND_VOLUME); 318 + if (value < min_vol) 319 + value = min_vol; 320 + if (value > max_vol) 321 + value = max_vol; 322 + if (value > global_settings.volume_limit) 323 + value = global_settings.volume_limit; 324 + 315 325 #ifndef BOOTLOADER 316 326 global_status.volume = value; 317 327 #endif