summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/gwps-common.c64
-rw-r--r--apps/gui/gwps.c48
2 files changed, 108 insertions, 4 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 53b12238e4..b6e64d2fcc 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -53,6 +53,7 @@
53#endif 53#endif
54#include "dsp.h" 54#include "dsp.h"
55#include "action.h" 55#include "action.h"
56#include "cuesheet.h"
56 57
57#ifdef HAVE_LCD_CHARCELLS 58#ifdef HAVE_LCD_CHARCELLS
58static bool draw_player_progress(struct gui_wps *gwps); 59static bool draw_player_progress(struct gui_wps *gwps);
@@ -1850,6 +1851,14 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1850 data->progress_start, data->progress_end, sb_y, 1851 data->progress_start, data->progress_end, sb_y,
1851 data->progress_height); 1852 data->progress_height);
1852#endif 1853#endif
1854
1855 if (cuesheet_is_enabled() && state->id3->cuesheet_type)
1856 {
1857 cue_draw_markers(display, state->id3->length,
1858 data->progress_start, data->progress_end,
1859 sb_y+1, data->progress_height-2);
1860 }
1861
1853 update_line = true; 1862 update_line = true;
1854 } 1863 }
1855 if (flags & refresh_mode & WPS_REFRESH_PEAK_METER) { 1864 if (flags & refresh_mode & WPS_REFRESH_PEAK_METER) {
@@ -2561,6 +2570,35 @@ bool update(struct gui_wps *gwps)
2561 { 2570 {
2562 gwps->display->stop_scroll(); 2571 gwps->display->stop_scroll();
2563 gwps->state->id3 = audio_current_track(); 2572 gwps->state->id3 = audio_current_track();
2573
2574 if (cuesheet_is_enabled() && gwps->state->id3->cuesheet_type
2575 && strcmp(gwps->state->id3->path, curr_cue->audio_filename))
2576 {
2577 /* the current cuesheet isn't the right one any more */
2578
2579 if (!strcmp(gwps->state->id3->path, temp_cue->audio_filename)) {
2580 /* We have the new cuesheet in memory (temp_cue),
2581 let's make it the current one ! */
2582 memcpy(curr_cue, temp_cue, sizeof(struct cuesheet));
2583 }
2584 else {
2585 /* We need to parse the new cuesheet */
2586
2587 char cuepath[MAX_PATH];
2588 strncpy(cuepath, gwps->state->id3->path, MAX_PATH);
2589 char *dot = strrchr(cuepath, '.');
2590 strcpy(dot, ".cue");
2591
2592 if (parse_cuesheet(cuepath, curr_cue))
2593 {
2594 gwps->state->id3->cuesheet_type = 1;
2595 strcpy(curr_cue->audio_filename, gwps->state->id3->path);
2596 }
2597 }
2598
2599 cue_spoof_id3(curr_cue, gwps->state->id3);
2600 }
2601
2564 if (gui_wps_display()) 2602 if (gui_wps_display())
2565 retcode = true; 2603 retcode = true;
2566 else{ 2604 else{
@@ -2572,12 +2610,34 @@ bool update(struct gui_wps *gwps)
2572 sizeof(gwps->state->current_track_path)); 2610 sizeof(gwps->state->current_track_path));
2573 } 2611 }
2574 2612
2613 if (cuesheet_is_enabled() && gwps->state->id3->cuesheet_type
2614 && (gwps->state->id3->elapsed < curr_cue->curr_track->offset
2615 || (curr_cue->curr_track_idx < curr_cue->track_count - 1
2616 && gwps->state->id3->elapsed >= (curr_cue->curr_track+1)->offset)))
2617 {
2618 /* We've changed tracks within the cuesheet :
2619 we need to update the ID3 info and refresh the WPS */
2620
2621 cue_find_current_track(curr_cue, gwps->state->id3->elapsed);
2622 cue_spoof_id3(curr_cue, gwps->state->id3);
2623
2624 gwps->display->stop_scroll();
2625 if (gui_wps_display())
2626 retcode = true;
2627 else{
2628 gui_wps_refresh(gwps, 0, WPS_REFRESH_ALL);
2629 }
2630 gui_wps_statusbar_draw(gwps, false);
2631
2632 return retcode;
2633 }
2634
2575 if (gwps->state->id3) 2635 if (gwps->state->id3)
2576 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); 2636 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC);
2577 2637
2578 gui_wps_statusbar_draw(gwps, false); 2638 gui_wps_statusbar_draw(gwps, false);
2579 2639
2580 return retcode; 2640 return retcode;
2581} 2641}
2582 2642
2583 2643
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 7128a958f7..00290a8871 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -54,6 +54,7 @@
54#include "abrepeat.h" 54#include "abrepeat.h"
55#include "playback.h" 55#include "playback.h"
56#include "splash.h" 56#include "splash.h"
57#include "cuesheet.h"
57#if LCD_DEPTH > 1 58#if LCD_DEPTH > 1
58#include "backdrop.h" 59#include "backdrop.h"
59#endif 60#endif
@@ -333,7 +334,16 @@ long gui_wps_show(void)
333 if (global_settings.party_mode) 334 if (global_settings.party_mode)
334 break; 335 break;
335 if (current_tick -last_right < HZ) 336 if (current_tick -last_right < HZ)
336 audio_next_dir(); 337 {
338 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
339 {
340 audio_next();
341 }
342 else
343 {
344 audio_next_dir();
345 }
346 }
337 else ffwd_rew(ACTION_WPS_SEEKFWD); 347 else ffwd_rew(ACTION_WPS_SEEKFWD);
338 last_right = 0; 348 last_right = 0;
339 break; 349 break;
@@ -343,7 +353,22 @@ long gui_wps_show(void)
343 if (global_settings.party_mode) 353 if (global_settings.party_mode)
344 break; 354 break;
345 if (current_tick -last_left < HZ) 355 if (current_tick -last_left < HZ)
346 audio_prev_dir(); 356 {
357 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
358 {
359 if (!wps_state.paused)
360#if (CONFIG_CODEC == SWCODEC)
361 audio_pre_ff_rewind();
362#else
363 audio_pause();
364#endif
365 audio_ff_rewind(0);
366 }
367 else
368 {
369 audio_prev_dir();
370 }
371 }
347 else ffwd_rew(ACTION_WPS_SEEKBACK); 372 else ffwd_rew(ACTION_WPS_SEEKBACK);
348 last_left = 0; 373 last_left = 0;
349 break; 374 break;
@@ -377,6 +402,13 @@ long gui_wps_show(void)
377 audio_prev(); 402 audio_prev();
378 } 403 }
379 else { 404 else {
405
406 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
407 {
408 curr_cuesheet_skip(-1, wps_state.id3->elapsed);
409 break;
410 }
411
380 if (!wps_state.paused) 412 if (!wps_state.paused)
381#if (CONFIG_CODEC == SWCODEC) 413#if (CONFIG_CODEC == SWCODEC)
382 audio_pre_ff_rewind(); 414 audio_pre_ff_rewind();
@@ -417,6 +449,18 @@ long gui_wps_show(void)
417 } 449 }
418 /* ...otherwise, do it normally */ 450 /* ...otherwise, do it normally */
419#endif 451#endif
452
453 /* take care of if we're playing a cuesheet */
454 if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
455 {
456 if (curr_cuesheet_skip(1, wps_state.id3->elapsed))
457 {
458 /* if the result was false, then we really want
459 to skip to the next track */
460 break;
461 }
462 }
463
420 audio_next(); 464 audio_next();
421 break; 465 break;
422 /* next / prev directories */ 466 /* next / prev directories */