summaryrefslogtreecommitdiffstats
path: root/apps/plugins/mikmod
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-08-07 17:16:48 -0400
committerSolomon Peachy <pizza@shaftnet.org>2019-08-08 22:37:30 +0200
commit5b23c9eb0a97534f0d0fc3aa0c1ad302199eb8dc (patch)
tree7151fdb71b085b9a43113832c0d478b84bfbbf49 /apps/plugins/mikmod
parenta430e275dddab24059ba15d2621e518562392540 (diff)
downloadrockbox-5b23c9eb0a97534f0d0fc3aa0c1ad302199eb8dc.tar.gz
rockbox-5b23c9eb0a97534f0d0fc3aa0c1ad302199eb8dc.tar.bz2
rockbox-5b23c9eb0a97534f0d0fc3aa0c1ad302199eb8dc.zip
Introduce HW_SAMPR_MIN_GE_22 macro
Gives us the lowest HW sample rate that's >= 22KHz. Needed because some targets that don't support 22K support 11K or 8K, so HW_SAMPR_MIN will give us much lower quality than is acceptable. Take advantage of this new macro in the SDL, MIDI, and MIKMOD plugins, and implement a crude "fast enough" test to enable higher sample rates on more capable targets. Change-Id: I6ad38026fb3410c62da028e78512e027729bb851
Diffstat (limited to 'apps/plugins/mikmod')
-rw-r--r--apps/plugins/mikmod/mikmod_supp.h23
1 files changed, 22 insertions, 1 deletions
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, ... );
extern const struct plugin_api * rb;
+#ifdef SIMULATOR
-#define SAMPLE_RATE SAMPR_44 /* 44100 */
+#define SAMPLE_RATE SAMPR_44 /* Required by Simulator */
+
+#elif ((CONFIG_PLATFORM & PLATFORM_HOSTED) || defined(CPU_MIPS))
+
+#define SAMPLE_RATE SAMPR_44 /* All MIPS and hosted targets are fast */
+
+#elif defined(CPU_ARM)
+
+/* Treat ARMv5+ as fast */
+#if (ARM_ARCH >= 5)
+#define SAMPLE_RATE SAMPR_44
+#else
+#define SAMPLE_RATE SAMPR_MIN_GE_22
+#endif
+
+#else /* !CPU_ARM */
+
+/* Treat everyone else as slow */
+#define SAMPLE_RATE HW_SAMPR_MIN_GE_22
+
+#endif /* !SIMULATOR */
#define BUF_SIZE 4096*8
#define NBUF 2