diff options
Diffstat (limited to 'apps/gui/gwps.c')
-rw-r--r-- | apps/gui/gwps.c | 127 |
1 files changed, 81 insertions, 46 deletions
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 2e72813d73..28aea4945f 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c | |||
@@ -90,6 +90,51 @@ static void gui_wps_set_margin(struct gui_wps *gwps) | |||
90 | } | 90 | } |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | static void prev_track(unsigned skip_thresh) | ||
94 | { | ||
95 | if (!wps_state.id3 || (wps_state.id3->elapsed < skip_thresh*1000)) { | ||
96 | audio_prev(); | ||
97 | } | ||
98 | else { | ||
99 | if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) | ||
100 | { | ||
101 | curr_cuesheet_skip(-1, wps_state.id3->elapsed); | ||
102 | return; | ||
103 | } | ||
104 | |||
105 | if (!wps_state.paused) | ||
106 | #if (CONFIG_CODEC == SWCODEC) | ||
107 | audio_pre_ff_rewind(); | ||
108 | #else | ||
109 | audio_pause(); | ||
110 | #endif | ||
111 | |||
112 | audio_ff_rewind(0); | ||
113 | |||
114 | #if (CONFIG_CODEC != SWCODEC) | ||
115 | if (!wps_state.paused) | ||
116 | audio_resume(); | ||
117 | #endif | ||
118 | } | ||
119 | } | ||
120 | |||
121 | void next_track(void) | ||
122 | { | ||
123 | /* take care of if we're playing a cuesheet */ | ||
124 | if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) | ||
125 | { | ||
126 | if (curr_cuesheet_skip(1, wps_state.id3->elapsed)) | ||
127 | { | ||
128 | /* if the result was false, then we really want | ||
129 | to skip to the next track */ | ||
130 | return; | ||
131 | } | ||
132 | } | ||
133 | |||
134 | audio_next(); | ||
135 | } | ||
136 | |||
137 | |||
93 | long gui_wps_show(void) | 138 | long gui_wps_show(void) |
94 | { | 139 | { |
95 | long button = 0; | 140 | long button = 0; |
@@ -335,11 +380,13 @@ long gui_wps_show(void) | |||
335 | } | 380 | } |
336 | break; | 381 | break; |
337 | /* fast forward | 382 | /* fast forward |
338 | OR next dir if this is straight after ACTION_WPS_SKIPNEXT */ | 383 | OR next dir if this is straight after ACTION_WPS_SKIPNEXT |
384 | OR in study mode, next track if straight after SKIPPREV. */ | ||
339 | case ACTION_WPS_SEEKFWD: | 385 | case ACTION_WPS_SEEKFWD: |
340 | if (global_settings.party_mode) | 386 | if (global_settings.party_mode) |
341 | break; | 387 | break; |
342 | if (current_tick -last_right < HZ) | 388 | if (!global_settings.study_mode |
389 | && current_tick -last_right < HZ) | ||
343 | { | 390 | { |
344 | if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) | 391 | if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) |
345 | { | 392 | { |
@@ -350,15 +397,23 @@ long gui_wps_show(void) | |||
350 | audio_next_dir(); | 397 | audio_next_dir(); |
351 | } | 398 | } |
352 | } | 399 | } |
400 | else if(global_settings.study_mode | ||
401 | && current_tick -last_left < HZ) { | ||
402 | next_track(); | ||
403 | update_track = true; | ||
404 | } | ||
353 | else ffwd_rew(ACTION_WPS_SEEKFWD); | 405 | else ffwd_rew(ACTION_WPS_SEEKFWD); |
354 | last_right = 0; | 406 | last_right = last_left = 0; |
355 | break; | 407 | break; |
356 | /* fast rewind | 408 | /* fast rewind |
357 | OR prev dir if this is straight after ACTION_WPS_SKIPPREV */ | 409 | OR prev dir if this is straight after ACTION_WPS_SKIPPREV, |
410 | OR in study mode, beg of track or prev track if this is | ||
411 | straight after SKIPPREV */ | ||
358 | case ACTION_WPS_SEEKBACK: | 412 | case ACTION_WPS_SEEKBACK: |
359 | if (global_settings.party_mode) | 413 | if (global_settings.party_mode) |
360 | break; | 414 | break; |
361 | if (current_tick -last_left < HZ) | 415 | if (!global_settings.study_mode |
416 | && current_tick -last_left < HZ) | ||
362 | { | 417 | { |
363 | if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) | 418 | if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) |
364 | { | 419 | { |
@@ -375,8 +430,14 @@ long gui_wps_show(void) | |||
375 | audio_prev_dir(); | 430 | audio_prev_dir(); |
376 | } | 431 | } |
377 | } | 432 | } |
433 | else if(global_settings.study_mode | ||
434 | && current_tick -last_right < HZ) | ||
435 | { | ||
436 | prev_track(3+global_settings.study_hop_step); | ||
437 | update_track = true; | ||
438 | } | ||
378 | else ffwd_rew(ACTION_WPS_SEEKBACK); | 439 | else ffwd_rew(ACTION_WPS_SEEKBACK); |
379 | last_left = 0; | 440 | last_left = last_right = 0; |
380 | break; | 441 | break; |
381 | 442 | ||
382 | /* prev / restart */ | 443 | /* prev / restart */ |
@@ -404,34 +465,13 @@ long gui_wps_show(void) | |||
404 | /* ...otherwise, do it normally */ | 465 | /* ...otherwise, do it normally */ |
405 | #endif | 466 | #endif |
406 | 467 | ||
407 | if (!wps_state.id3 || (wps_state.id3->elapsed < 3*1000)) { | 468 | if(global_settings.study_mode) |
408 | audio_prev(); | 469 | play_hop(-1); |
409 | } | 470 | else prev_track(3); |
410 | else { | ||
411 | |||
412 | if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) | ||
413 | { | ||
414 | curr_cuesheet_skip(-1, wps_state.id3->elapsed); | ||
415 | break; | ||
416 | } | ||
417 | |||
418 | if (!wps_state.paused) | ||
419 | #if (CONFIG_CODEC == SWCODEC) | ||
420 | audio_pre_ff_rewind(); | ||
421 | #else | ||
422 | audio_pause(); | ||
423 | #endif | ||
424 | |||
425 | audio_ff_rewind(0); | ||
426 | |||
427 | #if (CONFIG_CODEC != SWCODEC) | ||
428 | if (!wps_state.paused) | ||
429 | audio_resume(); | ||
430 | #endif | ||
431 | } | ||
432 | break; | 471 | break; |
433 | 472 | ||
434 | /* next */ | 473 | /* next |
474 | OR in study mode, hop by predetermined amount. */ | ||
435 | case ACTION_WPS_SKIPNEXT: | 475 | case ACTION_WPS_SKIPNEXT: |
436 | if (global_settings.party_mode) | 476 | if (global_settings.party_mode) |
437 | break; | 477 | break; |
@@ -456,18 +496,9 @@ long gui_wps_show(void) | |||
456 | /* ...otherwise, do it normally */ | 496 | /* ...otherwise, do it normally */ |
457 | #endif | 497 | #endif |
458 | 498 | ||
459 | /* take care of if we're playing a cuesheet */ | 499 | if(global_settings.study_mode) |
460 | if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) | 500 | play_hop(1); |
461 | { | 501 | else next_track(); |
462 | if (curr_cuesheet_skip(1, wps_state.id3->elapsed)) | ||
463 | { | ||
464 | /* if the result was false, then we really want | ||
465 | to skip to the next track */ | ||
466 | break; | ||
467 | } | ||
468 | } | ||
469 | |||
470 | audio_next(); | ||
471 | break; | 502 | break; |
472 | /* next / prev directories */ | 503 | /* next / prev directories */ |
473 | /* and set A-B markers if in a-b mode */ | 504 | /* and set A-B markers if in a-b mode */ |
@@ -484,7 +515,9 @@ long gui_wps_show(void) | |||
484 | else | 515 | else |
485 | #endif | 516 | #endif |
486 | { | 517 | { |
487 | audio_next_dir(); | 518 | if(global_settings.study_mode) |
519 | next_track(); | ||
520 | else audio_next_dir(); | ||
488 | } | 521 | } |
489 | break; | 522 | break; |
490 | case ACTION_WPS_ABSETA_PREVDIR: | 523 | case ACTION_WPS_ABSETA_PREVDIR: |
@@ -496,7 +529,9 @@ long gui_wps_show(void) | |||
496 | else | 529 | else |
497 | #endif | 530 | #endif |
498 | { | 531 | { |
499 | audio_prev_dir(); | 532 | if(global_settings.study_mode) |
533 | prev_track(3); | ||
534 | else audio_prev_dir(); | ||
500 | } | 535 | } |
501 | break; | 536 | break; |
502 | /* menu key functions */ | 537 | /* menu key functions */ |