summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hohmuth <sideral@rockbox.org>2011-05-09 12:59:46 +0000
committerMichael Hohmuth <sideral@rockbox.org>2011-05-09 12:59:46 +0000
commit84301c1e2de731099222dee991af8ef957cfecc5 (patch)
tree22950555d0d400e6a7d377495ae7ca55eb751ed9
parent9b7027232f2cab49e4854d56651388cf6c1461f0 (diff)
downloadrockbox-84301c1e2de731099222dee991af8ef957cfecc5.zip
rockbox-84301c1e2de731099222dee991af8ef957cfecc5.tar.gz
rockbox-84301c1e2de731099222dee991af8ef957cfecc5.tar.bz2
rockbox-84301c1e2de731099222dee991af8ef957cfecc5.tar.xz
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
-rw-r--r--apps/gui/wps.c27
-rw-r--r--apps/gui/wps.h4
-rw-r--r--apps/misc.c17
-rw-r--r--docs/CREDITS1
4 files changed, 31 insertions, 18 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 069df09..cf6ec2d 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -119,6 +119,23 @@ char* wps_default_skin(enum screen_type screen)
return skin_buf[screen];
}
+void pause_action(bool may_fade, bool updatewps)
+{
+ int32_t newpos;
+ if (may_fade && global_settings.fade_on_stop)
+ fade(false, updatewps);
+ else
+ audio_pause();
+}
+
+void unpause_action(bool may_fade, bool updatewps)
+{
+ if (may_fade && global_settings.fade_on_stop)
+ fade(true, updatewps);
+ else
+ audio_resume();
+}
+
void fade(bool fade_in, bool updatewps)
{
int fp_global_vol = global_settings.volume << 8;
@@ -667,18 +684,12 @@ void wps_do_playpause(bool updatewps)
if ( state->paused )
{
state->paused = false;
- if ( global_settings.fade_on_stop )
- fade(true, updatewps);
- else
- audio_resume();
+ unpause_action(true, updatewps);
}
else
{
state->paused = true;
- if ( global_settings.fade_on_stop )
- fade(false, updatewps);
- else
- audio_pause();
+ pause_action(true, updatewps);
settings_save();
#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF)
call_storage_idle_notifys(true); /* make sure resume info is saved */
diff --git a/apps/gui/wps.h b/apps/gui/wps.h
index 7438f1a..87a5a23 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);
void gui_sync_wps_init(void) INIT_ATTR;
+/* fade (if enabled) and pause the audio, optionally rewind a little */
+void pause_action(bool may_fade, bool updatewps);
+void unpause_action(bool may_fade, bool updatewps);
+
/* fades the volume, e.g. on pause or stop */
void fade(bool fade_in, bool updatewps);
diff --git a/apps/misc.c b/apps/misc.c
index 12d0c8d..d72d7a4 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -454,10 +454,7 @@ static void car_adapter_mode_processing(bool inserted)
if ((audio_status() & AUDIO_STATUS_PLAY) &&
!(audio_status() & AUDIO_STATUS_PAUSE))
{
- if (global_settings.fade_on_stop)
- fade(false, false);
- else
- audio_pause();
+ pause_action(true, true);
}
waiting_to_resume_play = false;
}
@@ -495,18 +492,18 @@ static void unplug_change(bool inserted)
int audio_stat = audio_status();
if (inserted)
{
+ backlight_on();
if ((audio_stat & AUDIO_STATUS_PLAY) &&
headphone_caused_pause &&
global_settings.unplug_mode > 1 )
- audio_resume();
- backlight_on();
+ unpause_action(true, true);
headphone_caused_pause = false;
} else {
if ((audio_stat & AUDIO_STATUS_PLAY) &&
!(audio_stat & AUDIO_STATUS_PAUSE))
{
headphone_caused_pause = true;
- audio_pause();
+ pause_action(false, false);
if (global_settings.unplug_rw)
{
@@ -584,7 +581,7 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
return SYS_CHARGER_DISCONNECTED;
case SYS_CAR_ADAPTER_RESUME:
- audio_resume();
+ unpause_action(true, true);
return SYS_CAR_ADAPTER_RESUME;
#endif
#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
@@ -661,9 +658,9 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
if (status & AUDIO_STATUS_PLAY)
{
if (status & AUDIO_STATUS_PAUSE)
- audio_resume();
+ unpause_action(true, true);
else
- audio_pause();
+ pause_action(true, true);
}
else
if (playlist_resume() != -1)
diff --git a/docs/CREDITS b/docs/CREDITS
index c1a611e..ab2a061 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -594,6 +594,7 @@ Sergiu Rotaru
NoƩ Lojkine
Ophir Lojkine
Stephan Grossklass
+John Morris
The libmad team
The wavpack team