summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ryabinin <ryabinin.a.a@gmail.com>2013-05-12 23:23:45 +0400
committerAndrew Ryabinin <ryabinin.a.a@gmail.com>2013-05-24 11:18:16 +0400
commit0519f7e5ab6d17f90257caffad85862187bffed6 (patch)
tree775bf5d5dff034919521d646fe6b01ef5eda8d24
parentf6e179bd8eeb417e0428b8290df4ca058782e8b3 (diff)
downloadrockbox-0519f7e5ab6d17f90257caffad85862187bffed6.tar.gz
rockbox-0519f7e5ab6d17f90257caffad85862187bffed6.tar.bz2
rockbox-0519f7e5ab6d17f90257caffad85862187bffed6.zip
Add DAC's oversampling filter roll-off selection to sound settings.
Change-Id: I1258ba50dd9308f49d97965562f3a423c9bfb785
-rw-r--r--apps/lang/english.lang42
-rw-r--r--apps/menus/sound_menu.c7
-rw-r--r--apps/settings.c3
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_list.c7
-rw-r--r--firmware/export/audiohw.h16
-rw-r--r--firmware/export/audiohw_settings.h3
-rw-r--r--firmware/export/sound.h4
-rw-r--r--firmware/sound.c10
9 files changed, 96 insertions, 0 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 26c0051b58..dbd0baa18a 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -13114,3 +13114,45 @@
*: "Select directories to scan"
</voice>
</phrase>
+<phrase>
+ id: LANG_FILTER_ROLL_OFF
+ desc: in sound settings
+ user: core
+ <source>
+ *: "DAC's filter roll-off"
+ </source>
+ <dest>
+ *: "DAC's filter roll-off"
+ </dest>
+ <voice>
+ *: "DAC's filter roll-off"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_FILTER_SHARP
+ desc: in sound settings
+ user: core
+ <source>
+ *: "Sharp"
+ </source>
+ <dest>
+ *: "Sharp"
+ </dest>
+ <voice>
+ *: "Sharp"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_FILTER_SLOW
+ desc: in sound settings
+ user: core
+ <source>
+ *: "Slow"
+ </source>
+ <dest>
+ *: "Slow"
+ </dest>
+ <voice>
+ *: "Slow"
+ </voice>
+</phrase>
diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c
index d24a9cd695..fd192cb661 100644
--- a/apps/menus/sound_menu.c
+++ b/apps/menus/sound_menu.c
@@ -88,6 +88,10 @@ MENUITEM_SETTING(stereo_width, &global_settings.stereo_width,
MENUITEM_SETTING(depth_3d, &global_settings.depth_3d, NULL);
#endif
+#ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF
+MENUITEM_SETTING(roll_off, &global_settings.roll_off, NULL);
+#endif
+
#if CONFIG_CODEC == SWCODEC
/* Crossfeed Submenu */
MENUITEM_SETTING(crossfeed, &global_settings.crossfeed, lowlatency_callback);
@@ -183,6 +187,9 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio,
#ifdef AUDIOHW_HAVE_DEPTH_3D
,&depth_3d
#endif
+#ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF
+ ,&roll_off
+#endif
#if CONFIG_CODEC == SWCODEC
,&crossfeed_menu, &equalizer_menu, &dithering_enabled
#ifdef HAVE_PITCHCONTROL
diff --git a/apps/settings.c b/apps/settings.c
index b04b91cc66..adc53cd14b 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -753,6 +753,9 @@ void sound_settings_apply(void)
#ifdef AUDIOHW_HAVE_DEPTH_3D
sound_set(SOUND_DEPTH_3D, global_settings.depth_3d);
#endif
+#ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF
+ sound_set(SOUND_FILTER_ROLL_OFF, global_settings.roll_off);
+#endif
#ifdef AUDIOHW_HAVE_EQ
int b;
diff --git a/apps/settings.h b/apps/settings.h
index 53ad70b24f..1aec931798 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -790,6 +790,10 @@ struct user_settings
int depth_3d;
#endif
+#ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF
+ int roll_off;
+#endif
+
#ifdef AUDIOHW_HAVE_EQ
/** Hardware EQ tone controls **/
struct hw_eq_band
diff --git a/apps/settings_list.c b/apps/settings_list.c
index ec34a96dc5..c1b40a64b6 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -778,6 +778,13 @@ const struct settings_list settings[] = {
SOUND_SETTING(0,depth_3d, LANG_DEPTH_3D, "3-d enhancement",
SOUND_DEPTH_3D),
#endif
+
+#ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF
+ CHOICE_SETTING(F_SOUNDSETTING, roll_off, LANG_FILTER_ROLL_OFF, 0,
+ "roll_off", "sharp,slow", sound_set_filter_roll_off,
+ 2, ID2P(LANG_FILTER_SHARP), ID2P(LANG_FILTER_SLOW)),
+#endif
+
/* playback */
OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL),
SYSTEM_SETTING(NVRAM(4), resume_index, -1),
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
index d1579b5b93..1cabf6f782 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -40,6 +40,7 @@
#define MONO_VOL_CAP (1 << 10)
#define LIN_GAIN_CAP (1 << 11)
#define MIC_GAIN_CAP (1 << 12)
+#define FILTER_ROLL_OFF_CAP (1 << 13)
/* Used by every driver to export its min/max/default values for its audio
settings. */
@@ -269,6 +270,11 @@ enum AUDIOHW_EQ_SETTINGS
#define AUDIOHW_HAVE_MIC_GAIN
#endif
#endif /* HAVE_RECORDING */
+
+#if (AUDIOHW_CAPS & FILTER_ROLL_OFF_CAP)
+#define AUDIOHW_HAVE_FILTER_ROLL_OFF
+#endif
+
#endif /* AUDIOHW_CAPS */
#ifdef HAVE_SW_TONE_CONTROLS
@@ -454,6 +460,16 @@ void audiohw_set_eq_band_width(unsigned int band, int val);
void audiohw_set_depth_3d(int val);
#endif
+#ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF
+/**
+ * Set DAC's oversampling filter roll-off.
+ * @param val 0 - sharp roll-off, 1 - slow roll-off.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * FILTER_ROLL_OFF_CAP
+ */
+void audiohw_set_filter_roll_off(int val);
+#endif
+
void audiohw_set_frequency(int fsel);
diff --git a/firmware/export/audiohw_settings.h b/firmware/export/audiohw_settings.h
index f934c96302..675ec59a7b 100644
--- a/firmware/export/audiohw_settings.h
+++ b/firmware/export/audiohw_settings.h
@@ -110,6 +110,9 @@ AUDIOHW_SETTINGS(
#if defined(AUDIOHW_HAVE_DEPTH_3D)
AUDIOHW_SETTING_ENT(DEPTH_3D, sound_set_depth_3d)
#endif
+#if defined(AUDIOHW_HAVE_FILTER_ROLL_OFF)
+ AUDIOHW_SETTING_ENT(FILTER_ROLL_OFF, sound_set_filter_roll_off)
+#endif
/* Hardware EQ tone controls */
#if defined(AUDIOHW_HAVE_EQ)
AUDIOHW_SETTING_ENT(EQ_BAND1_GAIN, sound_set_hw_eq_band1_gain)
diff --git a/firmware/export/sound.h b/firmware/export/sound.h
index fa76c67b1f..501c6a48a1 100644
--- a/firmware/export/sound.h
+++ b/firmware/export/sound.h
@@ -51,6 +51,10 @@ void sound_set_treble_cutoff(int value);
void sound_set_depth_3d(int value);
#endif
+#if defined(AUDIOHW_HAVE_FILTER_ROLL_OFF)
+void sound_set_filter_roll_off(int value);
+#endif
+
#ifdef AUDIOHW_HAVE_EQ
/*
* band = SOUND_EQ_BANDb
diff --git a/firmware/sound.c b/firmware/sound.c
index 336fe90c25..a19cc15c41 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -314,6 +314,16 @@ void sound_set_depth_3d(int value)
}
#endif /* AUDIOHW_HAVE_DEPTH_3D */
+#if defined(AUDIOHW_HAVE_FILTER_ROLL_OFF)
+void sound_set_filter_roll_off(int value)
+{
+ if (!audio_is_initialized)
+ return;
+
+ audiohw_set_filter_roll_off(value);
+}
+#endif
+
#if defined(AUDIOHW_HAVE_EQ)
int sound_enum_hw_eq_band_setting(unsigned int band,
unsigned int band_setting)