mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-29 08:46:24 -04:00
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
This commit is contained in:
parent
dab59c9f70
commit
9cf76179ce
1 changed files with 22 additions and 9 deletions
|
|
@ -78,13 +78,26 @@ PLUGIN_IRAM_DECLARE
|
||||||
|
|
||||||
|
|
||||||
#define FRACTSIZE 10
|
#define FRACTSIZE 10
|
||||||
|
|
||||||
|
#ifndef SIMULATOR
|
||||||
#define SAMPLE_RATE 22050 // 44100 22050 11025
|
#define SAMPLE_RATE 22050 // 44100 22050 11025
|
||||||
#define MAX_VOICES 14 // Note: 24 midi channels is the minimum general midi
|
#define MAX_VOICES 14 // Note: 24 midi channels is the minimum general midi
|
||||||
// spec implementation
|
// 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 BUF_SIZE 512
|
||||||
#define NBUF 2
|
#define NBUF 2
|
||||||
|
|
||||||
#undef SYNC
|
#undef SYNC
|
||||||
|
|
||||||
|
#ifdef SIMULATOR
|
||||||
|
#define SYNC
|
||||||
|
#endif
|
||||||
|
|
||||||
struct MIDIfile * mf IBSS_ATTR;
|
struct MIDIfile * mf IBSS_ATTR;
|
||||||
|
|
||||||
int numberOfSamples IBSS_ATTR;
|
int numberOfSamples IBSS_ATTR;
|
||||||
|
|
@ -133,10 +146,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
rb->profstop();
|
rb->profstop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
//#ifndef SIMULATOR
|
||||||
rb->pcm_play_stop();
|
rb->pcm_play_stop();
|
||||||
rb->pcm_set_frequency(44100); // 44100
|
rb->pcm_set_frequency(SAMPLE_RATE); // 44100
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||||
rb->cpu_boost(false);
|
rb->cpu_boost(false);
|
||||||
|
|
@ -221,10 +234,10 @@ int midimain(void * filename)
|
||||||
if (initSynth(mf, "/.rockbox/patchset/patchset.cfg", "/.rockbox/patchset/drums.cfg") == -1)
|
if (initSynth(mf, "/.rockbox/patchset/patchset.cfg", "/.rockbox/patchset/drums.cfg") == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
//#ifndef SIMULATOR
|
||||||
rb->pcm_play_stop();
|
rb->pcm_play_stop();
|
||||||
rb->pcm_set_frequency(SAMPLE_RATE); // 44100 22050 11025
|
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
|
* 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);
|
} while(notesUsed == 0);
|
||||||
|
|
||||||
synthbuf();
|
synthbuf();
|
||||||
#ifndef SIMULATOR
|
//#ifndef SIMULATOR
|
||||||
rb->pcm_play_data(&get_more, NULL, 0);
|
rb->pcm_play_data(&get_more, NULL, 0);
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
int vol=0;
|
int vol=0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue