summaryrefslogtreecommitdiff
path: root/firmware/target/sh/archos/audio-archos.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/sh/archos/audio-archos.c')
-rw-r--r--firmware/target/sh/archos/audio-archos.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/firmware/target/sh/archos/audio-archos.c b/firmware/target/sh/archos/audio-archos.c
index e2d8b6f157..9dfcb9cb97 100644
--- a/firmware/target/sh/archos/audio-archos.c
+++ b/firmware/target/sh/archos/audio-archos.c
@@ -52,10 +52,6 @@ extern unsigned shadow_codec_reg0;
52static bool paused; /* playback is paused */ 52static bool paused; /* playback is paused */
53static bool playing; /* We are playing an MP3 stream */ 53static bool playing; /* We are playing an MP3 stream */
54 54
55/* for measuring the play time */
56static long playstart_tick;
57static long cumulative_ticks;
58
59/* the registered callback function to ask for more mp3 data */ 55/* the registered callback function to ask for more mp3 data */
60static void (*callback_for_more)(unsigned char**, size_t*); 56static void (*callback_for_more)(unsigned char**, size_t*);
61 57
@@ -461,6 +457,7 @@ void mp3_shutdown(void)
461 457
462/* new functions, to be exported to plugin API */ 458/* new functions, to be exported to plugin API */
463 459
460#if CONFIG_CODEC == MAS3587F
464void mp3_play_init(void) 461void mp3_play_init(void)
465{ 462{
466#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 463#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
@@ -469,8 +466,8 @@ void mp3_play_init(void)
469 playing = false; 466 playing = false;
470 paused = true; 467 paused = true;
471 callback_for_more = NULL; 468 callback_for_more = NULL;
472 mp3_reset_playtime();
473} 469}
470#endif
474 471
475void mp3_play_data(const unsigned char* start, int size, 472void mp3_play_data(const unsigned char* start, int size,
476 void (*get_more)(unsigned char** start, size_t* size) /* callback fn */ 473 void (*get_more)(unsigned char** start, size_t* size) /* callback fn */
@@ -503,13 +500,11 @@ void mp3_play_pause(bool play)
503 { /* resume playback */ 500 { /* resume playback */
504 SCR0 |= 0x80; 501 SCR0 |= 0x80;
505 paused = false; 502 paused = false;
506 playstart_tick = current_tick;
507 } 503 }
508 else if (!paused && !play) 504 else if (!paused && !play)
509 { /* stop playback */ 505 { /* stop playback */
510 SCR0 &= 0x7f; 506 SCR0 &= 0x7f;
511 paused = true; 507 paused = true;
512 cumulative_ticks += current_tick - playstart_tick;
513 } 508 }
514} 509}
515 510
@@ -536,20 +531,6 @@ void mp3_play_stop(void)
536#endif 531#endif
537} 532}
538 533
539long mp3_get_playtime(void)
540{
541 if (paused)
542 return cumulative_ticks;
543 else
544 return cumulative_ticks + current_tick - playstart_tick;
545}
546
547void mp3_reset_playtime(void)
548{
549 cumulative_ticks = 0;
550 playstart_tick = current_tick;
551}
552
553bool mp3_is_playing(void) 534bool mp3_is_playing(void)
554{ 535{
555 return playing; 536 return playing;