1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jonathan Gordon 2008-06-23 02:45:55 +00:00
parent 0ac9839ffc
commit 4982b87b9c
4 changed files with 14 additions and 12 deletions

View file

@ -83,7 +83,7 @@ static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force)
/* fades the volume */ /* fades the volume */
bool wps_fading_out = false; bool wps_fading_out = false;
void fade(bool fade_in) void fade(bool fade_in, bool updatewps)
{ {
int fp_global_vol = global_settings.volume << 8; int fp_global_vol = global_settings.volume << 8;
int fp_min_vol = sound_min(SOUND_VOLUME) << 8; int fp_min_vol = sound_min(SOUND_VOLUME) << 8;
@ -103,6 +103,7 @@ void fade(bool fade_in)
while (fp_volume < fp_global_vol - fp_step) { while (fp_volume < fp_global_vol - fp_step) {
fp_volume += fp_step; fp_volume += fp_step;
sound_set_volume(fp_volume >> 8); sound_set_volume(fp_volume >> 8);
if (updatewps)
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC); gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
sleep(1); sleep(1);
@ -116,6 +117,7 @@ void fade(bool fade_in)
while (fp_volume > fp_min_vol + fp_step) { while (fp_volume > fp_min_vol + fp_step) {
fp_volume -= fp_step; fp_volume -= fp_step;
sound_set_volume(fp_volume >> 8); sound_set_volume(fp_volume >> 8);
if (updatewps)
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC); gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
sleep(1); sleep(1);

View file

@ -23,7 +23,7 @@
#include "gwps.h" #include "gwps.h"
void fade(bool fade_in); void fade(bool fade_in, bool updatewps);
bool gui_wps_display(void); bool gui_wps_display(void);
bool update_onvol_change(struct gui_wps * gwps); bool update_onvol_change(struct gui_wps * gwps);
bool update(struct gui_wps *gwps); bool update(struct gui_wps *gwps);

View file

@ -326,7 +326,7 @@ long gui_wps_show(void)
{ {
wps_state.paused = false; wps_state.paused = false;
if ( global_settings.fade_on_stop ) if ( global_settings.fade_on_stop )
fade(1); fade(true, true);
else else
audio_resume(); audio_resume();
} }
@ -334,7 +334,7 @@ long gui_wps_show(void)
{ {
wps_state.paused = true; wps_state.paused = true;
if ( global_settings.fade_on_stop ) if ( global_settings.fade_on_stop )
fade(0); fade(false, true);
else else
audio_pause(); audio_pause();
settings_save(); settings_save();
@ -712,7 +712,7 @@ long gui_wps_show(void)
status_set_audio(false); status_set_audio(false);
#endif #endif
if (global_settings.fade_on_stop) if (global_settings.fade_on_stop)
fade(0); fade(false, true);
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
gui_wps[i].display->stop_scroll(); gui_wps[i].display->stop_scroll();

View file

@ -697,7 +697,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
if (global_settings.fade_on_stop if (global_settings.fade_on_stop
&& (audio_stat & AUDIO_STATUS_PLAY)) && (audio_stat & AUDIO_STATUS_PLAY))
{ {
fade(0); fade(false, false);
} }
if (batt_safe) /* do not save on critical battery */ if (batt_safe) /* do not save on critical battery */
@ -774,7 +774,7 @@ bool list_stop_handler(void)
if (!global_settings.party_mode) if (!global_settings.party_mode)
{ {
if (global_settings.fade_on_stop) if (global_settings.fade_on_stop)
fade(0); fade(false, false);
bookmark_autobookmark(); bookmark_autobookmark();
audio_stop(); audio_stop();
ret = true; /* bookmarking can make a refresh necessary */ ret = true; /* bookmarking can make a refresh necessary */
@ -840,7 +840,7 @@ static void car_adapter_mode_processing(bool inserted)
!(audio_status() & AUDIO_STATUS_PAUSE)) !(audio_status() & AUDIO_STATUS_PAUSE))
{ {
if (global_settings.fade_on_stop) if (global_settings.fade_on_stop)
fade(0); fade(false, false);
else else
audio_pause(); audio_pause();
} }