summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/midi/midiutil.h57
-rw-r--r--apps/plugins/mikmod/mikmod_supp.h23
-rw-r--r--apps/plugins/sdl/include/SDL_config_rockbox.h6
-rw-r--r--firmware/export/pcm_sampr.h16
4 files changed, 87 insertions, 15 deletions
diff --git a/apps/plugins/midi/midiutil.h b/apps/plugins/midi/midiutil.h
index 72bff11b3f..ee9769b108 100644
--- a/apps/plugins/midi/midiutil.h
+++ b/apps/plugins/midi/midiutil.h
@@ -27,28 +27,67 @@
27#define NBUF 2 27#define NBUF 2
28#define MAX_SAMPLES 512 28#define MAX_SAMPLES 512
29 29
30#ifndef SIMULATOR 30#ifdef SIMULATOR
31 31
32#define SAMPLE_RATE SAMPR_44 /* 44100 */ 32/* Simulator requires 44100Hz, and we can afford to use more voices */
33#define SAMPLE_RATE SAMPR_44
34#define MAX_VOICES 48
35
36#elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
37
38/* All hosted targets have CPU to spare */
39#define MAX_VOICES 48
40#define SAMPLE_RATE SAMPR_44
41
42#elif defined(CPU_PP)
33 43
34/* Some of the pp based targets can't handle too many voices 44/* Some of the pp based targets can't handle too many voices
35 mainly because they have to use 44100Hz sample rate, this could be 45 mainly because they have to use 44100Hz sample rate, this could be
36 improved to increase MAX_VOICES for targets that can do 22kHz */ 46 improved to increase MAX_VOICES for targets that can do 22kHz */
37#ifdef CPU_PP 47#define SAMPLE_RATE HW_SAMPR_MIN_GE_22
48#if HW_SAMPR_CAPS & SAMPR_CAP_22
49#define MAX_VOICES 24 /* General MIDI minimum */
50#else
38#define MAX_VOICES 16 51#define MAX_VOICES 16
39#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) 52#endif
53
54#elif defined(CPU_MIPS)
55
56/* All MIPS targets are pretty fast */
40#define MAX_VOICES 48 57#define MAX_VOICES 48
41#else 58#define SAMPLE_RATE SAMPR_44
42#define MAX_VOICES 24 /* Note: 24 midi channels is the minimum general midi spec implementation */
43#endif /* CPU_PP */
44 59
45#else /* Simulator requires 44100Hz, and we can afford to use more voices */ 60#elif defined(CPU_ARM)
46 61
62/* ARMv4 targets are slow, but treat everything else as fast */
63
64#if (ARM_ARCH >= 6)
65#define MAX_VOICES 32
47#define SAMPLE_RATE SAMPR_44 66#define SAMPLE_RATE SAMPR_44
48#define MAX_VOICES 48 67#elif (ARM_ARCH >= 5)
68#define MAX_VOICES 32
69#define SAMPLE_RATE HW_SAMPR_MIN_GE_22
70#else /* ie v4 */
71#define SAMPLE_RATE HW_SAMPR_MIN_GE_22
72#if HW_SAMPR_CAPS & SAMPR_CAP_22
73#define MAX_VOICES 24 /* General MIDI minimum */
74#else
75#define MAX_VOICES 16
76#endif
77#endif /* ARM_ARCH < 5*/
78
79#else /* !CPU_ARM */
49 80
81/* Treat everything else as slow */
82#define SAMPLE_RATE HW_SAMPR_MIN_GE_22
83#if HW_SAMPR_CAPS & SAMPR_CAP_22
84#define MAX_VOICES 24 /* General MIDI minimum */
85#else
86#define MAX_VOICES 16
50#endif 87#endif
51 88
89#endif /* Wrap it up. */
90
52#define BYTE unsigned char 91#define BYTE unsigned char
53 92
54/* Data chunk ID types, returned by readID() */ 93/* Data chunk ID types, returned by readID() */
diff --git a/apps/plugins/mikmod/mikmod_supp.h b/apps/plugins/mikmod/mikmod_supp.h
index 29fa7ebf35..ad8aaafebc 100644
--- a/apps/plugins/mikmod/mikmod_supp.h
+++ b/apps/plugins/mikmod/mikmod_supp.h
@@ -63,8 +63,29 @@ int mmsupp_sprintf(char *buf, const char *fmt, ... );
63 63
64extern const struct plugin_api * rb; 64extern const struct plugin_api * rb;
65 65
66#ifdef SIMULATOR
66 67
67#define SAMPLE_RATE SAMPR_44 /* 44100 */ 68#define SAMPLE_RATE SAMPR_44 /* Required by Simulator */
69
70#elif ((CONFIG_PLATFORM & PLATFORM_HOSTED) || defined(CPU_MIPS))
71
72#define SAMPLE_RATE SAMPR_44 /* All MIPS and hosted targets are fast */
73
74#elif defined(CPU_ARM)
75
76/* Treat ARMv5+ as fast */
77#if (ARM_ARCH >= 5)
78#define SAMPLE_RATE SAMPR_44
79#else
80#define SAMPLE_RATE SAMPR_MIN_GE_22
81#endif
82
83#else /* !CPU_ARM */
84
85/* Treat everyone else as slow */
86#define SAMPLE_RATE HW_SAMPR_MIN_GE_22
87
88#endif /* !SIMULATOR */
68 89
69#define BUF_SIZE 4096*8 90#define BUF_SIZE 4096*8
70#define NBUF 2 91#define NBUF 2
diff --git a/apps/plugins/sdl/include/SDL_config_rockbox.h b/apps/plugins/sdl/include/SDL_config_rockbox.h
index 40bd7fe177..91183ebf88 100644
--- a/apps/plugins/sdl/include/SDL_config_rockbox.h
+++ b/apps/plugins/sdl/include/SDL_config_rockbox.h
@@ -47,11 +47,7 @@
47#ifdef SIMULATOR 47#ifdef SIMULATOR
48#define RB_SAMPR SAMPR_44 48#define RB_SAMPR SAMPR_44
49#else 49#else
50#if HW_SAMPR_CAPS & SAMPR_CAP_22 50#define RB_SAMPR HW_SAMPR_MIN_GE_22 /* Min HW rate at least 22KHz */
51#define RB_SAMPR SAMPR_22
52#else
53#define RB_SAMPR HW_SAMPR_MIN
54#endif
55#endif 51#endif
56 52
57/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */ 53/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
diff --git a/firmware/export/pcm_sampr.h b/firmware/export/pcm_sampr.h
index dcb1bdd80f..84f4466308 100644
--- a/firmware/export/pcm_sampr.h
+++ b/firmware/export/pcm_sampr.h
@@ -80,6 +80,11 @@
80 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ 80 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \
81 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8) 81 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
82 82
83/* List of sampling rates that are good enough for most purposes. */
84#define SAMPR_CAP_ALL_GE_22 (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \
85 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
86 SAMPR_CAP_24 | SAMPR_CAP_22)
87
83#ifndef PCM_SAMPR_CONFIG_ONLY 88#ifndef PCM_SAMPR_CONFIG_ONLY
84/* Master list of all "standard" rates supported. */ 89/* Master list of all "standard" rates supported. */
85extern const unsigned long audio_master_sampr_list[SAMPR_NUM_FREQ]; 90extern const unsigned long audio_master_sampr_list[SAMPR_NUM_FREQ];
@@ -231,6 +236,17 @@ extern const unsigned long hw_freq_sampr[HW_NUM_FREQ];
231# define HW_SAMPR_MIN SAMPR_44 236# define HW_SAMPR_MIN SAMPR_44
232#endif 237#endif
233 238
239#define HW_SAMPR_CAPS_QUAL (HW_SAMPR_CAPS & SAMPR_CAP_ALL_GE_22)
240#if HW_SAMPR_CAPS_QUAL & SAMPR_CAP_22
241# define HW_SAMPR_MIN_GE_22 SAMPR_22
242#elif HW_SAMPR_CAPS_QUAL & SAMPR_CAP_24
243# define HW_SAMPR_MIN_GE_22 SAMPR_24
244#elif HW_SAMPR_CAPS_QUAL & SAMPR_CAP_32
245# define HW_SAMPR_MIN_GE_22 SAMPR_32
246#else
247# define HW_SAMPR_MIN_GE_22 SAMPR_44
248#endif
249
234#ifdef HAVE_RECORDING 250#ifdef HAVE_RECORDING
235 251
236#ifndef PCM_SAMPR_CONFIG_ONLY 252#ifndef PCM_SAMPR_CONFIG_ONLY