Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 25254) +++ apps/lang/english.lang (working copy) @@ -13377,4 +13377,21 @@ recording_histogram: "Histogram interval" + + id: LANG_RESUME_REWIND + desc: in playback settings menu + user: core + + *: none + swcodec: "Rewind Before Resume" + + + *: none + swcodec: "Rewind Before Resume" + + + *: none + swcodec: "Rewind before resume" + + Index: apps/settings.h =================================================================== --- apps/settings.h (revision 25254) +++ apps/settings.h (working copy) @@ -813,6 +813,9 @@ bool morse_input; /* text input method setting */ #endif +#if CONFIG_CODEC == SWCODEC + int resume_rewind; +#endif }; /** global variables **/ Index: apps/menus/playback_menu.c =================================================================== --- apps/menus/playback_menu.c (revision 25254) +++ apps/menus/playback_menu.c (working copy) @@ -177,6 +177,7 @@ 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 @@ ,&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) Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (revision 25254) +++ apps/settings_list.c (working copy) @@ -1656,6 +1656,12 @@ #ifdef HAVE_MORSE_INPUT OFFON_SETTING(0, morse_input, LANG_MORSE_INPUT, false, "morse input", NULL), #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); Index: apps/playback.c =================================================================== --- apps/playback.c (revision 25254) +++ apps/playback.c (working copy) @@ -1343,7 +1343,18 @@ 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; switch (track_id3->codectype) { @@ -1374,6 +1385,8 @@ break; } + track_id3->offset = offset; + logf("load track: %s", track_id3->path); if (file_offset > AUDIO_REBUFFER_GUESS_SIZE) Index: manual/configure_rockbox/playback_options.tex =================================================================== --- manual/configure_rockbox/playback_options.tex (revision 25254) +++ manual/configure_rockbox/playback_options.tex (working copy) @@ -288,3 +288,12 @@ 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, a short rewind can be done before the playback + is started. This can be useful when listening to speech material. + The size of the rewind can be set to various values between 0 (off) and + 60 seconds. + \note{The actual rewind distance may differ a little from the requested + value, depending on the file in question.} +}%\opt{swcodec}