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
This commit is contained in:
parent
9b7027232f
commit
84301c1e2d
4 changed files with 31 additions and 18 deletions
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
17
apps/misc.c
17
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)
|
||||
|
|
|
@ -594,6 +594,7 @@ Sergiu Rotaru
|
|||
Noé Lojkine
|
||||
Ophir Lojkine
|
||||
Stephan Grossklass
|
||||
John Morris
|
||||
|
||||
The libmad team
|
||||
The wavpack team
|
||||
|
|
Loading…
Reference in a new issue