From ddefd1ebfcc1bf31f63c9b98738a0cf06625218b Mon Sep 17 00:00:00 2001 From: Kjell Ericson Date: Fri, 10 Jan 2003 09:19:10 +0000 Subject: Added a thread for the simulator that counts the time. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3049 a1c6a512-1295-4272-9138-f99709370657 --- firmware/mpeg.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'firmware/mpeg.c') diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 7151baafaa..b8c922c3be 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -24,13 +24,13 @@ #include "mpeg.h" #include "ata.h" #include "string.h" +#include "kernel.h" +#include "thread.h" #ifndef SIMULATOR #include "i2c.h" #include "mas.h" #include "dac.h" #include "system.h" -#include "kernel.h" -#include "thread.h" #include "usb.h" #include "file.h" #include "hwcompat.h" @@ -2785,10 +2785,30 @@ void mpeg_set_recording_gain(int left, int right, int mic) } #endif +#ifdef SIMULATOR +static char mpeg_stack[DEFAULT_STACK_SIZE]; +static char mpeg_thread_name[] = "mpeg"; +static void mpeg_thread(void) +{ + struct mp3entry* id3; + while ( 1 ) { + if (is_playing) { + id3 = mpeg_current_track(); + id3->elapsed+=1000; + if (id3->elapsed>=id3->length) + mpeg_next(); + } + sleep(1); + } +} +#endif + void mpeg_init(int volume, int bass, int treble, int balance, int loudness, int bass_boost, int avc) { #ifdef SIMULATOR volume = bass = treble = balance = loudness = bass_boost = avc; + create_thread(mpeg_thread, mpeg_stack, + sizeof(mpeg_stack), mpeg_thread_name); #else #ifdef HAVE_MAS3507D unsigned long val; -- cgit v1.2.3