forked from len0rd/rockbox
iPod 5G: Correctly implement mute when setting volume
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8863 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9b1c9db66e
commit
71ee68e978
2 changed files with 12 additions and 16 deletions
|
|
@ -147,12 +147,6 @@ void wmcodec_enable_output(bool enable)
|
|||
|
||||
int wmcodec_set_master_vol(int vol_l, int vol_r)
|
||||
{
|
||||
/* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */
|
||||
/* 1111111 == +6dB */
|
||||
/* 1111001 == 0dB */
|
||||
/* 0110000 == -73dB */
|
||||
/* 0101111 == mute (0x2f) */
|
||||
|
||||
/* OUT1 */
|
||||
wm8758_write(LOUT1VOL, vol_l);
|
||||
wm8758_write(ROUT1VOL, 0x100 | vol_r);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ static const struct sound_settings_info sound_settings_table[] = {
|
|||
[SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass},
|
||||
[SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble},
|
||||
#elif defined(HAVE_WM8758)
|
||||
[SOUND_VOLUME] = {"dB", 0, 1, -57, 6, -25, sound_set_volume},
|
||||
[SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25, sound_set_volume},
|
||||
[SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass},
|
||||
[SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble},
|
||||
#elif defined(HAVE_WM8731)
|
||||
|
|
@ -324,20 +324,22 @@ static int tenthdb2mixer(int db)
|
|||
|
||||
#elif defined(HAVE_WM8758)
|
||||
/* volume/balance/treble/bass interdependency */
|
||||
#define VOLUME_MIN -730
|
||||
#define VOLUME_MIN -570
|
||||
#define VOLUME_MAX 60
|
||||
|
||||
/* convert tenth of dB volume (-730..60) to master volume register value */
|
||||
/* convert tenth of dB volume (-57..6) to master volume register value */
|
||||
static int tenthdb2master(int db)
|
||||
{
|
||||
/* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */
|
||||
/* 1111111 == +6dB (0x7f) */
|
||||
/* 1111001 == 0dB (0x79) */
|
||||
/* 0110000 == -73dB (0x30 */
|
||||
/* 0101111 == mute (0x2f) */
|
||||
/* +6 to -57dB in 1dB steps == 64 levels = 6 bits */
|
||||
/* 0111111 == +6dB (0x3f) = 63) */
|
||||
/* 0111001 == 0dB (0x39) = 57) */
|
||||
/* 0000001 == -56dB (0x01) = */
|
||||
/* 0000000 == -57dB (0x00) */
|
||||
|
||||
if (db <= -570) {
|
||||
return 0x0;
|
||||
/* 1000000 == Mute (0x40) */
|
||||
|
||||
if (db < -570) {
|
||||
return 0x40;
|
||||
} else {
|
||||
return((db/10)+57);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue