summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2008-07-14 20:39:30 +0000
committerThom Johansen <thomj@rockbox.org>2008-07-14 20:39:30 +0000
commit4a7e0c79498f7b19179482c8069bb1d99b61b7ca (patch)
tree1164e12551715ba25ea587f6110c8f407091372f
parent1f6ee2b91319a6053e356a5eb22b881d0bacee52 (diff)
downloadrockbox-4a7e0c79498f7b19179482c8069bb1d99b61b7ca.tar.gz
rockbox-4a7e0c79498f7b19179482c8069bb1d99b61b7ca.zip
Rename and rework the "Study Mode" menu into the "Skip Length" setting. Update manual. Bump plugin API thanks to having changed global_settings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18041 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c4
-rw-r--r--apps/gui/gwps.c24
-rw-r--r--apps/lang/english.lang53
-rw-r--r--apps/menus/playback_menu.c15
-rw-r--r--apps/plugin.h4
-rw-r--r--apps/settings.h3
-rw-r--r--apps/settings_list.c25
-rw-r--r--manual/configure_rockbox/playback_options.tex18
8 files changed, 91 insertions, 55 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index b6a7c89308..0ec89b7140 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -162,9 +162,9 @@ bool update_onvol_change(struct gui_wps * gwps)
162void play_hop(int direction) 162void play_hop(int direction)
163{ 163{
164 if(!wps_state.id3 || !wps_state.id3->length 164 if(!wps_state.id3 || !wps_state.id3->length
165 || global_settings.study_hop_step == 0) 165 || global_settings.skip_length == 0)
166 return; 166 return;
167#define STEP ((unsigned)global_settings.study_hop_step *1000) 167#define STEP ((unsigned)global_settings.skip_length*60*1000)
168 if(direction == 1 168 if(direction == 1
169 && wps_state.id3->length - wps_state.id3->elapsed < STEP+1000) { 169 && wps_state.id3->length - wps_state.id3->elapsed < STEP+1000) {
170#if CONFIG_CODEC == SWCODEC 170#if CONFIG_CODEC == SWCODEC
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index c654b3b757..1740e99f9d 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -362,11 +362,11 @@ long gui_wps_show(void)
362 break; 362 break;
363 /* fast forward 363 /* fast forward
364 OR next dir if this is straight after ACTION_WPS_SKIPNEXT 364 OR next dir if this is straight after ACTION_WPS_SKIPNEXT
365 OR in study mode, next track if straight after SKIPPREV. */ 365 OR if skip length set, next track if straight after SKIPPREV. */
366 case ACTION_WPS_SEEKFWD: 366 case ACTION_WPS_SEEKFWD:
367 if (global_settings.party_mode) 367 if (global_settings.party_mode)
368 break; 368 break;
369 if (!global_settings.study_mode 369 if (global_settings.skip_length == 0
370 && current_tick -last_right < HZ) 370 && current_tick -last_right < HZ)
371 { 371 {
372 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) 372 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
@@ -378,7 +378,7 @@ long gui_wps_show(void)
378 audio_next_dir(); 378 audio_next_dir();
379 } 379 }
380 } 380 }
381 else if(global_settings.study_mode 381 else if (global_settings.skip_length > 0
382 && current_tick -last_left < HZ) { 382 && current_tick -last_left < HZ) {
383 next_track(); 383 next_track();
384 update_track = true; 384 update_track = true;
@@ -388,12 +388,12 @@ long gui_wps_show(void)
388 break; 388 break;
389 /* fast rewind 389 /* fast rewind
390 OR prev dir if this is straight after ACTION_WPS_SKIPPREV, 390 OR prev dir if this is straight after ACTION_WPS_SKIPPREV,
391 OR in study mode, beg of track or prev track if this is 391 OR if skip length set, beg of track or prev track if this is
392 straight after SKIPPREV */ 392 straight after SKIPPREV */
393 case ACTION_WPS_SEEKBACK: 393 case ACTION_WPS_SEEKBACK:
394 if (global_settings.party_mode) 394 if (global_settings.party_mode)
395 break; 395 break;
396 if (!global_settings.study_mode 396 if (global_settings.skip_length == 0
397 && current_tick -last_left < HZ) 397 && current_tick -last_left < HZ)
398 { 398 {
399 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) 399 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
@@ -411,10 +411,10 @@ long gui_wps_show(void)
411 audio_prev_dir(); 411 audio_prev_dir();
412 } 412 }
413 } 413 }
414 else if(global_settings.study_mode 414 else if (global_settings.skip_length > 0
415 && current_tick -last_right < HZ) 415 && current_tick -last_right < HZ)
416 { 416 {
417 prev_track(3+global_settings.study_hop_step); 417 prev_track(3+global_settings.skip_length*60);
418 update_track = true; 418 update_track = true;
419 } 419 }
420 else ffwd_rew(ACTION_WPS_SEEKBACK); 420 else ffwd_rew(ACTION_WPS_SEEKBACK);
@@ -446,13 +446,13 @@ long gui_wps_show(void)
446 /* ...otherwise, do it normally */ 446 /* ...otherwise, do it normally */
447#endif 447#endif
448 448
449 if(global_settings.study_mode) 449 if (global_settings.skip_length > 0)
450 play_hop(-1); 450 play_hop(-1);
451 else prev_track(3); 451 else prev_track(3);
452 break; 452 break;
453 453
454 /* next 454 /* next
455 OR in study mode, hop by predetermined amount. */ 455 OR if skip length set, hop by predetermined amount. */
456 case ACTION_WPS_SKIPNEXT: 456 case ACTION_WPS_SKIPNEXT:
457 if (global_settings.party_mode) 457 if (global_settings.party_mode)
458 break; 458 break;
@@ -477,7 +477,7 @@ long gui_wps_show(void)
477 /* ...otherwise, do it normally */ 477 /* ...otherwise, do it normally */
478#endif 478#endif
479 479
480 if(global_settings.study_mode) 480 if (global_settings.skip_length > 0)
481 play_hop(1); 481 play_hop(1);
482 else next_track(); 482 else next_track();
483 break; 483 break;
@@ -496,7 +496,7 @@ long gui_wps_show(void)
496 else 496 else
497#endif 497#endif
498 { 498 {
499 if(global_settings.study_mode) 499 if (global_settings.skip_length > 0)
500 next_track(); 500 next_track();
501 else audio_next_dir(); 501 else audio_next_dir();
502 } 502 }
@@ -510,7 +510,7 @@ long gui_wps_show(void)
510 else 510 else
511#endif 511#endif
512 { 512 {
513 if(global_settings.study_mode) 513 if (global_settings.skip_length > 0)
514 prev_track(3); 514 prev_track(3);
515 else audio_prev_dir(); 515 else audio_prev_dir();
516 } 516 }
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 2a91100adf..3815edb656 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -11617,44 +11617,44 @@
11617</phrase> 11617</phrase>
11618<phrase> 11618<phrase>
11619 id: LANG_STUDY_MODE 11619 id: LANG_STUDY_MODE
11620 desc: playback settings menu 11620 desc: DEPRECATED
11621 user: 11621 user:
11622 <source> 11622 <source>
11623 *: "Study Mode" 11623 *: ""
11624 </source> 11624 </source>
11625 <dest> 11625 <dest>
11626 *: "Study Mode" 11626 *: ""
11627 </dest> 11627 </dest>
11628 <voice> 11628 <voice>
11629 *: "Study Mode" 11629 *: ""
11630 </voice> 11630 </voice>
11631</phrase> 11631</phrase>
11632<phrase> 11632<phrase>
11633 id: LANG_STUDY_HOP_STEP 11633 id: LANG_STUDY_HOP_STEP
11634 desc: playback settings menu 11634 desc: DEPRECATED
11635 user: 11635 user:
11636 <source> 11636 <source>
11637 *: "Study Increment" 11637 *: ""
11638 </source> 11638 </source>
11639 <dest> 11639 <dest>
11640 *: "Study Increment" 11640 *: ""
11641 </dest> 11641 </dest>
11642 <voice> 11642 <voice>
11643 *: "Study Increment" 11643 *: ""
11644 </voice> 11644 </voice>
11645</phrase> 11645</phrase>
11646<phrase> 11646<phrase>
11647 id: LANG_ENABLE_STUDY_MODE 11647 id: LANG_ENABLE_STUDY_MODE
11648 desc: playback settings menu 11648 desc: DEPRECATED
11649 user: 11649 user:
11650 <source> 11650 <source>
11651 *: "Enable Study Mode" 11651 *: ""
11652 </source> 11652 </source>
11653 <dest> 11653 <dest>
11654 *: "Enable Study Mode" 11654 *: ""
11655 </dest> 11655 </dest>
11656 <voice> 11656 <voice>
11657 *: "Enable Study Mode" 11657 *: ""
11658 </voice> 11658 </voice>
11659</phrase> 11659</phrase>
11660<phrase> 11660<phrase>
@@ -11806,3 +11806,32 @@
11806 *: "Fast" 11806 *: "Fast"
11807 </voice> 11807 </voice>
11808</phrase> 11808</phrase>
11809<phrase>
11810 id: LANG_SKIP_LENGTH
11811 desc: playback settings menu
11812 user:
11813 <source>
11814 *: "Skip Length"
11815 </source>
11816 <dest>
11817 *: "Skip Length"
11818 </dest>
11819 <voice>
11820 *: "Skip Length"
11821 </voice>
11822</phrase>
11823<phrase>
11824 id: LANG_SKIP_TRACK
11825 desc: skip length setting entry 0
11826 user:
11827 <source>
11828 *: "Skip Track"
11829 </source>
11830 <dest>
11831 *: "Skip Track"
11832 </dest>
11833 <voice>
11834 *: "Skip Track"
11835 </voice>
11836</phrase>
11837
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c
index 2d3f3d17b2..8d5c0eeee6 100644
--- a/apps/menus/playback_menu.c
+++ b/apps/menus/playback_menu.c
@@ -35,10 +35,10 @@
35#include "dsp.h" 35#include "dsp.h"
36#include "scrobbler.h" 36#include "scrobbler.h"
37#include "audio.h" 37#include "audio.h"
38#include "cuesheet.h" 38#include "cuesheet.h"
39#if CONFIG_CODEC == SWCODEC 39#if CONFIG_CODEC == SWCODEC
40#include "playback.h" 40#include "playback.h"
41#endif 41#endif
42 42
43 43
44#if CONFIG_CODEC == SWCODEC 44#if CONFIG_CODEC == SWCODEC
@@ -176,10 +176,7 @@ MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON,
176 &unplug_mode, &unplug_rw, &unplug_autoresume); 176 &unplug_mode, &unplug_rw, &unplug_autoresume);
177#endif 177#endif
178 178
179MENUITEM_SETTING(study_mode, &global_settings.study_mode, NULL); 179MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL);
180MENUITEM_SETTING(study_hop_step, &global_settings.study_hop_step, NULL);
181MAKE_MENU(study_mode_menu, ID2P(LANG_STUDY_MODE), 0, Icon_NOICON,
182 &study_mode, &study_hop_step);
183 180
184MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, 181MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
185 Icon_Playback_menu, 182 Icon_Playback_menu,
@@ -201,7 +198,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
201#ifdef HAVE_HEADPHONE_DETECTION 198#ifdef HAVE_HEADPHONE_DETECTION
202 ,&unplug_menu 199 ,&unplug_menu
203#endif 200#endif
204 ,&study_mode_menu 201 ,&skip_length
205 ); 202 );
206 203
207static int playback_callback(int action,const struct menu_item_ex *this_item) 204static int playback_callback(int action,const struct menu_item_ex *this_item)
diff --git a/apps/plugin.h b/apps/plugin.h
index 38d96f3751..dfe746342e 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -128,12 +128,12 @@ void* plugin_get_buffer(size_t *buffer_size);
128#define PLUGIN_MAGIC 0x526F634B /* RocK */ 128#define PLUGIN_MAGIC 0x526F634B /* RocK */
129 129
130/* increase this every time the api struct changes */ 130/* increase this every time the api struct changes */
131#define PLUGIN_API_VERSION 119 131#define PLUGIN_API_VERSION 120
132 132
133/* update this to latest version if a change to the api struct breaks 133/* update this to latest version if a change to the api struct breaks
134 backwards compatibility (and please take the opportunity to sort in any 134 backwards compatibility (and please take the opportunity to sort in any
135 new function which are "waiting" at the end of the function table) */ 135 new function which are "waiting" at the end of the function table) */
136#define PLUGIN_MIN_API_VERSION 117 136#define PLUGIN_MIN_API_VERSION 120
137 137
138/* plugin return codes */ 138/* plugin return codes */
139enum plugin_status { 139enum plugin_status {
diff --git a/apps/settings.h b/apps/settings.h
index b9a2babee7..a1e5cb119c 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -740,8 +740,7 @@ struct user_settings
740 int keyclick_repeats; /* keyclick on repeats */ 740 int keyclick_repeats; /* keyclick on repeats */
741#endif 741#endif
742 unsigned char playlist_catalog_dir[MAX_FILENAME+1]; 742 unsigned char playlist_catalog_dir[MAX_FILENAME+1];
743 bool study_mode; /* study mode enabled */ 743 int skip_length; /* skip length */
744 int study_hop_step; /* hop step in study mode, in seconds */
745#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING 744#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
746 int touchpad_sensitivity; 745 int touchpad_sensitivity;
747#endif 746#endif
diff --git a/apps/settings_list.c b/apps/settings_list.c
index f7d8ca3980..48ebd9e63d 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -257,6 +257,23 @@ static int32_t getlang_unit_0_is_off(int value, int unit)
257 return TALK_ID(value,unit); 257 return TALK_ID(value,unit);
258} 258}
259 259
260static void formatter_unit_0_is_skip_track(char *buffer, size_t buffer_size,
261 int val, const char *unit)
262{
263 if (val == 0)
264 strcpy(buffer, str(LANG_SKIP_TRACK));
265 else
266 snprintf(buffer, buffer_size, "%d %s", val, unit);
267}
268
269static int32_t getlang_unit_0_is_skip_track(int value, int unit)
270{
271 if (value == 0)
272 return LANG_SKIP_TRACK;
273 else
274 return TALK_ID(value, unit);
275}
276
260#ifdef HAVE_BACKLIGHT 277#ifdef HAVE_BACKLIGHT
261static void backlight_formatter(char *buffer, size_t buffer_size, 278static void backlight_formatter(char *buffer, size_t buffer_size,
262 int val, const char *unit) 279 int val, const char *unit)
@@ -1234,10 +1251,10 @@ const struct settings_list settings[] = {
1234#endif 1251#endif
1235 OFFON_SETTING(0,cuesheet,LANG_CUESHEET_ENABLE,false,"cuesheet support", 1252 OFFON_SETTING(0,cuesheet,LANG_CUESHEET_ENABLE,false,"cuesheet support",
1236 NULL), 1253 NULL),
1237 OFFON_SETTING(0,study_mode,LANG_ENABLE_STUDY_MODE,false,"Study mode", 1254 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, skip_length,
1238 NULL), 1255 LANG_SKIP_LENGTH, 0, "skip length", "track",
1239 INT_SETTING(0, study_hop_step, LANG_STUDY_HOP_STEP, 5, "Study hop step", 1256 UNIT_MIN, formatter_unit_0_is_skip_track,
1240 UNIT_SEC, 0, 250, 1, NULL, NULL, NULL), 1257 getlang_unit_0_is_skip_track, NULL, 8, 0,1,2,3,4,5,10,15),
1241 CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, 1258 CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1,
1242 "start in screen", "previous,root,files,db,wps,menu," 1259 "start in screen", "previous,root,files,db,wps,menu,"
1243#ifdef HAVE_RECORDING 1260#ifdef HAVE_RECORDING
diff --git a/manual/configure_rockbox/playback_options.tex b/manual/configure_rockbox/playback_options.tex
index 7faf237f83..7701855781 100644
--- a/manual/configure_rockbox/playback_options.tex
+++ b/manual/configure_rockbox/playback_options.tex
@@ -259,19 +259,13 @@ related to audio playback.
259 When you enable this option, you'll have to reboot for it to come into 259 When you enable this option, you'll have to reboot for it to come into
260 effect. 260 effect.
261 261
262\item[Study Mode]\index{Study Mode} 262\item[Skip Length]\index{Skip Length}
263 Designed to prevent the unintentional skipping of tracks while listening to 263 Designed to speed up navigation and prevent unintentional track skipping when
264 audio books, Study Mode changes the behavior of the \ActionWpsSkipPrev{} and 264 listening to long audio tracks, \setting{Skip Length} changes the behavior of
265 \ActionWpsSkipNext{} buttons so that they skip by a user-defined number of 265 the \ActionWpsSkipPrev{} and \ActionWpsSkipNext{} buttons so that they skip
266 seconds instead of the entire track, thus preventing you from losing your place 266 by a given number of minutes instead of skipping to a new track.
267 entirely.
268 267
269 \begin{description} 268 \note{To skip tracks with this setting set to a time interval, press Short
270 \item[Enable Study Mode] \setting{On}/\setting{Off}.
271 \item[Study Increment] The number of seconds to skip forward and backward.
272 \end{description}
273
274 \note{To skip tracks with this setting on, press Short
275 \ActionWpsSkipPrev{} + Long \ActionWpsSkipNext{} to go forward and Short 269 \ActionWpsSkipPrev{} + Long \ActionWpsSkipNext{} to go forward and Short
276 \ActionWpsSkipNext{} + Long \ActionWpsSkipPrev{} to go back.} 270 \ActionWpsSkipNext{} + Long \ActionWpsSkipPrev{} to go back.}
277 271