From 2d7bb99c524c5da0d3360161f298503dcfbb01c7 Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Wed, 7 Mar 2007 15:00:29 +0000 Subject: Hack around the lack of a hardware prescaler on a number of WM codecs. Bass and treble controls should work on DAPs using these chips now, but will be prone to distort when boosting bass. Gut out UDA1380 code(!!) and switch to high bass cutoff and low treble cutoff in WM8975 driver. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12673 a1c6a512-1295-4272-9138-f99709370657 --- firmware/sound.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'firmware/sound.c') diff --git a/firmware/sound.c b/firmware/sound.c index 01d76a0a39..6182e6b567 100644 --- a/firmware/sound.c +++ b/firmware/sound.c @@ -312,9 +312,14 @@ int current_bass = 0; /* -150..+150 0..+240 */ static void set_prescaled_volume(void) { - int prescale; + int prescale = 0; int l, r; +/* The WM codecs listed don't have suitable prescaler functionality, so we let + * the prescaler stay at 0 for these unless SW tone controls are in use */ +#if defined(HAVE_SW_TONE_CONTROLS) || !(defined(HAVE_WM8975) \ + || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751)) + prescale = MAX(current_bass, current_treble); if (prescale < 0) prescale = 0; /* no need to prescale if we don't boost @@ -325,13 +330,13 @@ static void set_prescaled_volume(void) * instead (might cause clipping). */ if (current_volume + prescale > VOLUME_MAX) prescale = VOLUME_MAX - current_volume; - +#endif + #if defined(HAVE_SW_TONE_CONTROLS) dsp_callback(DSP_CALLBACK_SET_PRESCALE, prescale); #elif CONFIG_CODEC == MAS3507D mas_writereg(MAS_REG_KPRESCALE, prescale_table[prescale/10]); -#elif defined(HAVE_UDA1380) || defined(HAVE_WM8975) || defined(HAVE_WM8758) \ - || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751) +#elif defined(HAVE_UDA1380) || defined(HAVE_WM8758) audiohw_set_mixer_vol(tenthdb2mixer(-prescale), tenthdb2mixer(-prescale)); #endif -- cgit v1.2.3