changeset 288:25d3ee009d19

audio tone amplitudes: band-aid fix for FC Luna
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Nov 2021 05:02:57 +0000
parents 3dee79757ae4
children 4d203ef0eb4b
files src/condat/com/src/driver/audio.c
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/condat/com/src/driver/audio.c	Sat Nov 13 03:20:57 2021 +0000
+++ b/src/condat/com/src/driver/audio.c	Sat Nov 13 05:02:57 2021 +0000
@@ -109,6 +109,8 @@
 #include "audio/audio_api.h"
 #endif
 
+#include "fc-target.h"
+
 /*==== DEFINE =====================================================*/
 
 #define AUDIO_TRC_EVENT(_f_)\
@@ -262,6 +264,33 @@
 * we can go down to -31 dB only. Obviously this is sufficient
 * for all currently defined sounds.
 */
+
+#ifdef CONFIG_TARGET_LUNA
+
+/*
+ * On our current Luna development platform, the main audio channel
+ * (the one that would go to the built-in earpiece speaker in a
+ * finished handset) goes to a TRRS jack into which we plug our
+ * FC-HDS4 headset.  The latter features an earpiece that is meant
+ * to be inserted into the user's ear canal.  With this arrangement
+ * TI's original dBfs amplitudes for generated audio tones are way
+ * too loud (risk of hearing damage), hence we are going to use a
+ * different set of amplitudes, much lower.
+ */
+
+#define F_425  (( 425 << 5) + 21)
+#define F_697  (( 697 << 5) + 26)
+#define F_770  (( 770 << 5) + 26)
+#define F_852  (( 852 << 5) + 26)
+#define F_941  (( 941 << 5) + 26)
+#define F_1209 ((1209 << 5) + 24)
+#define F_1336 ((1336 << 5) + 24)
+#define F_1477 ((1477 << 5) + 24)
+#define F_1633 ((1633 << 5) + 24)
+
+#else
+
+/* TI's original amplitudes */
 #define F_425  (( 425 << 5) + 7) /* (( 242 << 8 ) +  35) */
 #define F_697  (( 697 << 5) + 7) /* (( 219 << 8 ) +  56) */
 #define F_770  (( 770 << 5) + 7) /* (( 211 << 8 ) +  61) */
@@ -272,6 +301,8 @@
 #define F_1477 ((1477 << 5) + 5) /* (( 102 << 8 ) + 125) */
 #define F_1633 ((1633 << 5) + 5) /* ((  73 << 8 ) + 130) */
 
+#endif	/* CONFIG_TARGET_LUNA */
+
 #else /* (RIV_AUDIO) */
 
 #if defined (_TMS470)