diff options
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r-- | apps/gui/gwps-common.c | 64 |
1 files changed, 62 insertions, 2 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 |
58 | static bool draw_player_progress(struct gui_wps *gwps); | 59 | static 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 | ||