summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-03-27 13:53:29 +0000
committerThomas Martitz <kugel@rockbox.org>2009-03-27 13:53:29 +0000
commit62f3e95945187a744043b5b0c7e393786843c9c8 (patch)
treed0cb3822f08657e6db3cd00a15a9d6034855f389
parente95d33b35eec370c8a93c825a8c366ded8a8aa41 (diff)
downloadrockbox-62f3e95945187a744043b5b0c7e393786843c9c8.tar.gz
rockbox-62f3e95945187a744043b5b0c7e393786843c9c8.zip
FS#10014 - Separate tracklocking out of skip length, skip length prevented to skip tracks. This is a seperate setting now. tracks can still change during normal playback (i.e. a song ends).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20553 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps.c66
-rw-r--r--apps/lang/english.lang16
-rw-r--r--apps/menus/playback_menu.c3
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_list.c1
5 files changed, 58 insertions, 29 deletions
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 1882debd26..d211321622 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -79,10 +79,14 @@ static void wps_state_init(void);
79 79
80static void prev_track(unsigned skip_thresh) 80static void prev_track(unsigned skip_thresh)
81{ 81{
82 if (!wps_state.id3 || (wps_state.id3->elapsed < skip_thresh*1000)) { 82 if (!global_settings.prevent_skip
83 && (wps_state.id3->elapsed < skip_thresh*1000))
84 {
83 audio_prev(); 85 audio_prev();
86 return;
84 } 87 }
85 else { 88 else
89 {
86 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) 90 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
87 { 91 {
88 curr_cuesheet_skip(-1, wps_state.id3->elapsed); 92 curr_cuesheet_skip(-1, wps_state.id3->elapsed);
@@ -107,6 +111,8 @@ static void prev_track(unsigned skip_thresh)
107 111
108static void next_track(void) 112static void next_track(void)
109{ 113{
114 if (global_settings.prevent_skip)
115 return;
110 /* take care of if we're playing a cuesheet */ 116 /* take care of if we're playing a cuesheet */
111 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) 117 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
112 { 118 {
@@ -125,19 +131,37 @@ static void play_hop(int direction)
125{ 131{
126 unsigned step = ((unsigned)global_settings.skip_length*1000); 132 unsigned step = ((unsigned)global_settings.skip_length*1000);
127 unsigned long *elapsed = &(wps_state.id3->elapsed); 133 unsigned long *elapsed = &(wps_state.id3->elapsed);
134 bool prevent_skip = global_settings.prevent_skip;
128 135
129 if (direction == 1 && wps_state.id3->length - *elapsed < step+1000) { 136 if (direction == 1 && wps_state.id3->length - *elapsed < step+1000)
137 {
130#if CONFIG_CODEC == SWCODEC 138#if CONFIG_CODEC == SWCODEC
131 if(global_settings.beep) 139 if (prevent_skip)
132 pcmbuf_beep(1000, 150, 1500*global_settings.beep); 140 {
141 if(global_settings.beep)
142 pcmbuf_beep(1000, 150, 1500*global_settings.beep);
143 }
144 else
133#endif 145#endif
146 next_track();
134 return; 147 return;
135 } else if ((direction == -1 && *elapsed < step)) { 148 }
136 *elapsed = 0; 149 else if ((direction == -1 && *elapsed < step))
137 } else { 150 {
151 if (!prevent_skip)
152 {
153 prev_track(3);
154 return;
155 }
156 else
157 *elapsed = 0;
158 }
159 else
160 {
138 *elapsed += step * direction; 161 *elapsed += step * direction;
139 } 162 }
140 if((audio_status() & AUDIO_STATUS_PLAY) && !wps_state.paused) { 163 if((audio_status() & AUDIO_STATUS_PLAY) && !wps_state.paused)
164 {
141#if (CONFIG_CODEC == SWCODEC) 165#if (CONFIG_CODEC == SWCODEC)
142 audio_pre_ff_rewind(); 166 audio_pre_ff_rewind();
143#else 167#else
@@ -421,8 +445,7 @@ long gui_wps_show(void)
421 } 445 }
422 break; 446 break;
423 /* fast forward 447 /* fast forward
424 OR next dir if this is straight after ACTION_WPS_SKIPNEXT 448 OR next dir if this is straight after ACTION_WPS_SKIPNEXT */
425 OR if skip length set, next track if straight after SKIPPREV. */
426 case ACTION_WPS_SEEKFWD: 449 case ACTION_WPS_SEEKFWD:
427 if (global_settings.party_mode) 450 if (global_settings.party_mode)
428 break; 451 break;
@@ -438,18 +461,12 @@ long gui_wps_show(void)
438 audio_next_dir(); 461 audio_next_dir();
439 } 462 }
440 } 463 }
441 else if (global_settings.skip_length > 0 464 else
442 && current_tick -last_left < HZ) { 465 ffwd_rew(ACTION_WPS_SEEKFWD);
443 next_track();
444 update_track = true;
445 }
446 else ffwd_rew(ACTION_WPS_SEEKFWD);
447 last_right = last_left = 0; 466 last_right = last_left = 0;
448 break; 467 break;
449 /* fast rewind 468 /* fast rewind
450 OR prev dir if this is straight after ACTION_WPS_SKIPPREV, 469 OR prev dir if this is straight after ACTION_WPS_SKIPPREV,*/
451 OR if skip length set, beg of track or prev track if this is
452 straight after SKIPPREV */
453 case ACTION_WPS_SEEKBACK: 470 case ACTION_WPS_SEEKBACK:
454 if (global_settings.party_mode) 471 if (global_settings.party_mode)
455 break; 472 break;
@@ -471,13 +488,8 @@ long gui_wps_show(void)
471 audio_prev_dir(); 488 audio_prev_dir();
472 } 489 }
473 } 490 }
474 else if (global_settings.skip_length > 0 491 else
475 && current_tick -last_right < HZ) 492 ffwd_rew(ACTION_WPS_SEEKBACK);
476 {
477 prev_track(3+global_settings.skip_length);
478 update_track = true;
479 }
480 else ffwd_rew(ACTION_WPS_SEEKBACK);
481 last_left = last_right = 0; 493 last_left = last_right = 0;
482 break; 494 break;
483 495
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index b2f08222ce..6443d16ae9 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -12453,4 +12453,18 @@
12453 *: none 12453 *: none
12454 touchscreen: "Absolute Point" 12454 touchscreen: "Absolute Point"
12455 </voice> 12455 </voice>
12456</phrase> \ No newline at end of file 12456</phrase>
12457<phrase>
12458 id: LANG_PREVENT_SKIPPING
12459 desc: in Settings -> Playback Settings
12460 user: core
12461 <source>
12462 *: "Prevent Skipping"
12463 </source>
12464 <dest>
12465 *: "Prevent Skipping"
12466 </dest>
12467 <voice>
12468 *: "Prevent Skipping"
12469 </voice>
12470</phrase>
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c
index 5d1421b966..02e29b1840 100644
--- a/apps/menus/playback_menu.c
+++ b/apps/menus/playback_menu.c
@@ -176,6 +176,7 @@ MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON,
176#endif 176#endif
177 177
178MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL); 178MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL);
179MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL);
179 180
180MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, 181MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
181 Icon_Playback_menu, 182 Icon_Playback_menu,
@@ -197,7 +198,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
197#ifdef HAVE_HEADPHONE_DETECTION 198#ifdef HAVE_HEADPHONE_DETECTION
198 ,&unplug_menu 199 ,&unplug_menu
199#endif 200#endif
200 ,&skip_length 201 ,&skip_length, &prevent_skip,
201 ); 202 );
202 203
203static 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/settings.h b/apps/settings.h
index dfd3998d83..3b13ff8e6b 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -725,6 +725,7 @@ struct user_settings
725#ifdef HAVE_SPEAKER 725#ifdef HAVE_SPEAKER
726 bool speaker_enabled; 726 bool speaker_enabled;
727#endif 727#endif
728 bool prevent_skip;
728 729
729#ifdef HAVE_TOUCHSCREEN 730#ifdef HAVE_TOUCHSCREEN
730 int touch_mode; 731 int touch_mode;
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 6255580991..fbdf356def 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1467,6 +1467,7 @@ const struct settings_list settings[] = {
1467 "touchscreen mode", "point,grid", NULL, 2, 1467 "touchscreen mode", "point,grid", NULL, 2,
1468 ID2P(LANG_TOUCHSCREEN_POINT), ID2P(LANG_TOUCHSCREEN_GRID)), 1468 ID2P(LANG_TOUCHSCREEN_POINT), ID2P(LANG_TOUCHSCREEN_GRID)),
1469#endif 1469#endif
1470 OFFON_SETTING(0, prevent_skip, LANG_PREVENT_SKIPPING, false, "prevent_skip", NULL),
1470}; 1471};
1471 1472
1472const int nb_settings = sizeof(settings)/sizeof(*settings); 1473const int nb_settings = sizeof(settings)/sizeof(*settings);