summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/cuesheet.c17
-rw-r--r--apps/cuesheet.h5
-rw-r--r--apps/gui/gwps-common.c2
-rw-r--r--apps/gui/gwps.c4
4 files changed, 14 insertions, 14 deletions
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index aaa2670a40..deb0769320 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -317,12 +317,11 @@ bool display_cuesheet_content(char* filename)
317 * it also returns false if we weren't in a cuesheet. 317 * it also returns false if we weren't in a cuesheet.
318 * direction should be 1 or -1. 318 * direction should be 1 or -1.
319 */ 319 */
320bool curr_cuesheet_skip(int direction, unsigned long curr_pos) 320bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_pos)
321{ 321{
322 struct cuesheet *curr_cue = audio_current_track()->cuesheet; 322 int track = cue_find_current_track(cue, curr_pos);
323 int track = cue_find_current_track(curr_cue, curr_pos);
324 323
325 if (direction >= 0 && track == curr_cue->track_count - 1) 324 if (direction >= 0 && track == cue->track_count - 1)
326 { 325 {
327 /* we want to get out of the cuesheet */ 326 /* we want to get out of the cuesheet */
328 return false; 327 return false;
@@ -332,7 +331,7 @@ bool curr_cuesheet_skip(int direction, unsigned long curr_pos)
332 if (!(direction <= 0 && track == 0)) 331 if (!(direction <= 0 && track == 0))
333 track += direction; 332 track += direction;
334 333
335 seek(curr_cue->tracks[track].offset); 334 seek(cue->tracks[track].offset);
336 return true; 335 return true;
337 } 336 }
338 337
@@ -372,15 +371,15 @@ static inline void draw_veritcal_line_mark(struct screen * screen,
372 371
373/* draw the cuesheet markers for a track of length "tracklen", 372/* draw the cuesheet markers for a track of length "tracklen",
374 between (x1,y) and (x2,y) */ 373 between (x1,y) and (x2,y) */
375void cue_draw_markers(struct screen *screen, unsigned long tracklen, 374void cue_draw_markers(struct screen *screen, struct cuesheet *cue,
375 unsigned long tracklen,
376 int x1, int x2, int y, int h) 376 int x1, int x2, int y, int h)
377{ 377{
378 struct cuesheet *curr_cue = audio_current_track()->cuesheet;
379 int i,xi; 378 int i,xi;
380 int w = x2 - x1; 379 int w = x2 - x1;
381 for (i=1; i < curr_cue->track_count; i++) 380 for (i=1; i < cue->track_count; i++)
382 { 381 {
383 xi = x1 + (w * curr_cue->tracks[i].offset)/tracklen; 382 xi = x1 + (w * cue->tracks[i].offset)/tracklen;
384 draw_veritcal_line_mark(screen, xi, y, h); 383 draw_veritcal_line_mark(screen, xi, y, h);
385 } 384 }
386} 385}
diff --git a/apps/cuesheet.h b/apps/cuesheet.h
index 8ee0f6b3a7..c5d736573b 100644
--- a/apps/cuesheet.h
+++ b/apps/cuesheet.h
@@ -73,11 +73,12 @@ int cue_find_current_track(struct cuesheet *cue, unsigned long curpos);
73void cue_spoof_id3(struct cuesheet *cue, struct mp3entry *id3); 73void cue_spoof_id3(struct cuesheet *cue, struct mp3entry *id3);
74 74
75/* skip to next track in the cuesheet towards "direction" (which is 1 or -1) */ 75/* skip to next track in the cuesheet towards "direction" (which is 1 or -1) */
76bool curr_cuesheet_skip(int direction, unsigned long curr_pos); 76bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_pos);
77 77
78#ifdef HAVE_LCD_BITMAP 78#ifdef HAVE_LCD_BITMAP
79/* draw track markers on the progressbar */ 79/* draw track markers on the progressbar */
80void cue_draw_markers(struct screen *screen, unsigned long tracklen, 80void cue_draw_markers(struct screen *screen, struct cuesheet *cue,
81 unsigned long tracklen,
81 int x1, int x2, int y, int h); 82 int x1, int x2, int y, int h);
82#endif 83#endif
83 84
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index da70f0e451..721682f248 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -412,7 +412,7 @@ static void draw_progressbar(struct gui_wps *gwps,
412#endif 412#endif
413 413
414 if (state->id3->cuesheet) 414 if (state->id3->cuesheet)
415 cue_draw_markers(display, state->id3->length, 415 cue_draw_markers(display, state->id3->cuesheet, state->id3->length,
416 pb->x, pb->x + pb->width, y+1, pb->height-2); 416 pb->x, pb->x + pb->width, y+1, pb->height-2);
417} 417}
418 418
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 154864a280..10c2a6806b 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -151,7 +151,7 @@ static void prev_track(unsigned long skip_thresh)
151 { 151 {
152 if (wps_state.id3->cuesheet) 152 if (wps_state.id3->cuesheet)
153 { 153 {
154 curr_cuesheet_skip(-1, wps_state.id3->elapsed); 154 curr_cuesheet_skip(wps_state.id3->cuesheet, -1, wps_state.id3->elapsed);
155 return; 155 return;
156 } 156 }
157 157
@@ -176,7 +176,7 @@ static void next_track(void)
176 /* take care of if we're playing a cuesheet */ 176 /* take care of if we're playing a cuesheet */
177 if (wps_state.id3->cuesheet) 177 if (wps_state.id3->cuesheet)
178 { 178 {
179 if (curr_cuesheet_skip(1, wps_state.id3->elapsed)) 179 if (curr_cuesheet_skip(wps_state.id3->cuesheet, 1, wps_state.id3->elapsed))
180 { 180 {
181 /* if the result was false, then we really want 181 /* if the result was false, then we really want
182 to skip to the next track */ 182 to skip to the next track */