diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-03-27 13:53:29 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-03-27 13:53:29 +0000 |
commit | 62f3e95945187a744043b5b0c7e393786843c9c8 (patch) | |
tree | d0cb3822f08657e6db3cd00a15a9d6034855f389 /apps/gui | |
parent | e95d33b35eec370c8a93c825a8c366ded8a8aa41 (diff) | |
download | rockbox-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
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/gwps.c | 66 |
1 files changed, 39 insertions, 27 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 | ||
80 | static void prev_track(unsigned skip_thresh) | 80 | static 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 | ||
108 | static void next_track(void) | 112 | static 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 | ||