summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorStepan Moskovchenko <stevenm@rockbox.org>2007-01-11 20:13:15 +0000
committerStepan Moskovchenko <stevenm@rockbox.org>2007-01-11 20:13:15 +0000
commit9cf76179ce7b2de13abd8f0049dddc7c38794159 (patch)
tree147ec881ddb0c8c6aea4134e40feac9b0b585195 /apps/plugins
parentdab59c9f708353e7fd6c7ac03a433b6a5457091b (diff)
downloadrockbox-9cf76179ce7b2de13abd8f0049dddc7c38794159.zip
rockbox-9cf76179ce7b2de13abd8f0049dddc7c38794159.tar.gz
rockbox-9cf76179ce7b2de13abd8f0049dddc7c38794159.tar.bz2
rockbox-9cf76179ce7b2de13abd8f0049dddc7c38794159.tar.xz
Make MIDI playback work on the Simulator, with sound etc. The #define stuff is a bit
dirty but it works right now. Simulator sound quality is actually better due to increased CPU resources. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11987 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/midiplay.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/apps/plugins/midiplay.c b/apps/plugins/midiplay.c
index 759535a..556cf41 100644
--- a/apps/plugins/midiplay.c
+++ b/apps/plugins/midiplay.c
@@ -78,13 +78,26 @@ PLUGIN_IRAM_DECLARE
#define FRACTSIZE 10
-#define SAMPLE_RATE 22050 // 44100 22050 11025
-#define MAX_VOICES 14 // Note: 24 midi channels is the minimum general midi
+
+#ifndef SIMULATOR
+ #define SAMPLE_RATE 22050 // 44100 22050 11025
+ #define MAX_VOICES 14 // Note: 24 midi channels is the minimum general midi
// spec implementation
+#else // Simulator requires 44100, and we can afford to use more voices
+ #define SAMPLE_RATE 44100
+ #define MAX_VOICES 48
+#endif
+
+
#define BUF_SIZE 512
#define NBUF 2
#undef SYNC
+
+#ifdef SIMULATOR
+ #define SYNC
+#endif
+
struct MIDIfile * mf IBSS_ATTR;
int numberOfSamples IBSS_ATTR;
@@ -133,10 +146,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->profstop();
#endif
-#ifndef SIMULATOR
+//#ifndef SIMULATOR
rb->pcm_play_stop();
- rb->pcm_set_frequency(44100); // 44100
-#endif
+ rb->pcm_set_frequency(SAMPLE_RATE); // 44100
+//#endif
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
rb->cpu_boost(false);
@@ -221,10 +234,10 @@ int midimain(void * filename)
if (initSynth(mf, "/.rockbox/patchset/patchset.cfg", "/.rockbox/patchset/drums.cfg") == -1)
return -1;
-#ifndef SIMULATOR
+//#ifndef SIMULATOR
rb->pcm_play_stop();
rb->pcm_set_frequency(SAMPLE_RATE); // 44100 22050 11025
-#endif
+//#endif
/*
* tick() will do one MIDI clock tick. Then, there's a loop here that
@@ -255,9 +268,9 @@ int midimain(void * filename)
} while(notesUsed == 0);
synthbuf();
-#ifndef SIMULATOR
+//#ifndef SIMULATOR
rb->pcm_play_data(&get_more, NULL, 0);
-#endif
+//#endif
int vol=0;