diff options
author | Stepan Moskovchenko <stevenm@rockbox.org> | 2007-01-11 20:13:15 +0000 |
---|---|---|
committer | Stepan Moskovchenko <stevenm@rockbox.org> | 2007-01-11 20:13:15 +0000 |
commit | 9cf76179ce7b2de13abd8f0049dddc7c38794159 (patch) | |
tree | 147ec881ddb0c8c6aea4134e40feac9b0b585195 /apps/plugins | |
parent | dab59c9f708353e7fd6c7ac03a433b6a5457091b (diff) | |
download | rockbox-9cf76179ce7b2de13abd8f0049dddc7c38794159.tar.gz rockbox-9cf76179ce7b2de13abd8f0049dddc7c38794159.zip |
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.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/apps/plugins/midiplay.c b/apps/plugins/midiplay.c index 759535ac9e..556cf41cb2 100644 --- a/apps/plugins/midiplay.c +++ b/apps/plugins/midiplay.c | |||
@@ -78,13 +78,26 @@ PLUGIN_IRAM_DECLARE | |||
78 | 78 | ||
79 | 79 | ||
80 | #define FRACTSIZE 10 | 80 | #define FRACTSIZE 10 |
81 | #define SAMPLE_RATE 22050 // 44100 22050 11025 | 81 | |
82 | #define MAX_VOICES 14 // Note: 24 midi channels is the minimum general midi | 82 | #ifndef SIMULATOR |
83 | #define SAMPLE_RATE 22050 // 44100 22050 11025 | ||
84 | #define MAX_VOICES 14 // Note: 24 midi channels is the minimum general midi | ||
83 | // spec implementation | 85 | // spec implementation |
86 | #else // Simulator requires 44100, and we can afford to use more voices | ||
87 | #define SAMPLE_RATE 44100 | ||
88 | #define MAX_VOICES 48 | ||
89 | #endif | ||
90 | |||
91 | |||
84 | #define BUF_SIZE 512 | 92 | #define BUF_SIZE 512 |
85 | #define NBUF 2 | 93 | #define NBUF 2 |
86 | 94 | ||
87 | #undef SYNC | 95 | #undef SYNC |
96 | |||
97 | #ifdef SIMULATOR | ||
98 | #define SYNC | ||
99 | #endif | ||
100 | |||
88 | struct MIDIfile * mf IBSS_ATTR; | 101 | struct MIDIfile * mf IBSS_ATTR; |
89 | 102 | ||
90 | int numberOfSamples IBSS_ATTR; | 103 | int numberOfSamples IBSS_ATTR; |
@@ -133,10 +146,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
133 | rb->profstop(); | 146 | rb->profstop(); |
134 | #endif | 147 | #endif |
135 | 148 | ||
136 | #ifndef SIMULATOR | 149 | //#ifndef SIMULATOR |
137 | rb->pcm_play_stop(); | 150 | rb->pcm_play_stop(); |
138 | rb->pcm_set_frequency(44100); // 44100 | 151 | rb->pcm_set_frequency(SAMPLE_RATE); // 44100 |
139 | #endif | 152 | //#endif |
140 | 153 | ||
141 | #if defined(HAVE_ADJUSTABLE_CPU_FREQ) | 154 | #if defined(HAVE_ADJUSTABLE_CPU_FREQ) |
142 | rb->cpu_boost(false); | 155 | rb->cpu_boost(false); |
@@ -221,10 +234,10 @@ int midimain(void * filename) | |||
221 | if (initSynth(mf, "/.rockbox/patchset/patchset.cfg", "/.rockbox/patchset/drums.cfg") == -1) | 234 | if (initSynth(mf, "/.rockbox/patchset/patchset.cfg", "/.rockbox/patchset/drums.cfg") == -1) |
222 | return -1; | 235 | return -1; |
223 | 236 | ||
224 | #ifndef SIMULATOR | 237 | //#ifndef SIMULATOR |
225 | rb->pcm_play_stop(); | 238 | rb->pcm_play_stop(); |
226 | rb->pcm_set_frequency(SAMPLE_RATE); // 44100 22050 11025 | 239 | rb->pcm_set_frequency(SAMPLE_RATE); // 44100 22050 11025 |
227 | #endif | 240 | //#endif |
228 | 241 | ||
229 | /* | 242 | /* |
230 | * tick() will do one MIDI clock tick. Then, there's a loop here that | 243 | * tick() will do one MIDI clock tick. Then, there's a loop here that |
@@ -255,9 +268,9 @@ int midimain(void * filename) | |||
255 | } while(notesUsed == 0); | 268 | } while(notesUsed == 0); |
256 | 269 | ||
257 | synthbuf(); | 270 | synthbuf(); |
258 | #ifndef SIMULATOR | 271 | //#ifndef SIMULATOR |
259 | rb->pcm_play_data(&get_more, NULL, 0); | 272 | rb->pcm_play_data(&get_more, NULL, 0); |
260 | #endif | 273 | //#endif |
261 | 274 | ||
262 | int vol=0; | 275 | int vol=0; |
263 | 276 | ||