summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ericson <kjell@haxx.se>2003-01-10 09:19:10 +0000
committerKjell Ericson <kjell@haxx.se>2003-01-10 09:19:10 +0000
commitddefd1ebfcc1bf31f63c9b98738a0cf06625218b (patch)
tree4b1b37fc36e9e1d8ed827fe3d98a33b860970a65
parentbade4f7d9a41176fd5892417cc4a89e0dde8403d (diff)
downloadrockbox-ddefd1ebfcc1bf31f63c9b98738a0cf06625218b.zip
rockbox-ddefd1ebfcc1bf31f63c9b98738a0cf06625218b.tar.gz
rockbox-ddefd1ebfcc1bf31f63c9b98738a0cf06625218b.tar.bz2
rockbox-ddefd1ebfcc1bf31f63c9b98738a0cf06625218b.tar.xz
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
-rw-r--r--firmware/mpeg.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 7151baa..b8c922c 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;