diff options
-rw-r--r-- | apps/gui/gwps-common.c | 10 | ||||
-rw-r--r-- | apps/gui/gwps-common.h | 1 | ||||
-rw-r--r-- | apps/gui/list.c | 8 | ||||
-rw-r--r-- | apps/misc.c | 15 | ||||
-rw-r--r-- | apps/misc.h | 3 | ||||
-rw-r--r-- | apps/recorder/radio.c | 10 | ||||
-rw-r--r-- | apps/recorder/recording.c | 12 |
7 files changed, 25 insertions, 34 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 2cdb92d964..2e8f7841c0 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -126,16 +126,6 @@ void fade(bool fade_in) | |||
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | /* set volume */ | ||
130 | void setvol(void) | ||
131 | { | ||
132 | if (global_settings.volume < sound_min(SOUND_VOLUME)) | ||
133 | global_settings.volume = sound_min(SOUND_VOLUME); | ||
134 | if (global_settings.volume > sound_max(SOUND_VOLUME)) | ||
135 | global_settings.volume = sound_max(SOUND_VOLUME); | ||
136 | sound_set_volume(global_settings.volume); | ||
137 | settings_save(); | ||
138 | } | ||
139 | /* return true if screen restore is needed | 129 | /* return true if screen restore is needed |
140 | return false otherwise | 130 | return false otherwise |
141 | */ | 131 | */ |
diff --git a/apps/gui/gwps-common.h b/apps/gui/gwps-common.h index 1203113be1..76555c1c06 100644 --- a/apps/gui/gwps-common.h +++ b/apps/gui/gwps-common.h | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | void fade(bool fade_in); | 26 | void fade(bool fade_in); |
27 | bool gui_wps_display(void); | 27 | bool gui_wps_display(void); |
28 | void setvol(void); | ||
29 | bool update_onvol_change(struct gui_wps * gwps); | 28 | bool update_onvol_change(struct gui_wps * gwps); |
30 | bool update(struct gui_wps *gwps); | 29 | bool update(struct gui_wps *gwps); |
31 | bool ffwd_rew(int button); | 30 | bool ffwd_rew(int button); |
diff --git a/apps/gui/list.c b/apps/gui/list.c index 4a72c3e505..f4cb607260 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -876,13 +876,7 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, | |||
876 | /* up two because the falthrough brings it down one */ | 876 | /* up two because the falthrough brings it down one */ |
877 | case ACTION_LIST_VOLDOWN: | 877 | case ACTION_LIST_VOLDOWN: |
878 | global_settings.volume--; | 878 | global_settings.volume--; |
879 | 879 | setvol(); | |
880 | if (global_settings.volume < sound_min(SOUND_VOLUME)) | ||
881 | global_settings.volume = sound_min(SOUND_VOLUME); | ||
882 | if (global_settings.volume > sound_max(SOUND_VOLUME)) | ||
883 | global_settings.volume = sound_max(SOUND_VOLUME); | ||
884 | sound_set_volume(global_settings.volume); | ||
885 | settings_save(); | ||
886 | return button; | 880 | return button; |
887 | #endif | 881 | #endif |
888 | case ACTION_STD_PREV: | 882 | case ACTION_STD_PREV: |
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 @@ | |||
47 | #include "splash.h" | 47 | #include "splash.h" |
48 | #include "tagcache.h" | 48 | #include "tagcache.h" |
49 | #include "scrobbler.h" | 49 | #include "scrobbler.h" |
50 | #include "sound.h" | ||
50 | #ifdef HAVE_MMC | 51 | #ifdef HAVE_MMC |
51 | #include "ata_mmc.h" | 52 | #include "ata_mmc.h" |
52 | #endif | 53 | #endif |
@@ -969,3 +970,17 @@ void check_bootfile(bool do_rolo) | |||
969 | } | 970 | } |
970 | #endif | 971 | #endif |
971 | #endif | 972 | #endif |
973 | |||
974 | /* check range, set volume and save settings */ | ||
975 | void setvol(void) | ||
976 | { | ||
977 | const int min_vol = sound_min(SOUND_VOLUME); | ||
978 | const int max_vol = sound_max(SOUND_VOLUME); | ||
979 | if (global_settings.volume < min_vol) | ||
980 | global_settings.volume = min_vol; | ||
981 | if (global_settings.volume > max_vol) | ||
982 | global_settings.volume = max_vol; | ||
983 | sound_set_volume(global_settings.volume); | ||
984 | settings_save(); | ||
985 | } | ||
986 | |||
diff --git a/apps/misc.h b/apps/misc.h index 959674fefd..926170ebe5 100644 --- a/apps/misc.h +++ b/apps/misc.h | |||
@@ -106,4 +106,7 @@ void check_bootfile(bool do_rolo); | |||
106 | #endif | 106 | #endif |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | /* check range, set volume and save settings */ | ||
110 | void setvol(void); | ||
111 | |||
109 | #endif /* MISC_H */ | 112 | #endif /* MISC_H */ |
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 79febc9039..575b887c2f 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -657,21 +657,15 @@ int radio_screen(void) | |||
657 | case ACTION_SETTINGS_INC: | 657 | case ACTION_SETTINGS_INC: |
658 | case ACTION_SETTINGS_INCREPEAT: | 658 | case ACTION_SETTINGS_INCREPEAT: |
659 | global_settings.volume++; | 659 | global_settings.volume++; |
660 | if(global_settings.volume > sound_max(SOUND_VOLUME)) | 660 | setvol(); |
661 | global_settings.volume = sound_max(SOUND_VOLUME); | ||
662 | sound_set_volume(global_settings.volume); | ||
663 | update_screen = true; | 661 | update_screen = true; |
664 | settings_save(); | ||
665 | break; | 662 | break; |
666 | 663 | ||
667 | case ACTION_SETTINGS_DEC: | 664 | case ACTION_SETTINGS_DEC: |
668 | case ACTION_SETTINGS_DECREPEAT: | 665 | case ACTION_SETTINGS_DECREPEAT: |
669 | global_settings.volume--; | 666 | global_settings.volume--; |
670 | if(global_settings.volume < sound_min(SOUND_VOLUME)) | 667 | setvol(); |
671 | global_settings.volume = sound_min(SOUND_VOLUME); | ||
672 | sound_set_volume(global_settings.volume); | ||
673 | update_screen = true; | 668 | update_screen = true; |
674 | settings_save(); | ||
675 | break; | 669 | break; |
676 | 670 | ||
677 | case ACTION_FM_PLAY: | 671 | case ACTION_FM_PLAY: |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 0323ae12ff..d7bea6f898 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -1052,10 +1052,8 @@ bool recording_screen(bool no_source) | |||
1052 | switch(cursor) | 1052 | switch(cursor) |
1053 | { | 1053 | { |
1054 | case 0: | 1054 | case 0: |
1055 | if(global_settings.volume < | 1055 | global_settings.volume++; |
1056 | sound_max(SOUND_VOLUME)) | 1056 | setvol(); |
1057 | global_settings.volume++; | ||
1058 | sound_set_volume(global_settings.volume); | ||
1059 | break; | 1057 | break; |
1060 | case 1: | 1058 | case 1: |
1061 | if(global_settings.rec_source == AUDIO_SRC_MIC) | 1059 | if(global_settings.rec_source == AUDIO_SRC_MIC) |
@@ -1120,10 +1118,8 @@ bool recording_screen(bool no_source) | |||
1120 | switch(cursor) | 1118 | switch(cursor) |
1121 | { | 1119 | { |
1122 | case 0: | 1120 | case 0: |
1123 | if(global_settings.volume > | 1121 | global_settings.volume--; |
1124 | sound_min(SOUND_VOLUME)) | 1122 | setvol(); |
1125 | global_settings.volume--; | ||
1126 | sound_set_volume(global_settings.volume); | ||
1127 | break; | 1123 | break; |
1128 | case 1: | 1124 | case 1: |
1129 | if(global_settings.rec_source == AUDIO_SRC_MIC) | 1125 | if(global_settings.rec_source == AUDIO_SRC_MIC) |