summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Hohmuth <sideral@rockbox.org>2011-05-13 22:28:47 +0000
committerMichael Hohmuth <sideral@rockbox.org>2011-05-13 22:28:47 +0000
commit5aec3c2400fdd47c7b2098f1a1c5506a6aa3156c (patch)
tree875e48e0cf80f749a79d138b8787d84568171f70 /apps
parent0a070c54202d946b37946343ea2f083fee82871a (diff)
downloadrockbox-5aec3c2400fdd47c7b2098f1a1c5506a6aa3156c.tar.gz
rockbox-5aec3c2400fdd47c7b2098f1a1c5506a6aa3156c.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/wps.c11
-rw-r--r--apps/lang/english.lang25
-rw-r--r--apps/menus/playback_menu.c5
-rw-r--r--apps/misc.c13
-rw-r--r--apps/settings.h2
-rw-r--r--apps/settings_list.c6
6 files changed, 36 insertions, 26 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 5404d70638..0103ace53c 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -125,6 +125,17 @@ void pause_action(bool may_fade, bool updatewps)
125 fade(false, updatewps); 125 fade(false, updatewps);
126 else 126 else
127 audio_pause(); 127 audio_pause();
128
129 if (global_settings.pause_rewind) {
130 long newpos;
131
132#if (CONFIG_CODEC == SWCODEC)
133 audio_pre_ff_rewind();
134#endif
135 newpos = audio_current_track()->elapsed
136 - global_settings.pause_rewind * 1000;
137 audio_ff_rewind(newpos > 0 ? newpos : 0);
138 }
128} 139}
129 140
130void unpause_action(bool may_fade, bool updatewps) 141void unpause_action(bool may_fade, bool updatewps)
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 26a2274680..71dee79ee3 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -2069,19 +2069,16 @@
2069</phrase> 2069</phrase>
2070<phrase> 2070<phrase>
2071 id: LANG_HEADPHONE_UNPLUG_RW 2071 id: LANG_HEADPHONE_UNPLUG_RW
2072 desc: in pause_phones_menu. 2072 desc: deprecated
2073 user: core 2073 user: core
2074 <source> 2074 <source>
2075 *: none 2075 *: ""
2076 headphone_detection: "Duration to Rewind"
2077 </source> 2076 </source>
2078 <dest> 2077 <dest>
2079 *: none 2078 *: ""
2080 headphone_detection: "Duration to Rewind"
2081 </dest> 2079 </dest>
2082 <voice> 2080 <voice>
2083 *: none 2081 *: ""
2084 headphone_detection: "Duration to Rewind"
2085 </voice> 2082 </voice>
2086</phrase> 2083</phrase>
2087<phrase> 2084<phrase>
@@ -12744,3 +12741,17 @@
12744 *: "In custom directories only" 12741 *: "In custom directories only"
12745 </voice> 12742 </voice>
12746</phrase> 12743</phrase>
12744<phrase>
12745 id: LANG_PAUSE_REWIND
12746 desc: Seconds to rewind when rewind on pause is enabled.
12747 user: core
12748 <source>
12749 *: "Rewind on Pause"
12750 </source>
12751 <dest>
12752 *: "Rewind on Pause"
12753 </dest>
12754 <voice>
12755 *: "Rewind on Pause"
12756 </voice>
12757</phrase>
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c
index 4153c1c776..1b1a13a6a5 100644
--- a/apps/menus/playback_menu.c
+++ b/apps/menus/playback_menu.c
@@ -173,10 +173,9 @@ MENUITEM_SETTING(cuesheet, &global_settings.cuesheet, cuesheet_callback);
173 173
174#ifdef HAVE_HEADPHONE_DETECTION 174#ifdef HAVE_HEADPHONE_DETECTION
175MENUITEM_SETTING(unplug_mode, &global_settings.unplug_mode, NULL); 175MENUITEM_SETTING(unplug_mode, &global_settings.unplug_mode, NULL);
176MENUITEM_SETTING(unplug_rw, &global_settings.unplug_rw, NULL);
177MENUITEM_SETTING(unplug_autoresume, &global_settings.unplug_autoresume, NULL); 176MENUITEM_SETTING(unplug_autoresume, &global_settings.unplug_autoresume, NULL);
178MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON, 177MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON,
179 &unplug_mode, &unplug_rw, &unplug_autoresume); 178 &unplug_mode, &unplug_autoresume);
180#endif 179#endif
181 180
182MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL); 181MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL);
@@ -184,6 +183,7 @@ MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL);
184#if CONFIG_CODEC == SWCODEC 183#if CONFIG_CODEC == SWCODEC
185MENUITEM_SETTING(resume_rewind, &global_settings.resume_rewind, NULL); 184MENUITEM_SETTING(resume_rewind, &global_settings.resume_rewind, NULL);
186#endif 185#endif
186MENUITEM_SETTING(pause_rewind, &global_settings.pause_rewind, NULL);
187 187
188MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, 188MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
189 Icon_Playback_menu, 189 Icon_Playback_menu,
@@ -214,6 +214,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
214#if CONFIG_CODEC == SWCODEC 214#if CONFIG_CODEC == SWCODEC
215 &resume_rewind, 215 &resume_rewind,
216#endif 216#endif
217 &pause_rewind,
217 ); 218 );
218 219
219static int playback_callback(int action,const struct menu_item_ex *this_item) 220static int playback_callback(int action,const struct menu_item_ex *this_item)
diff --git a/apps/misc.c b/apps/misc.c
index d72d7a4da0..b027215ccc 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -504,19 +504,6 @@ static void unplug_change(bool inserted)
504 { 504 {
505 headphone_caused_pause = true; 505 headphone_caused_pause = true;
506 pause_action(false, false); 506 pause_action(false, false);
507
508 if (global_settings.unplug_rw)
509 {
510#if (CONFIG_CODEC == SWCODEC)
511 audio_pre_ff_rewind();
512#endif
513 if (audio_current_track()->elapsed >
514 (unsigned long)(global_settings.unplug_rw*1000))
515 audio_ff_rewind(audio_current_track()->elapsed -
516 (global_settings.unplug_rw*1000));
517 else
518 audio_ff_rewind(0);
519 }
520 } 507 }
521 } 508 }
522 } 509 }
diff --git a/apps/settings.h b/apps/settings.h
index 3f49cfcb2c..bed88c82ea 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -483,9 +483,9 @@ struct user_settings
483 int touchpad_sensitivity; 483 int touchpad_sensitivity;
484#endif 484#endif
485 485
486 int pause_rewind; /* time in s to rewind when pausing */
486#ifdef HAVE_HEADPHONE_DETECTION 487#ifdef HAVE_HEADPHONE_DETECTION
487 int unplug_mode; /* pause on headphone unplug */ 488 int unplug_mode; /* pause on headphone unplug */
488 int unplug_rw; /* time in s to rewind when pausing */
489 bool unplug_autoresume; /* disable auto-resume if no phones */ 489 bool unplug_autoresume; /* disable auto-resume if no phones */
490#endif 490#endif
491 491
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 5b9a84036f..f282b8afc0 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1537,13 +1537,13 @@ const struct settings_list settings[] = {
1537 "pause on headphone unplug", "off,pause,pause and resume", 1537 "pause on headphone unplug", "off,pause,pause and resume",
1538 NULL, 3, ID2P(LANG_OFF), ID2P(LANG_PAUSE), 1538 NULL, 3, ID2P(LANG_OFF), ID2P(LANG_PAUSE),
1539 ID2P(LANG_HEADPHONE_UNPLUG_RESUME)), 1539 ID2P(LANG_HEADPHONE_UNPLUG_RESUME)),
1540 INT_SETTING(0, unplug_rw, LANG_HEADPHONE_UNPLUG_RW, 0,
1541 "rewind duration on pause", UNIT_SEC, 0, 15, 1, NULL, NULL,
1542 NULL),
1543 OFFON_SETTING(0, unplug_autoresume, 1540 OFFON_SETTING(0, unplug_autoresume,
1544 LANG_HEADPHONE_UNPLUG_DISABLE_AUTORESUME, false, 1541 LANG_HEADPHONE_UNPLUG_DISABLE_AUTORESUME, false,
1545 "disable autoresume if phones not present",NULL), 1542 "disable autoresume if phones not present",NULL),
1546#endif 1543#endif
1544 INT_SETTING(0, pause_rewind, LANG_PAUSE_REWIND, 0,
1545 "rewind duration on pause", UNIT_SEC, 0, 15, 1, NULL, NULL,
1546 NULL),
1547#if CONFIG_TUNER 1547#if CONFIG_TUNER
1548 CHOICE_SETTING(0, fm_region, LANG_FM_REGION, 0, 1548 CHOICE_SETTING(0, fm_region, LANG_FM_REGION, 0,
1549 "fm_region", "eu,us,jp,kr,it,wo", set_radio_region, 6, 1549 "fm_region", "eu,us,jp,kr,it,wo", set_radio_region, 6,