From e5792d6f6cd4e672767bea8850fe45f90780829e Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Thu, 25 Jul 2002 23:12:41 +0000 Subject: First step towards better ID3 handling git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1450 a1c6a512-1295-4272-9138-f99709370657 --- firmware/mpeg.c | 24 ++++++++++++++++++++++-- firmware/mpeg.h | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'firmware') diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 082ed5067c..00b2d660a3 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -139,11 +139,13 @@ int mpeg_sound_default(int setting) } /* list of tracks in memory */ -#define MAX_ID3_TAGS 4 +#define MAX_ID3_TAGS 12 static struct { struct mp3entry id3; int mempos; } id3tags[MAX_ID3_TAGS]; +static unsigned int current_track_counter = 0; +static unsigned int last_track_counter = 0; #ifndef SIMULATOR static int last_tag = 0; @@ -582,6 +584,8 @@ static void mpeg_thread(void) /* Tell the file loading code that we want to start playing as soon as we have some data */ play_pending = true; + + current_track_counter++; break; case MPEG_STOP: @@ -629,6 +633,8 @@ static void mpeg_thread(void) /* Tell the file loading code that we want to start playing as soon as we have some data */ play_pending = true; + + current_track_counter++; } break; @@ -655,6 +661,8 @@ static void mpeg_thread(void) /* Tell the file loading code that we want to start playing as soon as we have some data */ play_pending = true; + + current_track_counter++; } break; @@ -820,6 +828,8 @@ static void mpeg_thread(void) DEBUGF("tc: %d, %x\n", i, id3tags[i].mempos); } last_tag--; + + current_track_counter++; break; case SYS_USB_CONNECTED: @@ -885,6 +895,16 @@ struct mp3entry* mpeg_current_track(void) return &(id3tags[0].id3); } +bool mpeg_has_changed_track(void) +{ + if(last_track_counter != current_track_counter) + { + last_track_counter = current_track_counter; + return true; + } + return false; +} + void mpeg_play(char* trackname) { #ifdef SIMULATOR @@ -1196,5 +1216,5 @@ void mpeg_init(int volume, int bass, int treble, int loudness, int bass_boost, i mpeg_sound_set(SOUND_SUPERBASS, bass_boost); mpeg_sound_set(SOUND_AVC, avc); #endif -#endif /* SIMULATOR */ +#endif /* !SIMULATOR */ } diff --git a/firmware/mpeg.h b/firmware/mpeg.h index 6a86b3400d..a267079579 100644 --- a/firmware/mpeg.h +++ b/firmware/mpeg.h @@ -37,6 +37,7 @@ int mpeg_val2phys(int setting, int value); char *mpeg_sound_unit(int setting); int mpeg_sound_numdecimals(int setting); struct mp3entry* mpeg_current_track(void); +bool mpeg_has_changed_track(void); #define SOUND_VOLUME 0 #define SOUND_BASS 1 -- cgit v1.2.3