diff options
author | Michael Hohmuth <sideral@rockbox.org> | 2011-05-09 12:59:46 +0000 |
---|---|---|
committer | Michael Hohmuth <sideral@rockbox.org> | 2011-05-09 12:59:46 +0000 |
commit | 84301c1e2de731099222dee991af8ef957cfecc5 (patch) | |
tree | 22950555d0d400e6a7d377495ae7ca55eb751ed9 /apps/gui | |
parent | 9b7027232f2cab49e4854d56651388cf6c1461f0 (diff) | |
download | rockbox-84301c1e2de731099222dee991af8ef957cfecc5.tar.gz rockbox-84301c1e2de731099222dee991af8ef957cfecc5.zip |
FS#11931 part 1: Make fade in/out behavior more consistent across the
various causes of pause and unpause.
Patch by John Morris.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29844 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/wps.c | 27 | ||||
-rw-r--r-- | apps/gui/wps.h | 4 |
2 files changed, 23 insertions, 8 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 069df09c36..cf6ec2deb4 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -119,6 +119,23 @@ char* wps_default_skin(enum screen_type screen) | |||
119 | return skin_buf[screen]; | 119 | return skin_buf[screen]; |
120 | } | 120 | } |
121 | 121 | ||
122 | void pause_action(bool may_fade, bool updatewps) | ||
123 | { | ||
124 | int32_t newpos; | ||
125 | if (may_fade && global_settings.fade_on_stop) | ||
126 | fade(false, updatewps); | ||
127 | else | ||
128 | audio_pause(); | ||
129 | } | ||
130 | |||
131 | void unpause_action(bool may_fade, bool updatewps) | ||
132 | { | ||
133 | if (may_fade && global_settings.fade_on_stop) | ||
134 | fade(true, updatewps); | ||
135 | else | ||
136 | audio_resume(); | ||
137 | } | ||
138 | |||
122 | void fade(bool fade_in, bool updatewps) | 139 | void fade(bool fade_in, bool updatewps) |
123 | { | 140 | { |
124 | int fp_global_vol = global_settings.volume << 8; | 141 | int fp_global_vol = global_settings.volume << 8; |
@@ -667,18 +684,12 @@ void wps_do_playpause(bool updatewps) | |||
667 | if ( state->paused ) | 684 | if ( state->paused ) |
668 | { | 685 | { |
669 | state->paused = false; | 686 | state->paused = false; |
670 | if ( global_settings.fade_on_stop ) | 687 | unpause_action(true, updatewps); |
671 | fade(true, updatewps); | ||
672 | else | ||
673 | audio_resume(); | ||
674 | } | 688 | } |
675 | else | 689 | else |
676 | { | 690 | { |
677 | state->paused = true; | 691 | state->paused = true; |
678 | if ( global_settings.fade_on_stop ) | 692 | pause_action(true, updatewps); |
679 | fade(false, updatewps); | ||
680 | else | ||
681 | audio_pause(); | ||
682 | settings_save(); | 693 | settings_save(); |
683 | #if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) | 694 | #if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) |
684 | call_storage_idle_notifys(true); /* make sure resume info is saved */ | 695 | call_storage_idle_notifys(true); /* make sure resume info is saved */ |
diff --git a/apps/gui/wps.h b/apps/gui/wps.h index 7438f1ac7b..87a5a23487 100644 --- a/apps/gui/wps.h +++ b/apps/gui/wps.h | |||
@@ -30,6 +30,10 @@ void wps_data_load(enum screen_type, const char *, bool); | |||
30 | 30 | ||
31 | void gui_sync_wps_init(void) INIT_ATTR; | 31 | void gui_sync_wps_init(void) INIT_ATTR; |
32 | 32 | ||
33 | /* fade (if enabled) and pause the audio, optionally rewind a little */ | ||
34 | void pause_action(bool may_fade, bool updatewps); | ||
35 | void unpause_action(bool may_fade, bool updatewps); | ||
36 | |||
33 | /* fades the volume, e.g. on pause or stop */ | 37 | /* fades the volume, e.g. on pause or stop */ |
34 | void fade(bool fade_in, bool updatewps); | 38 | void fade(bool fade_in, bool updatewps); |
35 | 39 | ||