summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2007-05-30 17:57:32 +0000
committerNils Wallménius <nils@rockbox.org>2007-05-30 17:57:32 +0000
commitf46657ec5a23e9ff440b603fbf8ffd55e6aa4e84 (patch)
treed6bb995283343f4a8e9830827c475e16f3bdc646 /apps/misc.c
parentdfb071d92ece27951dd2b3e17629ec61cd619460 (diff)
Move the setvol wrapper function to misc.c and use it in more places instead of doing the same checks everywhere
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13524 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 3010104cd3..0113825ac4 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -47,6 +47,7 @@
#include "splash.h"
#include "tagcache.h"
#include "scrobbler.h"
+#include "sound.h"
#ifdef HAVE_MMC
#include "ata_mmc.h"
#endif
@@ -969,3 +970,17 @@ void check_bootfile(bool do_rolo)
}
#endif
#endif
+
+/* check range, set volume and save settings */
+void setvol(void)
+{
+ const int min_vol = sound_min(SOUND_VOLUME);
+ const int max_vol = sound_max(SOUND_VOLUME);
+ if (global_settings.volume < min_vol)
+ global_settings.volume = min_vol;
+ if (global_settings.volume > max_vol)
+ global_settings.volume = max_vol;
+ sound_set_volume(global_settings.volume);
+ settings_save();
+}
+