Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 25840)
+++ apps/lang/english.lang (working copy)
@@ -11565,15 +11565,15 @@
user: core
*: none
- ipodvideo: "Bass Cutoff"
+ gigabeats,ipodvideo: "Bass Cutoff"
*: none
- ipodvideo: "Bass Cutoff"
+ gigabeats,ipodvideo: "Bass Cutoff"
*: none
- ipodvideo: "Bass Cutoff"
+ gigabeats,ipodvideo: "Bass Cutoff"
@@ -11582,15 +11582,15 @@
user: core
*: none
- ipodvideo: "Treble Cutoff"
+ gigabeats,ipodvideo: "Treble Cutoff"
*: none
- ipodvideo: "Treble Cutoff"
+ gigabeats,ipodvideo: "Treble Cutoff"
*: none
- ipodvideo: "Treble Cutoff"
+ gigabeats,ipodvideo: "Treble Cutoff"
@@ -13528,3 +13528,122 @@
swcodec: "Rewind before resume"
+
+ id: LANG_LOW_MID
+ desc: in sound_settings
+ user: core
+
+ *: none
+ gigabeats: "Low-Mid"
+
+
+ *: none
+ gigabeats: "Low-Mid"
+
+
+ *: none
+ gigabeats: "Low-Mid"
+
+
+
+ id: LANG_MID
+ desc: in sound_settings
+ user: core
+
+ *: none
+ gigabeats: "Mid"
+
+
+ *: none
+ gigabeats: "Mid"
+
+
+ *: none
+ gigabeats: "Mid"
+
+
+
+ id: LANG_HIGH_MID
+ desc: in sound_settings
+ user: core
+
+ *: none
+ gigabeats: "High-Mid"
+
+
+ *: none
+ gigabeats: "High-Mid"
+
+
+ *: none
+ gigabeats: "High-Mid"
+
+
+
+ id: LANG_LOW_MID_CENTER
+ desc: Low-Mid setting center frequency
+ user: core
+
+ *: none
+ gigabeats: "Low-Mid Center"
+
+
+ *: none
+ gigabeats: "Low-Mid Center"
+
+
+ *: none
+ gigabeats: "Low-Mid Center"
+
+
+
+ id: LANG_MID_CENTER
+ desc: Mid setting center frequency
+ user: core
+
+ *: none
+ gigabeats: "Mid Center"
+
+
+ *: none
+ gigabeats: "Mid Center"
+
+
+ *: none
+ gigabeats: "Mid Center"
+
+
+
+ id: LANG_HIGH_MID_CENTER
+ desc: High-Mid setting center frequency
+ user: core
+
+ *: none
+ gigabeats: "High-Mid Center"
+
+
+ *: none
+ gigabeats: "High-Mid Center"
+
+
+ *: none
+ gigabeats: "High-Mid Center"
+
+
+
+ id: LANG_DEPTH_3D
+ desc: Amount of 3D enhancement effect
+ user: core
+
+ *: none
+ gigabeats: "3-D Enhancement"
+
+
+ *: none
+ gigabeats: "3-D Enhancement"
+
+
+ *: none
+ gigabeats: "3-D Enhancement"
+
+
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 25840)
+++ apps/settings.h (working copy)
@@ -336,7 +336,7 @@
bool superbass; /* true/false */
#endif
-#ifdef HAVE_WM8758
+#if defined(HAVE_WM8758) || defined(HAVE_WM8978)
int bass_cutoff;
int treble_cutoff;
#endif
@@ -827,6 +827,16 @@
/* When resuming playback (after a stop), rewind this number of seconds */
int resume_rewind;
#endif
+
+#ifdef HAVE_WM8978
+ int low_mid;
+ int mid;
+ int high_mid;
+ int low_mid_center;
+ int mid_center;
+ int high_mid_center;
+ int depth_3d;
+#endif /* HAVE_WM8978 */
};
/** global variables **/
Index: apps/menus/sound_menu.c
===================================================================
--- apps/menus/sound_menu.c (revision 25840)
+++ apps/menus/sound_menu.c (working copy)
@@ -45,9 +45,18 @@
NULL
#endif
);
-#ifdef HAVE_WM8758
+#if defined(HAVE_WM8758) || defined(HAVE_WM8978)
MENUITEM_SETTING(bass_cutoff, &global_settings.bass_cutoff, NULL);
#endif
+#if defined(HAVE_WM8978)
+MENUITEM_SETTING(low_mid, &global_settings.low_mid, NULL);
+MENUITEM_SETTING(low_mid_center, &global_settings.low_mid_center, NULL);
+MENUITEM_SETTING(mid, &global_settings.mid, NULL);
+MENUITEM_SETTING(mid_center, &global_settings.mid_center, NULL);
+MENUITEM_SETTING(high_mid, &global_settings.high_mid, NULL);
+MENUITEM_SETTING(high_mid_center, &global_settings.high_mid_center, NULL);
+MENUITEM_SETTING(depth_3d, &global_settings.depth_3d, NULL);
+#endif /* HAVE_WM8978 */
MENUITEM_SETTING(treble, &global_settings.treble,
#ifdef HAVE_SW_TONE_CONTROLS
lowlatency_callback
@@ -55,7 +64,7 @@
NULL
#endif
);
-#ifdef HAVE_WM8758
+#if defined(HAVE_WM8758) || defined(HAVE_WM8978)
MENUITEM_SETTING(treble_cutoff, &global_settings.treble_cutoff, NULL);
#endif
MENUITEM_SETTING(balance, &global_settings.balance, NULL);
@@ -142,14 +151,35 @@
MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio,
&volume,
&bass,
-#ifdef HAVE_WM8758
+#if defined(HAVE_WM8758) || defined(HAVE_WM8978)
&bass_cutoff,
#endif
+#ifdef HAVE_WM8978
+ &low_mid,
+#endif
+#ifdef HAVE_WM8978
+ &low_mid_center,
+#endif
+#ifdef HAVE_WM8978
+ &mid,
+#endif
+#ifdef HAVE_WM8978
+ &mid_center,
+#endif
+#ifdef HAVE_WM8978
+ &high_mid,
+#endif
+#ifdef HAVE_WM8978
+ &high_mid_center,
+#endif
&treble,
-#ifdef HAVE_WM8758
+#if defined(HAVE_WM8758) || defined(HAVE_WM8978)
&treble_cutoff,
#endif
&balance,&channel_config,&stereo_width
+#if defined(HAVE_WM8978)
+ ,&depth_3d
+#endif
#if CONFIG_CODEC == SWCODEC
,&crossfeed_menu, &equalizer_menu, &dithering_enabled
,×tretch_enabled
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 25840)
+++ apps/settings_list.c (working copy)
@@ -535,7 +535,19 @@
SOUND_SETTING(0, balance, LANG_BALANCE, "balance", SOUND_BALANCE),
SOUND_SETTING(F_NO_WRAP,bass, LANG_BASS, "bass", SOUND_BASS),
SOUND_SETTING(F_NO_WRAP,treble, LANG_TREBLE, "treble", SOUND_TREBLE),
-
+#ifdef HAVE_WM8978
+ SOUND_SETTING(F_NO_WRAP,low_mid, LANG_LOW_MID, "low mid", SOUND_LOW_MID),
+ SOUND_SETTING(F_NO_WRAP,mid, LANG_MID, "mid", SOUND_MID),
+ SOUND_SETTING(F_NO_WRAP,high_mid, LANG_HIGH_MID, "high mid", SOUND_HIGH_MID),
+ SOUND_SETTING(F_NO_WRAP,low_mid_center, LANG_LOW_MID_CENTER, "low mid center",
+ SOUND_LOW_MID_CENTER),
+ SOUND_SETTING(F_NO_WRAP,mid_center, LANG_MID_CENTER, "mid center",
+ SOUND_MID_CENTER),
+ SOUND_SETTING(F_NO_WRAP,high_mid_center, LANG_HIGH_MID_CENTER, "high mid center",
+ SOUND_HIGH_MID_CENTER),
+ SOUND_SETTING(F_NO_WRAP,depth_3d, LANG_DEPTH_3D, "3-d enhancement",
+ SOUND_DEPTH_3D),
+#endif /* HAVE_WM8978 */
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
SOUND_SETTING(0,loudness, LANG_LOUDNESS, "loudness", SOUND_LOUDNESS),
STRINGCHOICE_SETTING(F_SOUNDSETTING,avc,LANG_AUTOVOL,0,"auto volume",
@@ -1313,7 +1325,7 @@
"compressor release time", UNIT_MS, 100, 1000,
100, NULL, NULL, compressor_set),
#endif
-#ifdef HAVE_WM8758
+#if defined(HAVE_WM8758) || defined(HAVE_WM8978)
SOUND_SETTING(F_NO_WRAP, bass_cutoff, LANG_BASS_CUTOFF,
"bass cutoff", SOUND_BASS_CUTOFF),
SOUND_SETTING(F_NO_WRAP, treble_cutoff, LANG_TREBLE_CUTOFF,
Index: firmware/export/wm8978.h
===================================================================
--- firmware/export/wm8978.h (revision 25840)
+++ firmware/export/wm8978.h (working copy)
@@ -26,6 +26,11 @@
#define VOLUME_MIN -900
#define VOLUME_MAX 60
+#define AUDIOHW_CAPS (BASS_CAP | LOW_MID_CAP | MID_CAP | HIGH_MID_CAP | \
+ TREBLE_CAP | BASS_CUTOFF_CAP | LOW_MID_CENTER_CAP | \
+ MID_CENTER_CAP | HIGH_MID_CENTER_CAP | \
+ TREBLE_CUTOFF_CAP | PRESCALER_CAP | DEPTH_3D_CAP)
+
int tenthdb2master(int db);
void audiohw_set_headphone_vol(int vol_l, int vol_r);
void audiohw_set_recsrc(int source, bool recording);
@@ -275,13 +280,16 @@
/*Use WMC_DVOL* macros */
/* Macros for EQ gain and cutoff */
-#define WMC_EQGC 0x1f
-#define WMC_EQGCr(x) ((x) & WMC_EQGC)
-#define WMC_EQGCw(x) ((x) & WMC_EQGC)
+#define WMC_EQG 0x1f
+#define WMC_EQG_POS (0)
+#define WMC_EQBW (1 << 8)
+
+#define WMC_EQF (0x3 << 5)
+#define WMC_EQF_POS (5)
+
/* WMC_EQ1_LOW_SHELF (0x12) */
#define WMC_EQ3DMODE (1 << 8)
-#define WMC_EQ1C (3 << 5) /* Cutoff */
#define WMC_EQ1C_80HZ (0 << 5) /* 80Hz */
#define WMC_EQ1C_105HZ (1 << 5) /* 105Hz */
#define WMC_EQ1C_135HZ (2 << 5) /* 135Hz */
@@ -289,7 +297,6 @@
/* 00000=+12dB, 00001=+11dB...(-1dB steps)...11000=-12dB, 11001-11111=reserved */
/* WMC_EQ2_PEAK1 (0x13) */
-#define WMC_EQ2BW (1 << 8)
#define WMC_EQ2C (3 << 5) /* Center */
#define WMC_EQ2C_230HZ (0 << 5) /* 230Hz */
#define WMC_EQ2C_300HZ (1 << 5) /* 300Hz */
@@ -299,8 +306,6 @@
11001-11111=reserved */
/* WMC_EQ3_PEAK2 (0x14) */
-#define WMC_EQ3BW (1 << 8)
-#define WMC_EQ3C (3 << 5) /* Center */
#define WMC_EQ3C_650HZ (0 << 5) /* 650Hz */
#define WMC_EQ3C_850HZ (1 << 5) /* 850Hz */
#define WMC_EQ3C_1_1KHZ (2 << 5) /* 1.1kHz */
@@ -309,8 +314,6 @@
11001-11111=reserved */
/* WMC_EQ4_PEAK3 (0x15) */
-#define WMC_EQ4BW (1 << 8)
-#define WMC_EQ4C (3 << 5) /* Center */
#define WMC_EQ4C_1_8KHZ (0 << 5) /* 1.8kHz */
#define WMC_EQ4C_2_4KHZ (1 << 5) /* 2.4kHz */
#define WMC_EQ4C_3_2KHZ (2 << 5) /* 3.2kHz */
@@ -319,7 +322,6 @@
11001-11111=reserved */
/* WMC_EQ5_HIGH_SHELF (0x16) */
-#define WMC_EQ5C (3 << 5) /* Cutoff */
#define WMC_EQ5C_5_3KHZ (0 << 5) /* 5.3kHz */
#define WMC_EQ5C_6_9KHZ (1 << 5) /* 6.9kHz */
#define WMC_EQ5C_9KHZ (2 << 5) /* 9.0kHz */
Index: firmware/export/audiohw.h
===================================================================
--- firmware/export/audiohw.h (revision 25840)
+++ firmware/export/audiohw.h (working copy)
@@ -33,6 +33,13 @@
#define PRESCALER_CAP (1 << 4)
#define BASS_CUTOFF_CAP (1 << 5)
#define TREBLE_CUTOFF_CAP (1 << 6)
+#define LOW_MID_CAP (1 << 7)
+#define MID_CAP (1 << 8)
+#define HIGH_MID_CAP (1 << 9)
+#define LOW_MID_CENTER_CAP (1 << 10)
+#define MID_CENTER_CAP (1 << 11)
+#define HIGH_MID_CENTER_CAP (1 << 12)
+#define DEPTH_3D_CAP (1 << 13)
#ifdef HAVE_UDA1380
#include "uda1380.h"
@@ -89,6 +96,18 @@
#define AUDIOHW_HAVE_BASS
#endif
+#if (AUDIOHW_CAPS & LOW_MID_CAP)
+#define AUDIOHW_HAVE_LOW_MID
+#endif
+
+#if (AUDIOHW_CAPS & MID_CAP)
+#define AUDIOHW_HAVE_MID
+#endif
+
+#if (AUDIOHW_CAPS & HIGH_MID_CAP)
+#define AUDIOHW_HAVE_HIGH_MID
+#endif
+
#if (AUDIOHW_CAPS & BALANCE_CAP)
#define AUDIOHW_HAVE_BALANCE
#endif
@@ -105,14 +124,40 @@
#define AUDIOHW_HAVE_BASS_CUTOFF
#endif
+#if (AUDIOHW_CAPS & LOW_MID_CENTER_CAP)
+#define AUDIOHW_HAVE_LOW_MID_CENTER
+#endif
+
+#if (AUDIOHW_CAPS & MID_CENTER_CAP)
+#define AUDIOHW_HAVE_MID_CENTER
+#endif
+
+#if (AUDIOHW_CAPS & HIGH_MID_CENTER_CAP)
+#define AUDIOHW_HAVE_HIGH_MID_CENTER
+#endif
+
#if (AUDIOHW_CAPS & TREBLE_CUTOFF_CAP)
#define AUDIOHW_HAVE_TREBLE_CUTOFF
#endif
+
+#if (AUDIOHW_CAPS & DEPTH_3D_CAP)
+#define AUDIOHW_HAVE_DEPTH_3D
+#endif
+
#endif /* AUDIOHW_CAPS */
enum {
SOUND_VOLUME = 0,
SOUND_BASS,
+#ifdef AUDIOHW_HAVE_LOW_MID
+ SOUND_LOW_MID,
+#endif
+#ifdef AUDIOHW_HAVE_MID
+ SOUND_MID,
+#endif
+#ifdef AUDIOHW_HAVE_HIGH_MID
+ SOUND_HIGH_MID,
+#endif
SOUND_TREBLE,
SOUND_BALANCE,
SOUND_CHANNELS,
@@ -135,9 +180,21 @@
#if defined(AUDIOHW_HAVE_BASS_CUTOFF)
SOUND_BASS_CUTOFF,
#endif
+#if defined(AUDIOHW_HAVE_LOW_MID_CENTER)
+ SOUND_LOW_MID_CENTER,
+#endif
+#if defined(AUDIOHW_HAVE_MID_CENTER)
+ SOUND_MID_CENTER,
+#endif
+#if defined(AUDIOHW_HAVE_HIGH_MID_CENTER)
+ SOUND_HIGH_MID_CENTER,
+#endif
#if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
SOUND_TREBLE_CUTOFF,
#endif
+#if defined(AUDIOHW_HAVE_DEPTH_3D)
+ SOUND_DEPTH_3D,
+#endif
SOUND_LAST_SETTING, /* Keep this last */
};
@@ -232,6 +289,36 @@
void audiohw_set_treble(int val);
#endif
+#ifdef AUDIOHW_HAVE_HIGH_MID
+/**
+ * Set new bass value.
+ * @param val to set.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * HIGH_MID_CAP
+ */
+void audiohw_set_high_mid(int val);
+#endif
+
+#ifdef AUDIOHW_HAVE_MID
+/**
+ * Set new bass value.
+ * @param val to set.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * MID_CAP
+ */
+void audiohw_set_mid(int val);
+#endif
+
+#ifdef AUDIOHW_HAVE_LOW_MID
+/**
+ * Set new bass value.
+ * @param val to set.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * LOW_MID_CAP
+ */
+void audiohw_set_low_mid(int val);
+#endif
+
#ifdef AUDIOHW_HAVE_BASS
/**
* Set new bass value.
@@ -252,6 +339,36 @@
void audiohw_set_bass_cutoff(int val);
#endif
+#ifdef AUDIOHW_HAVE_LOW_MID_CENTER
+/**
+ * Set new bass cut off value.
+ * @param val to set.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * LOW_MID_CENTER_CAP
+ */
+void audiohw_set_low_mid_center(int val);
+#endif
+
+#ifdef AUDIOHW_HAVE_MID_CENTER
+/**
+ * Set new bass cut off value.
+ * @param val to set.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * MID_CENTER_CAP
+ */
+void audiohw_set_mid_center(int val);
+#endif
+
+#ifdef AUDIOHW_HAVE_HIGH_MID_CENTER
+/**
+ * Set new bass cut off value.
+ * @param val to set.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * HIGH_MID_CENTER_CAP
+ */
+void audiohw_set_high_mid_center(int val);
+#endif
+
#ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
/**
* Set new treble cut off value.
@@ -262,6 +379,17 @@
void audiohw_set_treble_cutoff(int val);
#endif
+#ifdef AUDIOHW_HAVE_DEPTH_3D
+/**
+ * Set new 3-d enhancement effect value.
+ * @param val to set.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * DEPTH_3D_CAP
+ */
+void audiohw_set_depth_3d(int val);
+#endif
+
+
void audiohw_set_frequency(int fsel);
#ifdef HAVE_RECORDING
Index: firmware/export/config/gigabeats.h
===================================================================
--- firmware/export/config/gigabeats.h (revision 25840)
+++ firmware/export/config/gigabeats.h (working copy)
@@ -90,9 +90,6 @@
/* Define this if you have the WM8978 audio codec */
#define HAVE_WM8978
-/* Tone controls for WM8978 have not been implemented yet */
-#define HAVE_SW_TONE_CONTROLS
-
/* Define bitmask of input sources - recordable bitmask can be defined
explicitly if different */
#define INPUT_SRC_CAPS SRC_CAP_FMRADIO
Index: firmware/export/sound.h
===================================================================
--- firmware/export/sound.h (revision 25840)
+++ firmware/export/sound.h (working copy)
@@ -52,12 +52,19 @@
void sound_set_volume(int value);
void sound_set_balance(int value);
void sound_set_bass(int value);
+void sound_set_low_mid(int value);
+void sound_set_mid(int value);
+void sound_set_high_mid(int value);
void sound_set_treble(int value);
void sound_set_channels(int value);
void sound_set_stereo_width(int value);
-#if defined(HAVE_WM8758) || defined(HAVE_WM8985)
+#if defined(HAVE_WM8758) || defined(HAVE_WM8985) || defined(HAVE_WM8978)
void sound_set_bass_cutoff(int value);
+void sound_set_low_mid_center(int value);
+void sound_set_mid_center(int value);
+void sound_set_high_mid_center(int value);
void sound_set_treble_cutoff(int value);
+void sound_set_depth_3d(int value);
#endif
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
void sound_set_loudness(int value);
Index: firmware/sound.c
===================================================================
--- firmware/sound.c (revision 25840)
+++ firmware/sound.c (working copy)
@@ -49,6 +49,15 @@
const struct sound_settings_info audiohw_settings[] = {
[SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN / 10, VOLUME_MAX / 10, -25},
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
+#if defined(AUDIOHW_HAVE_LOW_MID)
+ [SOUND_LOW_MID] = {"dB", 0, 1, -24, 24, 0},
+#endif
+#if defined(AUDIOHW_HAVE_MID)
+ [SOUND_MID] = {"dB", 0, 1, -24, 24, 0},
+#endif
+#if defined(AUDIOHW_HAVE_HIGH_MID)
+ [SOUND_HIGH_MID] = {"dB", 0, 1, -24, 24, 0},
+#endif
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
[SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
@@ -61,6 +70,15 @@
#if defined(AUDIOHW_HAVE_BASS_CUTOFF)
[SOUND_BASS_CUTOFF] = {"", 0, 1, 1, 4, 1},
#endif
+#if defined(AUDIOHW_HAVE_LOW_MID_CENTER)
+ [SOUND_LOW_MID_CENTER] = {"", 0, 1, 1, 4, 1},
+#endif
+#if defined(AUDIOHW_HAVE_MID_CENTER)
+ [SOUND_MID_CENTER] = {"", 0, 1, 1, 4, 1},
+#endif
+#if defined(AUDIOHW_HAVE_HIGH_MID_CENTER)
+ [SOUND_HIGH_MID_CENTER] = {"", 0, 1, 1, 4, 1},
+#endif
#if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
[SOUND_TREBLE_CUTOFF] = {"", 0, 1, 1, 4, 1},
#endif
@@ -112,6 +130,15 @@
[0 ... SOUND_LAST_SETTING-1] = NULL,
[SOUND_VOLUME] = sound_set_volume,
[SOUND_BASS] = sound_set_bass,
+#ifdef AUDIOHW_HAVE_LOW_MID
+ [SOUND_LOW_MID] = sound_set_low_mid,
+#endif
+#ifdef AUDIOHW_HAVE_MID
+ [SOUND_MID] = sound_set_mid,
+#endif
+#ifdef AUDIOHW_HAVE_HIGH_MID
+ [SOUND_HIGH_MID] = sound_set_high_mid,
+#endif
[SOUND_TREBLE] = sound_set_treble,
[SOUND_BALANCE] = sound_set_balance,
[SOUND_CHANNELS] = sound_set_channels,
@@ -129,9 +156,19 @@
#if defined(AUDIOHW_HAVE_BASS_CUTOFF)
[SOUND_BASS_CUTOFF] = sound_set_bass_cutoff,
#endif
+#ifdef AUDIOHW_HAVE_LOW_MID_CENTER
+ [SOUND_LOW_MID_CENTER] = sound_set_low_mid_center,
+#endif
+#ifdef AUDIOHW_HAVE_MID_CENTER
+ [SOUND_MID_CENTER] = sound_set_mid_center,
+#endif
+#ifdef AUDIOHW_HAVE_HIGH_MID_CENTER
+ [SOUND_HIGH_MID_CENTER] = sound_set_high_mid_center,
+#endif
#if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
[SOUND_TREBLE_CUTOFF] = sound_set_treble_cutoff,
#endif
+ [SOUND_DEPTH_3D] = sound_set_depth_3d,
};
sound_set_type* sound_get_fn(int setting)
@@ -175,6 +212,15 @@
int current_volume = 0; /* -780..+180 -840.. 0 */
int current_balance = 0; /* -960..+960 -840..+840 */
int current_treble = 0; /* -150..+150 0.. +60 */
+#ifdef AUDIOHW_HAVE_LOW_MID
+int current_low_mid = 0;
+#endif
+#ifdef AUDIOHW_HAVE_MID
+int current_mid = 0;
+#endif
+#ifdef AUDIOHW_HAVE_HIGH_MID
+int current_high_mid = 0;
+#endif
int current_bass = 0; /* -150..+150 0..+240 */
static void set_prescaled_volume(void)
@@ -193,6 +239,16 @@
|| defined(HAVE_UDA1341))
prescale = MAX(current_bass, current_treble);
+#if defined(AUDIOHW_HAVE_LOW_MID)
+ prescale = MAX(prescale, current_low_mid);
+#endif
+#if defined(AUDIOHW_HAVE_MID)
+ prescale = MAX(prescale, current_mid);
+#endif
+#if defined(AUDIOHW_HAVE_HIGH_MID)
+ prescale = MAX(prescale, current_high_mid);
+#endif
+
if (prescale < 0)
prescale = 0; /* no need to prescale if we don't boost
bass or treble */
@@ -296,7 +352,7 @@
return;
#if !defined(AUDIOHW_HAVE_CLIPPING)
-#if defined(HAVE_WM8750) || defined(HAVE_WM8751)
+#if defined(HAVE_WM8750) || defined(HAVE_WM8751) || defined(HAVE_WM8978)
current_bass = value;
#else
current_bass = value * 10;
@@ -314,13 +370,49 @@
#endif
}
+#ifdef AUDIOHW_HAVE_LOW_MID
+void sound_set_low_mid(int value)
+{
+ current_low_mid = value;
+ audiohw_set_low_mid(value);
+
+#if !defined(AUDIOHW_HAVE_CLIPPING)
+ set_prescaled_volume();
+#endif
+}
+#endif
+
+#ifdef AUDIOHW_HAVE_MID
+void sound_set_mid(int value)
+{
+ current_mid = value;
+ audiohw_set_mid(value);
+
+#if !defined(AUDIOHW_HAVE_CLIPPING)
+ set_prescaled_volume();
+#endif
+}
+#endif
+
+#ifdef AUDIOHW_HAVE_HIGH_MID
+void sound_set_high_mid(int value)
+{
+ current_high_mid = value;
+ audiohw_set_high_mid(value);
+
+#if !defined(AUDIOHW_HAVE_CLIPPING)
+ set_prescaled_volume();
+#endif
+}
+#endif
+
void sound_set_treble(int value)
{
if(!audio_is_initialized)
return;
#if !defined(AUDIOHW_HAVE_CLIPPING)
-#if defined(HAVE_WM8750) || defined(HAVE_WM8751)
+#if defined(HAVE_WM8750) || defined(HAVE_WM8751) || defined(HAVE_WM8978)
current_treble = value;
#else
current_treble = value * 10;
@@ -372,6 +464,36 @@
}
#endif
+#if defined(AUDIOHW_HAVE_LOW_MID_CENTER)
+void sound_set_low_mid_center(int value)
+{
+ if(!audio_is_initialized)
+ return;
+
+ audiohw_set_low_mid_center(value);
+}
+#endif
+
+#if defined(AUDIOHW_HAVE_MID_CENTER)
+void sound_set_mid_center(int value)
+{
+ if(!audio_is_initialized)
+ return;
+
+ audiohw_set_mid_center(value);
+}
+#endif
+
+#if defined(AUDIOHW_HAVE_HIGH_MID_CENTER)
+void sound_set_high_mid_center(int value)
+{
+ if(!audio_is_initialized)
+ return;
+
+ audiohw_set_high_mid_center(value);
+}
+#endif
+
#if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
void sound_set_treble_cutoff(int value)
{
@@ -382,6 +504,13 @@
}
#endif
+#if defined(AUDIOHW_HAVE_DEPTH_3D)
+void sound_set_depth_3d(int value)
+{
+ audiohw_set_depth_3d(value);
+}
+#endif
+
#if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F))
void sound_set_loudness(int value)
{
Index: firmware/drivers/audio/wm8978.c
===================================================================
--- firmware/drivers/audio/wm8978.c (revision 25840)
+++ firmware/drivers/audio/wm8978.c (working copy)
@@ -37,27 +37,32 @@
const struct sound_settings_info audiohw_settings[] =
{
- [SOUND_VOLUME] = {"dB", 0, 1, -90, 6, -25},
- [SOUND_BASS] = {"dB", 0, 1, -12, 12, 0},
- [SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 0},
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
- [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
- [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
+ [SOUND_VOLUME] = {"dB", 0, 1, -90, 6, -25},
+ [SOUND_BASS] = {"dB", 0, 1, -12, 12, 0},
+ [SOUND_LOW_MID] = {"dB", 0, 1, -12, 12, 0},
+ [SOUND_MID] = {"dB", 0, 1, -12, 12, 0},
+ [SOUND_HIGH_MID] = {"dB", 0, 1, -12, 12, 0},
+ [SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 0},
+ [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
+ [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
+ [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
#ifdef HAVE_RECORDING
/* Digital: -119.0dB to +8.0dB in 0.5dB increments
* Analog: Relegated to volume control
* Circumstances unfortunately do not allow a great deal of positive
* gain. */
- [SOUND_LEFT_GAIN] = {"dB", 1, 1,-238, 16, 0},
- [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-238, 16, 0},
+ [SOUND_LEFT_GAIN] = {"dB", 1, 1,-238, 16, 0},
+ [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-238, 16, 0},
#if 0
- [SOUND_MIC_GAIN] = {"dB", 1, 1,-238, 16, 0},
+ [SOUND_MIC_GAIN] = {"dB", 1, 1,-238, 16, 0},
#endif
#endif
-#if 0
- [SOUND_BASS_CUTOFF] = {"", 0, 1, 1, 4, 1},
- [SOUND_TREBLE_CUTOFF] = {"", 0, 1, 1, 4, 1},
-#endif
+ [SOUND_BASS_CUTOFF] = {"", 0, 1, 1, 4, 1},
+ [SOUND_LOW_MID_CENTER] = {"", 0, 1, 1, 4, 1},
+ [SOUND_MID_CENTER] = {"", 0, 1, 1, 4, 1},
+ [SOUND_HIGH_MID_CENTER] = {"", 0, 1, 1, 4, 1},
+ [SOUND_TREBLE_CUTOFF] = {"", 0, 1, 1, 4, 1},
+ [SOUND_DEPTH_3D] = {"", 0, 1, 0, 15, 0},
};
static uint16_t wmc_regs[WMC_NUM_REGISTERS] =
@@ -123,10 +128,14 @@
{
int vol_l;
int vol_r;
+ int dac_l;
+ int dac_r;
bool ahw_mute;
+ int prescaler;
+ int enhance_3d;
} wmc_vol =
{
- 0, 0, false
+ 0, 0, 0, 0, false, 0, 0,
};
static void wmc_write(unsigned int reg, unsigned int val)
@@ -216,9 +225,13 @@
wmc_set(WMC_OUT4_MONO_MIXER_CTRL, WMC_MUTE);
/* 3. Set L/RMIXEN = 1 and DACENL/R = 1 in register R3. */
- wmc_write(WMC_POWER_MANAGEMENT3,
- WMC_RMIXEN | WMC_LMIXEN | WMC_DACENR | WMC_DACENL);
+ wmc_write(WMC_POWER_MANAGEMENT3, WMC_RMIXEN | WMC_LMIXEN);
+ /* EQ and 3D applied to DAC (Set before DAC enable!) */
+ wmc_set(WMC_EQ1_LOW_SHELF, WMC_EQ3DMODE);
+
+ wmc_set(WMC_POWER_MANAGEMENT3, WMC_DACENR | WMC_DACENL);
+
/* 4. Set BUFIOEN = 1 and VMIDSEL[1:0] to required value in register
* R1. Wait for VMID supply to settle */
wmc_write(WMC_POWER_MANAGEMENT1, WMC_BUFIOEN | WMC_VMIDSEL_300K);
@@ -305,6 +318,12 @@
get_headphone_levels(vol_l, &dac_l, &hp_l, &mix_l, &boost_l);
get_headphone_levels(vol_r, &dac_r, &hp_r, &mix_r, &boost_r);
+ wmc_vol.dac_l = dac_l;
+ wmc_vol.dac_r = dac_r;
+
+ dac_l -= wmc_vol.prescaler + wmc_vol.enhance_3d;
+ dac_r -= wmc_vol.prescaler + wmc_vol.enhance_3d;
+
wmc_write_masked(WMC_LEFT_MIXER_CTRL, WMC_BYPLMIXVOLw(mix_l),
WMC_BYPLMIXVOL);
wmc_write_masked(WMC_LEFT_ADC_BOOST_CTRL,
@@ -367,6 +386,102 @@
}
}
+/* Equalizer - set the eq band level -12 to +12 dB. */
+static void audiohw_set_eq_band_level(unsigned int band, int val)
+{
+ unsigned int reg = band + WMC_EQ1_LOW_SHELF;
+ wmc_write_masked(reg, (12 - val) << WMC_EQG_POS, WMC_EQG);
+}
+
+/** Equalizer as tone-controls interface **/
+void audiohw_set_bass(int val)
+{
+ audiohw_set_eq_band_level(0, val);
+}
+
+void audiohw_set_low_mid(int val)
+{
+ audiohw_set_eq_band_level(1, val);
+}
+
+void audiohw_set_mid(int val)
+{
+ audiohw_set_eq_band_level(2, val);
+}
+
+void audiohw_set_high_mid(int val)
+{
+ audiohw_set_eq_band_level(3, val);
+}
+
+void audiohw_set_treble(int val)
+{
+ audiohw_set_eq_band_level(4, val);
+}
+
+/* Equalizer - set the eq band cutoff frequency index. */
+static void audiohw_set_eq_band_frequency(unsigned int band, int val)
+{
+ unsigned int reg = band + WMC_EQ1_LOW_SHELF;
+
+ val = ((val - 1) << WMC_EQF_POS) & WMC_EQF;
+
+ if (band >= 2 && band <= 3)
+ val |= WMC_EQBW; /* wide */
+
+ wmc_write_masked(reg, val, WMC_EQBW | WMC_EQF);
+}
+
+void audiohw_set_bass_cutoff(int val)
+{
+ audiohw_set_eq_band_frequency(0, val);
+}
+
+void audiohw_set_low_mid_center(int val)
+{
+ audiohw_set_eq_band_frequency(1, val);
+}
+
+void audiohw_set_mid_center(int val)
+{
+ audiohw_set_eq_band_frequency(2, val);
+}
+
+void audiohw_set_high_mid_center(int val)
+{
+ audiohw_set_eq_band_frequency(3, val);
+}
+
+void audiohw_set_treble_cutoff(int val)
+{
+ audiohw_set_eq_band_frequency(4, val);
+}
+
+void audiohw_set_prescaler(int val)
+{
+ val *= 2;
+ wmc_vol.prescaler = val;
+ val += wmc_vol.enhance_3d;
+
+ wmc_write_masked(WMC_LEFT_DAC_DIGITAL_VOL, wmc_vol.dac_l - val,
+ WMC_DVOL);
+ wmc_write_masked(WMC_RIGHT_DAC_DIGITAL_VOL, wmc_vol.dac_r - val,
+ WMC_DVOL);
+}
+
+void audiohw_set_depth_3d(int val)
+{
+ int att = 10*val / 15; /* -5 dB @ full setting (sounds about right) */
+ wmc_vol.enhance_3d = att;
+ att += wmc_vol.prescaler;
+
+ wmc_write_masked(WMC_LEFT_DAC_DIGITAL_VOL, wmc_vol.dac_l - att,
+ WMC_DVOL);
+ wmc_write_masked(WMC_RIGHT_DAC_DIGITAL_VOL, wmc_vol.dac_r - att,
+ WMC_DVOL);
+ wmc_write_masked(WMC_3D_CONTROL, val, WMC_DEPTH3D);
+}
+
void audiohw_close(void)
{
/* 1. Mute all analogue outputs */
Index: uisimulator/sdl/sound.c
===================================================================
--- uisimulator/sdl/sound.c (revision 25840)
+++ uisimulator/sdl/sound.c (working copy)
@@ -373,6 +373,15 @@
#if defined(AUDIOHW_HAVE_BASS)
void audiohw_set_bass(int value) { (void)value; }
#endif
+#if defined(AUDIOHW_HAVE_LOW_MID)
+void audiohw_set_low_mid(int value) { (void)value; }
+#endif
+#if defined(AUDIOHW_HAVE_MID)
+void audiohw_set_mid(int value) { (void)value; }
+#endif
+#if defined(AUDIOHW_HAVE_HIGH_MID)
+void audiohw_set_high_mid(int value) { (void)value; }
+#endif
#if defined(AUDIOHW_HAVE_TREBLE)
void audiohw_set_treble(int value) { (void)value; }
#endif
@@ -383,9 +392,21 @@
#if defined(AUDIOHW_HAVE_BASS_CUTOFF)
void audiohw_set_bass_cutoff(int value) { (void)value; }
#endif
+#if defined(AUDIOHW_HAVE_LOW_MID_CENTER)
+void audiohw_set_low_mid_CENTER(int value) { (void)value; }
+#endif
+#if defined(AUDIOHW_HAVE_MID_CENTER)
+void audiohw_set_mid_CENTER(int value) { (void)value; }
+#endif
+#if defined(AUDIOHW_HAVE_HIGH_MID_CENTER)
+void audiohw_set_high_mid_CENTER(int value) { (void)value; }
+#endif
#if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
void audiohw_set_treble_cutoff(int value){ (void)value; }
#endif
+#if defined(AUDIOHW_HAVE_DEPTH_3D)
+void audiohw_set_depth_3d(int value) { (void)value; }
+#endif
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
int mas_codec_readreg(int reg)
{