summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2010-05-15 13:09:45 +0000
committerMichael Sevakis <jethead71@rockbox.org>2010-05-15 13:09:45 +0000
commit80d0d15ca9b253f8a446f50cf25d3d4b850bcfd1 (patch)
tree2598d3a019c33d6f9ea76010fd6d3a8301ef87a0 /apps
parent0f77db73469920f0b0006f696ddb36029338c378 (diff)
downloadrockbox-80d0d15ca9b253f8a446f50cf25d3d4b850bcfd1.zip
rockbox-80d0d15ca9b253f8a446f50cf25d3d4b850bcfd1.tar.gz
rockbox-80d0d15ca9b253f8a446f50cf25d3d4b850bcfd1.tar.bz2
rockbox-80d0d15ca9b253f8a446f50cf25d3d4b850bcfd1.tar.xz
Gigabeat S: Fully enable access to hardware tone controls and 3-D effect feature. Under the hood, it's designated a hardware equalizer since it is one. Implement code framework for hardware EQ in general. Menu aspect is well abstracted and so the UI and strings can be changed around if taste doesn't quite suit. So far the emphasis is distinction of the UI labelling from the software EQ so that it's clear the settings are for a different thing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26051 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/SOURCES3
-rw-r--r--apps/lang/english.lang137
-rw-r--r--apps/menus/audiohw_eq_menu.c244
-rw-r--r--apps/menus/exported_menus.h3
-rw-r--r--apps/menus/sound_menu.c50
-rw-r--r--apps/plugin.c3
-rw-r--r--apps/plugin.h7
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c35
-rw-r--r--apps/settings.c35
-rw-r--r--apps/settings.h21
-rw-r--r--apps/settings_list.c100
11 files changed, 617 insertions, 21 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 2642fa1..2bd4018 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -16,6 +16,9 @@ menus/menu_common.c
menus/display_menu.c
menus/theme_menu.c
#if CONFIG_CODEC == SWCODEC
+#ifdef HAVE_WM8978
+menus/audiohw_eq_menu.c
+#endif
menus/eq_menu.c
buffering.c
voice_thread.c
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index c079a4a..4a4fb2c 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -13595,3 +13595,140 @@
radio: ""
</voice>
</phrase>
+<phrase>
+ id: LANG_HW_EQ_TONE_CONTROLS
+ desc: in sound_menu, hardware equalizer tone controls
+ user: core
+ <source>
+ *: none
+ gigabeats: "Tone Controls"
+ </source>
+ <dest>
+ *: none
+ gigabeats: "Tone Controls"
+ </dest>
+ <voice>
+ *: none
+ gigabeats: "Tone Controls"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_HW_EQ_TONE_CONTROLS_ADVANCED
+ desc: in sound_menu, advanced settings for hardware equalizer tone controls
+ user: core
+ <source>
+ *: none
+ gigabeats: "Advanced Tone Control Settings"
+ </source>
+ <dest>
+ *: none
+ gigabeats: "Advanced Tone Control Settings"
+ </dest>
+ <voice>
+ *: none
+ gigabeats: "Advanced Tone Control Settings"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_HW_EQ_GAIN
+ desc: in sound_menu, hardware equalizer tone controls filter gain
+ user: core
+ <source>
+ *: none
+ gigabeats: "Band %d Gain"
+ </source>
+ <dest>
+ *: none
+ gigabeats: "Band %d Gain"
+ </dest>
+ <voice>
+ *: none
+ gigabeats: "Band Gain"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_HW_EQ_FREQUENCY
+ desc: in sound_menu, hardware equalizer tone controls shelf filter cutoff frequency
+ user: core
+ <source>
+ *: none
+ gigabeats: "Band %d Frequency"
+ </source>
+ <dest>
+ *: none
+ gigabeats: "Band %d Frequency"
+ </dest>
+ <voice>
+ *: none
+ gigabeats: "Band Frequency"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_HW_EQ_WIDTH
+ desc: in sound_menu, hardware equalizer tone controls peak bandwith setting
+ user: core
+ <source>
+ *: none
+ gigabeats: "Band %d Width"
+ </source>
+ <dest>
+ *: none
+ gigabeats: "Band %d Width"
+ </dest>
+ <voice>
+ *: none
+ gigabeats: "Band Width"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_HW_EQ_WIDTH_NARROW
+ desc: in sound_menu, hardware equalizer tone controls narrow bandwith setting
+ user: core
+ <source>
+ *: none
+ gigabeats: "Narrow"
+ </source>
+ <dest>
+ *: none
+ gigabeats: "Narrow"
+ </dest>
+ <voice>
+ *: none
+ gigabeats: "Narrow"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_HW_EQ_WIDTH_WIDE
+ desc: in sound_menu, hardware equalizer tone controls wide bandwidth setting
+ user: core
+ <source>
+ *: none
+ gigabeats: "Wide"
+ </source>
+ <dest>
+ *: none
+ gigabeats: "Wide"
+ </dest>
+ <voice>
+ *: none
+ gigabeats: "Wide"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_DEPTH_3D
+ desc: in sound_menu, amount of 3D enhancement effect
+ user: core
+ <source>
+ *: none
+ gigabeats: "3-D Enhancement"
+ </source>
+ <dest>
+ *: none
+ gigabeats: "3-D Enhancement"
+ </dest>
+ <voice>
+ *: none
+ gigabeats: "3-D Enhancement"
+ </voice>
+</phrase>
+
diff --git a/apps/menus/audiohw_eq_menu.c b/apps/menus/audiohw_eq_menu.c
new file mode 100644
index 0000000..1027d6a
--- /dev/null
+++ b/apps/menus/audiohw_eq_menu.c
@@ -0,0 +1,244 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2010 Michael Sevakis
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include <stdio.h>
+#include "config.h"
+#include "sound.h"
+#include "settings.h"
+#include "lang.h"
+#include "menu.h"
+#include "talk.h"
+
+#define HW_EQ_IDX(band, setting) ((void *)(((setting) << 8) | (band)))
+#define HW_EQ_IDX_BAND(data) ((uint8_t)(uintptr_t)(data))
+#define HW_EQ_IDX_SETTING(data) ((uint8_t)((uintptr_t)(data) >> 8))
+
+static unsigned short hw_eq_setting_lang_ids[AUDIOHW_EQ_SETTING_NUM] =
+{
+ LANG_HW_EQ_GAIN,
+#ifdef AUDIOHW_HAVE_EQ_FREQUENCY
+ LANG_HW_EQ_FREQUENCY,
+#endif
+#ifdef AUDIOHW_HAVE_EQ_WIDTH
+ LANG_HW_EQ_WIDTH,
+#endif
+};
+
+static char * hw_eq_get_name(int selected_item, void * data, char *buffer)
+{
+ snprintf(buffer, MAX_PATH,
+ str(hw_eq_setting_lang_ids[HW_EQ_IDX_SETTING(data)]),
+ HW_EQ_IDX_BAND(data) + 1);
+ return buffer;
+ (void)selected_item;
+}
+
+static int hw_eq_speak_item(int selected_item, void * data)
+{
+ talk_id(hw_eq_setting_lang_ids[HW_EQ_IDX_SETTING(data)], false);
+ talk_number(HW_EQ_IDX_BAND(data) + 1, true);
+ return 0;
+ (void)selected_item;
+}
+
+static int hw_eq_do_band_setting(void *param)
+{
+ int band = HW_EQ_IDX_BAND(param);
+ int setting = HW_EQ_IDX_SETTING(param);
+ char desc[MAX_PATH];
+ struct menu_callback_with_desc cbwdesc =
+ {
+ .menu_callback = NULL,
+ .desc = hw_eq_get_name(0, param, desc),
+ .icon_id = Icon_NOICON
+ };
+ struct menu_item_ex item =
+ {
+ .flags = MT_SETTING_W_TEXT | MENU_HAS_DESC,
+ { .variable = (void*)(&global_settings.hw_eq_bands[band].gain + setting) },
+ { .callback_and_desc = &cbwdesc }
+ };
+ do_setting_from_menu(&item, NULL);
+ return 0;
+}
+
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band1_gain, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_GAIN),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_GAIN),
+ NULL, Icon_Menu_setting);
+#ifdef AUDIOHW_HAVE_EQ_BAND1_FREQUENCY
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band1_frequency, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_FREQUENCY),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_FREQUENCY),
+ NULL, Icon_NOICON);
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND2
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band2_gain, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_GAIN),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_GAIN),
+ NULL, Icon_Menu_setting);
+#ifdef AUDIOHW_HAVE_EQ_BAND2_FREQUENCY
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band2_frequency, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_FREQUENCY),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_FREQUENCY),
+ NULL, Icon_NOICON);
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND2_WIDTH
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band2_width, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_WIDTH),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_WIDTH),
+ NULL, Icon_NOICON);
+#endif
+#endif /* AUDIOHW_HAVE_EQ_BAND2 */
+#ifdef AUDIOHW_HAVE_EQ_BAND3
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band3_gain, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_GAIN),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_GAIN),
+ NULL, Icon_Menu_setting);
+#ifdef AUDIOHW_HAVE_EQ_BAND3_FREQUENCY
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band3_frequency, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_FREQUENCY),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_FREQUENCY),
+ NULL, Icon_NOICON);
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND3_WIDTH
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band3_width, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_WIDTH),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_WIDTH),
+ NULL, Icon_NOICON);
+#endif
+#endif /* AUDIOHW_HAVE_EQ_BAND3 */
+#ifdef AUDIOHW_HAVE_EQ_BAND4
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band4_gain, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_GAIN),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_GAIN),
+ NULL, Icon_Menu_setting);
+#ifdef AUDIOHW_HAVE_EQ_BAND4_FREQUENCY
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band4_frequency, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_FREQUENCY),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_FREQUENCY),
+ NULL, Icon_NOICON);
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND4_WIDTH
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band4_width, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_WIDTH),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_WIDTH),
+ NULL, Icon_NOICON);
+#endif
+#endif /* AUDIOHW_HAVE_EQ_BAND4 */
+#ifdef AUDIOHW_HAVE_EQ_BAND5
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band5_gain, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_GAIN),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_GAIN),
+ NULL, Icon_Menu_setting);
+#ifdef AUDIOHW_HAVE_EQ_BAND5_FREQUENCY
+MENUITEM_FUNCTION_DYNTEXT(hw_eq_band5_frequency, MENU_FUNC_USEPARAM,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_FREQUENCY),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_FREQUENCY),
+ NULL, Icon_NOICON);
+#endif
+#endif /* AUDIOHW_HAVE_EQ_BAND5 */
+
+/* Submenu for multiple "tone controls". Gain + all advanced settings. */
+MAKE_MENU(hardware_eq_tone_controls_advanced, ID2P(LANG_HW_EQ_TONE_CONTROLS_ADVANCED),
+ NULL, Icon_NOICON
+ ,&hw_eq_band1_gain
+#ifdef AUDIOHW_HAVE_EQ_BAND1_FREQUENCY
+ ,&hw_eq_band1_frequency
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND2
+ ,&hw_eq_band2_gain
+#ifdef AUDIOHW_HAVE_EQ_BAND2_FREQUENCY
+ ,&hw_eq_band2_frequency
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND2_WIDTH
+ ,&hw_eq_band2_width
+#endif
+#endif /* AUDIOHW_HAVE_EQ_BAND2 */
+#ifdef AUDIOHW_HAVE_EQ_BAND3
+ ,&hw_eq_band3_gain
+#ifdef AUDIOHW_HAVE_EQ_BAND3_FREQUENCY
+ ,&hw_eq_band3_frequency
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND3_WIDTH
+ ,&hw_eq_band3_width
+#endif
+#endif /* AUDIOHW_HAVE_EQ_BAND3 */
+#ifdef AUDIOHW_HAVE_EQ_BAND4
+ ,&hw_eq_band4_gain
+#ifdef AUDIOHW_HAVE_EQ_BAND4_FREQUENCY
+ ,&hw_eq_band4_frequency
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND4_WIDTH
+ ,&hw_eq_band4_width
+#endif
+#endif /* AUDIOHW_HAVE_EQ_BAND4 */
+#ifdef AUDIOHW_HAVE_EQ_BAND5
+ ,&hw_eq_band5_gain
+#ifdef AUDIOHW_HAVE_EQ_BAND5_FREQUENCY
+ ,&hw_eq_band5_frequency
+#endif
+#endif /* AUDIOHW_HAVE_EQ_BAND5 */
+ );
+/* Shows only the gains + advanced settings submenu */
+MAKE_MENU(audiohw_eq_tone_controls, ID2P(LANG_HW_EQ_TONE_CONTROLS),
+ NULL, Icon_NOICON
+ ,&hw_eq_band1_gain
+#ifdef AUDIOHW_HAVE_EQ_BAND2
+ ,&hw_eq_band2_gain
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND3
+ ,&hw_eq_band3_gain
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND4
+ ,&hw_eq_band4_gain
+#endif
+#ifdef AUDIOHW_HAVE_EQ_BAND5
+ ,&hw_eq_band5_gain
+#endif
+ ,&hardware_eq_tone_controls_advanced
+ );
+
diff --git a/apps/menus/exported_menus.h b/apps/menus/exported_menus.h
index 9fb39cb..37b5ff3 100644
--- a/apps/menus/exported_menus.h
+++ b/apps/menus/exported_menus.h
@@ -40,6 +40,9 @@ extern const struct menu_item_ex
playlist_settings, /* playlist_menu.c */
playlist_options, /* playlist_menu.c */
equalizer_menu, /* eq_menu.c */
+#ifdef AUDIOHW_HAVE_EQ
+ audiohw_eq_tone_controls, /* audiohw_eq_menu.c */
+#endif
info_menu, /* info_menu.c */
theme_menu; /* theme_menu.c */
diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c
index 0ce860c..066b1da 100644
--- a/apps/menus/sound_menu.c
+++ b/apps/menus/sound_menu.c
@@ -23,6 +23,7 @@
#include <stddef.h>
#include <limits.h>
#include "config.h"
+#include "sound.h"
#include "lang.h"
#include "action.h"
#include "settings.h"
@@ -38,6 +39,7 @@
/***********************************/
/* SOUND MENU */
MENUITEM_SETTING(volume, &global_settings.volume, NULL);
+#ifdef AUDIOHW_HAVE_BASS
MENUITEM_SETTING(bass, &global_settings.bass,
#ifdef HAVE_SW_TONE_CONTROLS
lowlatency_callback
@@ -45,9 +47,14 @@ MENUITEM_SETTING(bass, &global_settings.bass,
NULL
#endif
);
-#ifdef HAVE_WM8758
-MENUITEM_SETTING(bass_cutoff, &global_settings.bass_cutoff, NULL);
+
+#ifdef AUDIOHW_HAVE_BASS_CUTOFF
+MENUITEM_SETTING(treble_cutoff, &global_settings.treble_cutoff, NULL);
#endif
+#endif /* AUDIOHW_HAVE_BASS */
+
+
+#ifdef AUDIOHW_HAVE_TREBLE
MENUITEM_SETTING(treble, &global_settings.treble,
#ifdef HAVE_SW_TONE_CONTROLS
lowlatency_callback
@@ -55,9 +62,13 @@ MENUITEM_SETTING(treble, &global_settings.treble,
NULL
#endif
);
-#ifdef HAVE_WM8758
+
+#ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
MENUITEM_SETTING(treble_cutoff, &global_settings.treble_cutoff, NULL);
#endif
+#endif /* AUDIOHW_HAVE_TREBLE */
+
+
MENUITEM_SETTING(balance, &global_settings.balance, NULL);
MENUITEM_SETTING(channel_config, &global_settings.channel_config,
#if CONFIG_CODEC == SWCODEC
@@ -74,6 +85,10 @@ MENUITEM_SETTING(stereo_width, &global_settings.stereo_width,
#endif
);
+#ifdef AUDIOHW_HAVE_DEPTH_3D
+MENUITEM_SETTING(depth_3d, &global_settings.depth_3d, NULL);
+#endif
+
#if CONFIG_CODEC == SWCODEC
/* Crossfeed Submenu */
MENUITEM_SETTING(crossfeed, &global_settings.crossfeed, lowlatency_callback);
@@ -137,19 +152,30 @@ static int timestretch_callback(int action,const struct menu_item_ex *this_item)
MENUITEM_SETTING(speaker_enabled, &global_settings.speaker_enabled, NULL);
#endif
-
+#ifdef AUDIOHW_HAVE_EQ
+#endif /* AUDIOHW_HAVE_EQ */
MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio,
- &volume,
- &bass,
-#ifdef HAVE_WM8758
- &bass_cutoff,
+ &volume
+#ifdef AUDIOHW_HAVE_BASS
+ ,&bass
+#endif
+#ifdef AUDIOHW_HAVE_BASS_CUTOFF
+ ,&bass_cutoff
+#endif
+#ifdef AUDIOHW_HAVE_TREBLE
+ ,&treble
+#endif
+#ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
+ ,&treble_cutoff
+#endif
+#ifdef AUDIOHW_HAVE_EQ
+ ,&audiohw_eq_tone_controls
#endif
- &treble,
-#ifdef HAVE_WM8758
- &treble_cutoff,
+ ,&balance,&channel_config,&stereo_width
+#ifdef AUDIOHW_HAVE_DEPTH_3D
+ ,&depth_3d
#endif
- &balance,&channel_config,&stereo_width
#if CONFIG_CODEC == SWCODEC
,&crossfeed_menu, &equalizer_menu, &dithering_enabled
,&timestretch_enabled
diff --git a/apps/plugin.c b/apps/plugin.c
index b60e2d6..90380a0 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -721,6 +721,9 @@ static const struct plugin_api rockbox_api = {
round_value_to_list32,
#endif
+#ifdef AUDIOHW_HAVE_EQ
+ sound_enum_hw_eq_band_setting,
+#endif
};
int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 5aaa638..108a283 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -142,7 +142,7 @@ void* plugin_get_buffer(size_t *buffer_size);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 184
+#define PLUGIN_API_VERSION 185
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@@ -884,6 +884,11 @@ int (*round_value_to_list32)(unsigned long value,
int count,
bool signd);
#endif
+
+#ifdef AUDIOHW_HAVE_EQ
+ int (*sound_enum_hw_eq_band_setting)(unsigned int band,
+ unsigned int band_setting);
+#endif /* AUDIOHW_HAVE_EQ */
};
/* plugin header */
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index 6c8a2b8..1ac2476 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -403,18 +403,53 @@ static void sync_audio_setting(int setting, bool global)
switch (setting)
{
case MPEG_AUDIO_TONE_CONTROLS:
+ #if defined(AUDIOHW_HAVE_BASS) || defined(AUDIOHW_HAVE_TREBLE)
if (global || settings.tone_controls)
{
+ #ifdef AUDIOHW_HAVE_BASS
val0 = rb->global_settings->bass;
+ #endif
+ #ifdef AUDIOHW_HAVE_TREBLE
val1 = rb->global_settings->treble;
+ #endif
}
else
{
+ #ifdef AUDIOHW_HAVE_BASS
val0 = rb->sound_default(SOUND_BASS);
+ #endif
+ #ifdef AUDIOHW_HAVE_TREBLE
val1 = rb->sound_default(SOUND_TREBLE);
+ #endif
}
+ #ifdef AUDIOHW_HAVE_BASS
rb->sound_set(SOUND_BASS, val0);
+ #endif
+ #ifdef AUDIOHW_HAVE_TREBLE
rb->sound_set(SOUND_TREBLE, val1);
+ #endif
+ #endif /* AUDIOHW_HAVE_BASS || AUDIOHW_HAVE_TREBLE */
+
+ #ifdef AUDIOHW_HAVE_EQ
+ for (val1 = 0;; val1++)
+ {
+ int setting = rb->sound_enum_hw_eq_band_setting(val1, AUDIOHW_EQ_GAIN);
+
+ if (setting == -1)
+ break;
+
+ if (global || settings.tone_controls)
+ {
+ val0 = rb->global_settings->hw_eq_bands[val1].gain;
+ }
+ else
+ {
+ val0 = rb->sound_default(setting);
+ }
+
+ rb->sound_set(setting, val0);
+ }
+ #endif /* AUDIOHW_HAVE_EQ */
break;
case MPEG_AUDIO_CHANNEL_MODES:
diff --git a/apps/settings.c b/apps/settings.c
index 4901957..6349372 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -27,6 +27,7 @@
#include "config.h"
#include "action.h"
#include "crc32.h"
+#include "sound.h"
#include "settings.h"
#include "debug.h"
#include "usb.h"
@@ -55,7 +56,6 @@
#include "powermgmt.h"
#include "keyboard.h"
#include "version.h"
-#include "sound.h"
#include "rbunicode.h"
#include "dircache.h"
#include "splash.h"
@@ -718,8 +718,12 @@ void sound_settings_apply(void)
#if CONFIG_CODEC == SWCODEC
sound_set_dsp_callback(dsp_callback);
#endif
+#ifdef AUDIOHW_HAVE_BASS
sound_set(SOUND_BASS, global_settings.bass);
+#endif
+#ifdef AUDIOHW_HAVE_TREBLE
sound_set(SOUND_TREBLE, global_settings.treble);
+#endif
sound_set(SOUND_BALANCE, global_settings.balance);
sound_set(SOUND_VOLUME, global_settings.volume);
sound_set(SOUND_CHANNELS, global_settings.channel_config);
@@ -734,13 +738,36 @@ void sound_settings_apply(void)
sound_set(SOUND_MDB_ENABLE, global_settings.mdb_enable);
sound_set(SOUND_SUPERBASS, global_settings.superbass);
#endif
-
-#ifdef HAVE_WM8758
+#ifdef AUDIOHW_HAVE_BASS_CUTOFF
sound_set(SOUND_BASS_CUTOFF, global_settings.bass_cutoff);
+#endif
+#ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
sound_set(SOUND_TREBLE_CUTOFF, global_settings.treble_cutoff);
#endif
-}
+#ifdef AUDIOHW_HAVE_DEPTH_3D
+ sound_set(SOUND_DEPTH_3D, global_settings.depth_3d);
+#endif
+#ifdef AUDIOHW_HAVE_EQ
+ int b;
+ for (b = 0; b < AUDIOHW_EQ_BAND_NUM; b++)
+ {
+ int setting = sound_enum_hw_eq_band_setting(b, AUDIOHW_EQ_GAIN);
+ sound_set(setting, global_settings.hw_eq_bands[b].gain);
+
+#ifdef AUDIOHW_HAVE_EQ_FREQUENCY
+ setting = sound_enum_hw_eq_band_setting(b, AUDIOHW_EQ_FREQUENCY);
+ if (setting != -1)
+ sound_set(setting, global_settings.hw_eq_bands[b].frequency);
+#endif /* AUDIOHW_HAVE_EQ_FREQUENCY */
+#ifdef AUDIOHW_HAVE_EQ_WIDTH
+ setting = sound_enum_hw_eq_band_setting(b, AUDIOHW_EQ_WIDTH);
+ if (setting != -1)
+ sound_set(setting, global_settings.hw_eq_bands[b].width);
+#endif /* AUDIOHW_HAVE_EQ_WIDTH */
+ }
+#endif
+}
void settings_apply(bool read_disk)
{
diff --git a/apps/settings.h b/apps/settings.h
index 2fdff99..c8e8d64 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -336,7 +336,7 @@ struct user_settings
bool superbass; /* true/false */
#endif
-#ifdef HAVE_WM8758
+#if defined(HAVE_WM8758) || defined(HAVE_WM8978)
int bass_cutoff;
int treble_cutoff;
#endif
@@ -831,6 +831,25 @@ struct user_settings
/* When resuming playback (after a stop), rewind this number of seconds */
int resume_rewind;
#endif
+
+#ifdef AUDIOHW_HAVE_DEPTH_3D
+ int depth_3d;
+#endif
+
+#ifdef AUDIOHW_HAVE_EQ
+ /** Hardware EQ tone controls **/
+ struct hw_eq_band
+ {
+ /* Maintain the order of members or sound_menu has to be changed */
+ int gain;
+#ifdef AUDIOHW_HAVE_EQ_FREQUENCY
+ int frequency;
+#endif
+#ifdef AUDIOHW_HAVE_EQ_WIDTH
+ int width;
+#endif
+ } hw_eq_bands[AUDIOHW_EQ_BAND_NUM];
+#endif /* AUDIOHW_HAVE_EQ */
};
/** global variables **/
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 1bc7832..d6f5f94 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -29,10 +29,10 @@
#include "lcd.h"
#include "button.h"
#include "backlight.h"
+#include "sound.h"
#include "settings.h"
#include "settings_list.h"
#include "usb.h"
-#include "sound.h"
#include "dsp.h"
#include "audio.h"
#include "power.h"
@@ -552,9 +552,97 @@ const struct settings_list settings[] = {
/* sound settings */
SOUND_SETTING(F_NO_WRAP,volume, LANG_VOLUME, "volume", SOUND_VOLUME),
SOUND_SETTING(0, balance, LANG_BALANCE, "balance", SOUND_BALANCE),
+/* Tone controls */
+#ifdef AUDIOHW_HAVE_BASS
SOUND_SETTING(F_NO_WRAP,bass, LANG_BASS, "bass", SOUND_BASS),
+#endif
+#ifdef AUDIOHW_HAVE_TREBLE
SOUND_SETTING(F_NO_WRAP,treble, LANG_TREBLE, "treble", SOUND_TREBLE),
-
+#endif
+/* Hardware EQ tone controls */
+#ifdef AUDIOHW_HAVE_EQ
+/* Band gain is generic */
+ SOUND_SETTING(F_NO_WRAP, hw_eq_bands[AUDIOHW_EQ_BAND1].gain,
+ LANG_HW_EQ_GAIN, "tone band1 gain", SOUND_EQ_BAND1_GAIN),
+#ifdef AUDIOHW_HAVE_EQ_BAND2
+ SOUND_SETTING(F_NO_WRAP, hw_eq_bands[AUDIOHW_EQ_BAND2].gain,
+ LANG_HW_EQ_GAIN, "tone band2 gain", SOUND_EQ_BAND2_GAIN),
+#endif /* AUDIOHW_HAVE_EQ_BAND2 */
+#ifdef AUDIOHW_HAVE_EQ_BAND3
+ SOUND_SETTING(F_NO_WRAP, hw_eq_bands[AUDIOHW_EQ_BAND3].gain,
+ LANG_HW_EQ_GAIN, "tone band3 gain", SOUND_EQ_BAND3_GAIN),
+#endif /* AUDIOHW_HAVE_EQ_BAND3 */
+#ifdef AUDIOHW_HAVE_EQ_BAND4
+ SOUND_SETTING(F_NO_WRAP, hw_eq_bands[AUDIOHW_EQ_BAND4].gain,
+ LANG_HW_EQ_GAIN, "tone band4 gain", SOUND_EQ_BAND4_GAIN),
+#endif /* AUDIOHW_HAVE_EQ_BAND4 */
+#ifdef AUDIOHW_HAVE_EQ_BAND5
+ SOUND_SETTING(F_NO_WRAP, hw_eq_bands[AUDIOHW_EQ_BAND5].gain,
+ LANG_HW_EQ_GAIN, "tone band5 gain", SOUND_EQ_BAND5_GAIN),
+#endif /* AUDIOHW_HAVE_EQ_BAND5 */
+#ifdef HAVE_WM8978
+ /* Frequencies vary with samplerate but at least the user has an idea
+ * about the bands and it will be correct with normal playback rates. */
+/* Band 1 */
+ STRINGCHOICE_SETTING(F_SOUNDSETTING,
+ hw_eq_bands[AUDIOHW_EQ_BAND1].frequency,
+ LANG_HW_EQ_FREQUENCY, 0,"tone band1 frequency",
+ "80 Hz,105 Hz,135 Hz,175 Hz",
+ sound_set_hw_eq_band1_frequency, 4,
+ TALK_ID(80, UNIT_HERTZ), TALK_ID(105, UNIT_HERTZ),
+ TALK_ID(135, UNIT_HERTZ), TALK_ID(175, UNIT_HERTZ)),
+/* Band 2 */
+ STRINGCHOICE_SETTING(F_SOUNDSETTING,
+ hw_eq_bands[AUDIOHW_EQ_BAND2].frequency,
+ LANG_HW_EQ_FREQUENCY, 0,"tone band2 frequency",
+ "230 Hz,300 Hz,385 Hz,500 Hz",
+ sound_set_hw_eq_band2_frequency, 4,
+ TALK_ID(230, UNIT_HERTZ), TALK_ID(300, UNIT_HERTZ),
+ TALK_ID(385, UNIT_HERTZ), TALK_ID(500, UNIT_HERTZ)),
+ CHOICE_SETTING(F_SOUNDSETTING, hw_eq_bands[AUDIOHW_EQ_BAND2].width,
+ LANG_HW_EQ_WIDTH, 0, "tone band2 width", "narrow,wide",
+ sound_set_hw_eq_band2_width, 2,
+ ID2P(LANG_HW_EQ_WIDTH_NARROW), ID2P(LANG_HW_EQ_WIDTH_WIDE)),
+/* Band 3 */
+ STRINGCHOICE_SETTING(F_SOUNDSETTING,
+ hw_eq_bands[AUDIOHW_EQ_BAND3].frequency,
+ LANG_HW_EQ_FREQUENCY, 0, "tone band3 frequency",
+ "650 Hz,850 Hz,1.1 kHz,1.4 kHz",
+ sound_set_hw_eq_band3_frequency, 4,
+ TALK_ID(650, UNIT_HERTZ), TALK_ID(850, UNIT_HERTZ),
+ TALK_ID_DECIMAL(11, 1, UNIT_KHZ),
+ TALK_ID_DECIMAL(14, 1, UNIT_KHZ)),
+ CHOICE_SETTING(F_SOUNDSETTING,hw_eq_bands[AUDIOHW_EQ_BAND3].width,
+ LANG_HW_EQ_WIDTH, 0, "tone band3 width", "narrow,wide",
+ sound_set_hw_eq_band3_width, 2,
+ ID2P(LANG_HW_EQ_WIDTH_NARROW), ID2P(LANG_HW_EQ_WIDTH_WIDE)),
+/* Band 4 */
+ STRINGCHOICE_SETTING(F_SOUNDSETTING,
+ hw_eq_bands[AUDIOHW_EQ_BAND4].frequency,
+ LANG_HW_EQ_FREQUENCY, 0, "tone band4 frequency",
+ "1.8 kHz,2.4 kHz,3.2 kHz,4.1 kHz",
+ sound_set_hw_eq_band4_frequency, 4,
+ TALK_ID_DECIMAL(18, 1, UNIT_KHZ),
+ TALK_ID_DECIMAL(24, 1, UNIT_KHZ),
+ TALK_ID_DECIMAL(32, 1, UNIT_KHZ),
+ TALK_ID_DECIMAL(41, 1, UNIT_KHZ)),
+ CHOICE_SETTING(F_SOUNDSETTING, hw_eq_bands[AUDIOHW_EQ_BAND4].width,
+ LANG_HW_EQ_WIDTH, 0, "tone band4 width", "narrow,wide",
+ sound_set_hw_eq_band4_width, 2,
+ ID2P(LANG_HW_EQ_WIDTH_NARROW), ID2P(LANG_HW_EQ_WIDTH_WIDE)),
+/* Band 5 */
+ STRINGCHOICE_SETTING(F_SOUNDSETTING,
+ hw_eq_bands[AUDIOHW_EQ_BAND5].frequency,
+ LANG_HW_EQ_FREQUENCY, 0, "tone band5 frequency",
+ "5.3 kHz,6.9 kHz,9.0 kHz,11.7 kHz",
+ sound_set_hw_eq_band5_frequency, 4,
+ TALK_ID_DECIMAL(53, 1, UNIT_KHZ),
+ TALK_ID_DECIMAL(69, 1, UNIT_KHZ),
+ TALK_ID_DECIMAL(90, 1, UNIT_KHZ),
+ TALK_ID_DECIMAL(117, 1, UNIT_KHZ)),
+#endif /* HAVE_WM8978 */
+#endif /* AUDIOHW_HAVE_EQ */
+/* 3-d enhancement effect */
#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",
@@ -574,6 +662,10 @@ const struct settings_list settings[] = {
ID2P(LANG_CHANNEL_RIGHT), ID2P(LANG_CHANNEL_KARAOKE)),
SOUND_SETTING(F_SOUNDSETTING, stereo_width, LANG_STEREO_WIDTH,
"stereo_width", SOUND_STEREO_WIDTH),
+#ifdef AUDIOHW_HAVE_DEPTH_3D
+ SOUND_SETTING(0,depth_3d, LANG_DEPTH_3D, "3-d enhancement",
+ SOUND_DEPTH_3D),
+#endif
/* playback */
OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL),
SYSTEM_SETTING(NVRAM(4), resume_index, -1),
@@ -1332,9 +1424,11 @@ const struct settings_list settings[] = {
"compressor release time", UNIT_MS, 100, 1000,
100, NULL, NULL, compressor_set),
#endif
-#ifdef HAVE_WM8758
+#ifdef AUDIOHW_HAVE_BASS_CUTOFF
SOUND_SETTING(F_NO_WRAP, bass_cutoff, LANG_BASS_CUTOFF,
"bass cutoff", SOUND_BASS_CUTOFF),
+#endif
+#ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
SOUND_SETTING(F_NO_WRAP, treble_cutoff, LANG_TREBLE_CUTOFF,
"treble cutoff", SOUND_TREBLE_CUTOFF),
#endif