FS#11099 - Rewind before resume

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25706 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Magnus Holmgren 2010-04-24 14:10:28 +00:00
parent 2970eb5b4c
commit d38093de2f
6 changed files with 56 additions and 0 deletions

View file

@ -13511,3 +13511,20 @@
*: none
</voice>
</phrase>
<phrase>
id: LANG_RESUME_REWIND
desc: in playback settings menu
user: core
<source>
*: none
swcodec: "Rewind Before Resume"
</source>
<dest>
*: none
swcodec: "Rewind Before Resume"
</dest>
<voice>
*: none
swcodec: "Rewind before resume"
</voice>
</phrase>

View file

@ -177,6 +177,7 @@ MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON,
MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL);
MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL);
MENUITEM_SETTING(resume_rewind, &global_settings.resume_rewind, NULL);
MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
Icon_Playback_menu,
@ -203,6 +204,10 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
,&unplug_menu
#endif
,&skip_length, &prevent_skip,
#if CONFIG_CODEC == SWCODEC
&resume_rewind,
#endif
);
static int playback_callback(int action,const struct menu_item_ex *this_item)

View file

@ -1344,6 +1344,17 @@ static void audio_finish_load_track(void)
track_id3->elapsed = 0;
offset = track_id3->offset;
size_t resume_rewind = (global_settings.resume_rewind *
track_id3->bitrate * 1000) / 8;
if (offset < resume_rewind)
{
offset = 0;
}
else
{
offset -= resume_rewind;
}
enum data_type type = TYPE_PACKET_AUDIO;
@ -1375,6 +1386,8 @@ static void audio_finish_load_track(void)
break;
}
track_id3->offset = offset;
logf("load track: %s", track_id3->path);
if (file_offset > AUDIO_REBUFFER_GUESS_SIZE)

View file

@ -823,6 +823,10 @@ struct user_settings
int hotkey_tree;
#endif
#if CONFIG_CODEC == SWCODEC
/* When resuming playback (after a stop), rewind this number of seconds */
int resume_rewind;
#endif
};
/** global variables **/

View file

@ -1683,6 +1683,12 @@ const struct settings_list settings[] = {
#endif
ID2P(LANG_ONPLAY_OPEN_WITH), ID2P(LANG_DELETE), ID2P(LANG_INSERT)),
#endif
#if CONFIG_CODEC == SWCODEC
INT_SETTING(0, resume_rewind, LANG_RESUME_REWIND, 0,
"resume rewind", UNIT_SEC, 0, 60, 5,
NULL, NULL, NULL),
#endif
};
const int nb_settings = sizeof(settings)/sizeof(*settings);

View file

@ -288,3 +288,14 @@ you to configure settings related to audio playback.
if a track ends, which can be achieved by combining this option with
\setting{Repeat} set to \setting{One}
\opt{swcodec}{
\section{Rewind Before Resume}\index{Rewind Before Resume}
When resuming a track or a bookmark, a short rewind can be done before the
playback is started. This can be useful when listening to speech material,
to help remember what was being said just before playback was stopped.
The size of the rewind can be set to various values between 0 (off) and
60 seconds.
\note{The rewind is not done when resuming a paused track.}
\note{The actual rewind distance may differ a little from the requested
value, depending on the file in question.}
}%\opt{swcodec}