FS#11931 part 2: Allow a short rewind when playback is paused. Patch
by John Morris. This patch adds an option to rewind the current track by a few seconds when it is paused, irrespective of what has caused the pause. This is useful for audiobooks and podcasts to allow the listener to recall where the track was left off. The patch subsumes the existing rewind-on-headphone-unplug feature and extends it to all invocations of pause: play/pause button (or touch area), headphone removal, and power-supply unplug in car-adapter mode. It also subsumes FS#9448 (rewind on fade). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29876 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0a070c5420
commit
5aec3c2400
6 changed files with 36 additions and 26 deletions
|
@ -125,6 +125,17 @@ void pause_action(bool may_fade, bool updatewps)
|
|||
fade(false, updatewps);
|
||||
else
|
||||
audio_pause();
|
||||
|
||||
if (global_settings.pause_rewind) {
|
||||
long newpos;
|
||||
|
||||
#if (CONFIG_CODEC == SWCODEC)
|
||||
audio_pre_ff_rewind();
|
||||
#endif
|
||||
newpos = audio_current_track()->elapsed
|
||||
- global_settings.pause_rewind * 1000;
|
||||
audio_ff_rewind(newpos > 0 ? newpos : 0);
|
||||
}
|
||||
}
|
||||
|
||||
void unpause_action(bool may_fade, bool updatewps)
|
||||
|
|
|
@ -2069,19 +2069,16 @@
|
|||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_HEADPHONE_UNPLUG_RW
|
||||
desc: in pause_phones_menu.
|
||||
desc: deprecated
|
||||
user: core
|
||||
<source>
|
||||
*: none
|
||||
headphone_detection: "Duration to Rewind"
|
||||
*: ""
|
||||
</source>
|
||||
<dest>
|
||||
*: none
|
||||
headphone_detection: "Duration to Rewind"
|
||||
*: ""
|
||||
</dest>
|
||||
<voice>
|
||||
*: none
|
||||
headphone_detection: "Duration to Rewind"
|
||||
*: ""
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
|
@ -12744,3 +12741,17 @@
|
|||
*: "In custom directories only"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_PAUSE_REWIND
|
||||
desc: Seconds to rewind when rewind on pause is enabled.
|
||||
user: core
|
||||
<source>
|
||||
*: "Rewind on Pause"
|
||||
</source>
|
||||
<dest>
|
||||
*: "Rewind on Pause"
|
||||
</dest>
|
||||
<voice>
|
||||
*: "Rewind on Pause"
|
||||
</voice>
|
||||
</phrase>
|
||||
|
|
|
@ -173,10 +173,9 @@ MENUITEM_SETTING(cuesheet, &global_settings.cuesheet, cuesheet_callback);
|
|||
|
||||
#ifdef HAVE_HEADPHONE_DETECTION
|
||||
MENUITEM_SETTING(unplug_mode, &global_settings.unplug_mode, NULL);
|
||||
MENUITEM_SETTING(unplug_rw, &global_settings.unplug_rw, NULL);
|
||||
MENUITEM_SETTING(unplug_autoresume, &global_settings.unplug_autoresume, NULL);
|
||||
MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON,
|
||||
&unplug_mode, &unplug_rw, &unplug_autoresume);
|
||||
&unplug_mode, &unplug_autoresume);
|
||||
#endif
|
||||
|
||||
MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL);
|
||||
|
@ -184,6 +183,7 @@ MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL);
|
|||
#if CONFIG_CODEC == SWCODEC
|
||||
MENUITEM_SETTING(resume_rewind, &global_settings.resume_rewind, NULL);
|
||||
#endif
|
||||
MENUITEM_SETTING(pause_rewind, &global_settings.pause_rewind, NULL);
|
||||
|
||||
MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
|
||||
Icon_Playback_menu,
|
||||
|
@ -214,6 +214,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
|
|||
#if CONFIG_CODEC == SWCODEC
|
||||
&resume_rewind,
|
||||
#endif
|
||||
&pause_rewind,
|
||||
);
|
||||
|
||||
static int playback_callback(int action,const struct menu_item_ex *this_item)
|
||||
|
|
13
apps/misc.c
13
apps/misc.c
|
@ -504,19 +504,6 @@ static void unplug_change(bool inserted)
|
|||
{
|
||||
headphone_caused_pause = true;
|
||||
pause_action(false, false);
|
||||
|
||||
if (global_settings.unplug_rw)
|
||||
{
|
||||
#if (CONFIG_CODEC == SWCODEC)
|
||||
audio_pre_ff_rewind();
|
||||
#endif
|
||||
if (audio_current_track()->elapsed >
|
||||
(unsigned long)(global_settings.unplug_rw*1000))
|
||||
audio_ff_rewind(audio_current_track()->elapsed -
|
||||
(global_settings.unplug_rw*1000));
|
||||
else
|
||||
audio_ff_rewind(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -483,9 +483,9 @@ struct user_settings
|
|||
int touchpad_sensitivity;
|
||||
#endif
|
||||
|
||||
int pause_rewind; /* time in s to rewind when pausing */
|
||||
#ifdef HAVE_HEADPHONE_DETECTION
|
||||
int unplug_mode; /* pause on headphone unplug */
|
||||
int unplug_rw; /* time in s to rewind when pausing */
|
||||
bool unplug_autoresume; /* disable auto-resume if no phones */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1537,13 +1537,13 @@ const struct settings_list settings[] = {
|
|||
"pause on headphone unplug", "off,pause,pause and resume",
|
||||
NULL, 3, ID2P(LANG_OFF), ID2P(LANG_PAUSE),
|
||||
ID2P(LANG_HEADPHONE_UNPLUG_RESUME)),
|
||||
INT_SETTING(0, unplug_rw, LANG_HEADPHONE_UNPLUG_RW, 0,
|
||||
"rewind duration on pause", UNIT_SEC, 0, 15, 1, NULL, NULL,
|
||||
NULL),
|
||||
OFFON_SETTING(0, unplug_autoresume,
|
||||
LANG_HEADPHONE_UNPLUG_DISABLE_AUTORESUME, false,
|
||||
"disable autoresume if phones not present",NULL),
|
||||
#endif
|
||||
INT_SETTING(0, pause_rewind, LANG_PAUSE_REWIND, 0,
|
||||
"rewind duration on pause", UNIT_SEC, 0, 15, 1, NULL, NULL,
|
||||
NULL),
|
||||
#if CONFIG_TUNER
|
||||
CHOICE_SETTING(0, fm_region, LANG_FM_REGION, 0,
|
||||
"fm_region", "eu,us,jp,kr,it,wo", set_radio_region, 6,
|
||||
|
|
Loading…
Reference in a new issue