summaryrefslogtreecommitdiffstats
path: root/firmware
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 /firmware
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 'firmware')
-rw-r--r--firmware/export/pcm_sampr.h16
1 files changed, 16 insertions, 0 deletions
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 @@
SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \
SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
+/* List of sampling rates that are good enough for most purposes. */
+#define SAMPR_CAP_ALL_GE_22 (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \
+ SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
+ SAMPR_CAP_24 | SAMPR_CAP_22)
+
#ifndef PCM_SAMPR_CONFIG_ONLY
/* Master list of all "standard" rates supported. */
extern const unsigned long audio_master_sampr_list[SAMPR_NUM_FREQ];
@@ -231,6 +236,17 @@ extern const unsigned long hw_freq_sampr[HW_NUM_FREQ];
# define HW_SAMPR_MIN SAMPR_44
#endif
+#define HW_SAMPR_CAPS_QUAL (HW_SAMPR_CAPS & SAMPR_CAP_ALL_GE_22)
+#if HW_SAMPR_CAPS_QUAL & SAMPR_CAP_22
+# define HW_SAMPR_MIN_GE_22 SAMPR_22
+#elif HW_SAMPR_CAPS_QUAL & SAMPR_CAP_24
+# define HW_SAMPR_MIN_GE_22 SAMPR_24
+#elif HW_SAMPR_CAPS_QUAL & SAMPR_CAP_32
+# define HW_SAMPR_MIN_GE_22 SAMPR_32
+#else
+# define HW_SAMPR_MIN_GE_22 SAMPR_44
+#endif
+
#ifdef HAVE_RECORDING
#ifndef PCM_SAMPR_CONFIG_ONLY