summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-06-23 02:45:55 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-06-23 02:45:55 +0000
commit4982b87b9cfc98a40a6fb7b837632f86e483390f (patch)
treed87f52238187fb2187d35cad86085e1f50cbd336
parent0ac9839ffce2024d1d9d0598c77a8860fa708a5d (diff)
downloadrockbox-4982b87b9cfc98a40a6fb7b837632f86e483390f.tar.gz
rockbox-4982b87b9cfc98a40a6fb7b837632f86e483390f.zip
fix FS#9098 - fade was updating the WPS sometimes when it shouldnt. also minor code policing.. use true/false instead of 1/0 for calls to fade()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17757 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c12
-rw-r--r--apps/gui/gwps-common.h2
-rw-r--r--apps/gui/gwps.c6
-rw-r--r--apps/misc.c6
4 files changed, 14 insertions, 12 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index b90c216f58..f5ef604498 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -83,7 +83,7 @@ static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force)
83 83
84/* fades the volume */ 84/* fades the volume */
85bool wps_fading_out = false; 85bool wps_fading_out = false;
86void fade(bool fade_in) 86void fade(bool fade_in, bool updatewps)
87{ 87{
88 int fp_global_vol = global_settings.volume << 8; 88 int fp_global_vol = global_settings.volume << 8;
89 int fp_min_vol = sound_min(SOUND_VOLUME) << 8; 89 int fp_min_vol = sound_min(SOUND_VOLUME) << 8;
@@ -103,8 +103,9 @@ void fade(bool fade_in)
103 while (fp_volume < fp_global_vol - fp_step) { 103 while (fp_volume < fp_global_vol - fp_step) {
104 fp_volume += fp_step; 104 fp_volume += fp_step;
105 sound_set_volume(fp_volume >> 8); 105 sound_set_volume(fp_volume >> 8);
106 FOR_NB_SCREENS(i) 106 if (updatewps)
107 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC); 107 FOR_NB_SCREENS(i)
108 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
108 sleep(1); 109 sleep(1);
109 } 110 }
110 sound_set_volume(global_settings.volume); 111 sound_set_volume(global_settings.volume);
@@ -116,8 +117,9 @@ void fade(bool fade_in)
116 while (fp_volume > fp_min_vol + fp_step) { 117 while (fp_volume > fp_min_vol + fp_step) {
117 fp_volume -= fp_step; 118 fp_volume -= fp_step;
118 sound_set_volume(fp_volume >> 8); 119 sound_set_volume(fp_volume >> 8);
119 FOR_NB_SCREENS(i) 120 if (updatewps)
120 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC); 121 FOR_NB_SCREENS(i)
122 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
121 sleep(1); 123 sleep(1);
122 } 124 }
123 audio_pause(); 125 audio_pause();
diff --git a/apps/gui/gwps-common.h b/apps/gui/gwps-common.h
index 3119755502..ccdc31b5a9 100644
--- a/apps/gui/gwps-common.h
+++ b/apps/gui/gwps-common.h
@@ -23,7 +23,7 @@
23 23
24#include "gwps.h" 24#include "gwps.h"
25 25
26void fade(bool fade_in); 26void fade(bool fade_in, bool updatewps);
27bool gui_wps_display(void); 27bool gui_wps_display(void);
28bool update_onvol_change(struct gui_wps * gwps); 28bool update_onvol_change(struct gui_wps * gwps);
29bool update(struct gui_wps *gwps); 29bool update(struct gui_wps *gwps);
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 26d31c65bd..5426c937c0 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -326,7 +326,7 @@ long gui_wps_show(void)
326 { 326 {
327 wps_state.paused = false; 327 wps_state.paused = false;
328 if ( global_settings.fade_on_stop ) 328 if ( global_settings.fade_on_stop )
329 fade(1); 329 fade(true, true);
330 else 330 else
331 audio_resume(); 331 audio_resume();
332 } 332 }
@@ -334,7 +334,7 @@ long gui_wps_show(void)
334 { 334 {
335 wps_state.paused = true; 335 wps_state.paused = true;
336 if ( global_settings.fade_on_stop ) 336 if ( global_settings.fade_on_stop )
337 fade(0); 337 fade(false, true);
338 else 338 else
339 audio_pause(); 339 audio_pause();
340 settings_save(); 340 settings_save();
@@ -712,7 +712,7 @@ long gui_wps_show(void)
712 status_set_audio(false); 712 status_set_audio(false);
713#endif 713#endif
714 if (global_settings.fade_on_stop) 714 if (global_settings.fade_on_stop)
715 fade(0); 715 fade(false, true);
716 716
717 FOR_NB_SCREENS(i) 717 FOR_NB_SCREENS(i)
718 gui_wps[i].display->stop_scroll(); 718 gui_wps[i].display->stop_scroll();
diff --git a/apps/misc.c b/apps/misc.c
index 9df6637656..167f7efbd9 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -697,7 +697,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
697 if (global_settings.fade_on_stop 697 if (global_settings.fade_on_stop
698 && (audio_stat & AUDIO_STATUS_PLAY)) 698 && (audio_stat & AUDIO_STATUS_PLAY))
699 { 699 {
700 fade(0); 700 fade(false, false);
701 } 701 }
702 702
703 if (batt_safe) /* do not save on critical battery */ 703 if (batt_safe) /* do not save on critical battery */
@@ -774,7 +774,7 @@ bool list_stop_handler(void)
774 if (!global_settings.party_mode) 774 if (!global_settings.party_mode)
775 { 775 {
776 if (global_settings.fade_on_stop) 776 if (global_settings.fade_on_stop)
777 fade(0); 777 fade(false, false);
778 bookmark_autobookmark(); 778 bookmark_autobookmark();
779 audio_stop(); 779 audio_stop();
780 ret = true; /* bookmarking can make a refresh necessary */ 780 ret = true; /* bookmarking can make a refresh necessary */
@@ -840,7 +840,7 @@ static void car_adapter_mode_processing(bool inserted)
840 !(audio_status() & AUDIO_STATUS_PAUSE)) 840 !(audio_status() & AUDIO_STATUS_PAUSE))
841 { 841 {
842 if (global_settings.fade_on_stop) 842 if (global_settings.fade_on_stop)
843 fade(0); 843 fade(false, false);
844 else 844 else
845 audio_pause(); 845 audio_pause();
846 } 846 }