1
0
Fork 0
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:
Dave Chapman 2006-02-28 00:58:19 +00:00
parent 9b1c9db66e
commit 71ee68e978
2 changed files with 12 additions and 16 deletions

View file

@ -147,12 +147,6 @@ void wmcodec_enable_output(bool enable)
int wmcodec_set_master_vol(int vol_l, int vol_r) 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 */ /* OUT1 */
wm8758_write(LOUT1VOL, vol_l); wm8758_write(LOUT1VOL, vol_l);
wm8758_write(ROUT1VOL, 0x100 | vol_r); wm8758_write(ROUT1VOL, 0x100 | vol_r);

View file

@ -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_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass},
[SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble},
#elif defined(HAVE_WM8758) #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_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass},
[SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble},
#elif defined(HAVE_WM8731) #elif defined(HAVE_WM8731)
@ -324,20 +324,22 @@ static int tenthdb2mixer(int db)
#elif defined(HAVE_WM8758) #elif defined(HAVE_WM8758)
/* volume/balance/treble/bass interdependency */ /* volume/balance/treble/bass interdependency */
#define VOLUME_MIN -730 #define VOLUME_MIN -570
#define VOLUME_MAX 60 #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) static int tenthdb2master(int db)
{ {
/* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ /* +6 to -57dB in 1dB steps == 64 levels = 6 bits */
/* 1111111 == +6dB (0x7f) */ /* 0111111 == +6dB (0x3f) = 63) */
/* 1111001 == 0dB (0x79) */ /* 0111001 == 0dB (0x39) = 57) */
/* 0110000 == -73dB (0x30 */ /* 0000001 == -56dB (0x01) = */
/* 0101111 == mute (0x2f) */ /* 0000000 == -57dB (0x00) */
if (db <= -570) { /* 1000000 == Mute (0x40) */
return 0x0;
if (db < -570) {
return 0x40;
} else { } else {
return((db/10)+57); return((db/10)+57);
} }