WM8978: sound.c weirdness strikes again. Prescaler values have to be in centibels.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29100 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2011-01-21 08:31:40 +00:00
parent 863c03f2ae
commit 485aecd923
2 changed files with 15 additions and 3 deletions

View file

@ -217,6 +217,14 @@ int sound_val2phys(int setting, int value)
break;
#endif
case SOUND_EQ_BAND1_GAIN+0x10000:
case SOUND_EQ_BAND2_GAIN+0x10000:
case SOUND_EQ_BAND3_GAIN+0x10000:
case SOUND_EQ_BAND4_GAIN+0x10000:
case SOUND_EQ_BAND5_GAIN+0x10000:
result = value * 10;
break;
case SOUND_DEPTH_3D:
result = (100 * value + 8) / 15;
break;
@ -330,7 +338,7 @@ static void sync_prescaler(void)
/* Combine all prescaling into a single DAC attenuation */
if (wmc_vol.eq_on)
prescaler = wmc_vol.prescaler * 2;
prescaler = wmc_vol.prescaler;
if (wmc_vol.enh_3d_on)
prescaler += wmc_vol.enh_3d_prescaler;
@ -460,7 +468,7 @@ void audiohw_set_eq_band_width(unsigned int band, int val)
* gain to EQ bands. */
void audiohw_set_prescaler(int val)
{
wmc_vol.prescaler = val;
wmc_vol.prescaler = val / 5; /* centibels->semi-decibels */
sync_prescaler();
}

View file

@ -477,10 +477,14 @@ int sound_enum_hw_eq_band_setting(unsigned int band,
static void sound_set_hw_eq_band_gain(unsigned int band, int value)
{
int setting;
if(!audio_is_initialized)
return;
current_eq_band_gain[band] = value;
setting = sound_enum_hw_eq_band_setting(band, AUDIOHW_EQ_GAIN);
current_eq_band_gain[band] = sound_val2phys(setting + 0x10000, value);
audiohw_set_eq_band_gain(band, value);
set_prescaled_volume();
}