diff options
author | Dave Chapman <dave@dchapman.com> | 2006-02-28 00:58:19 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2006-02-28 00:58:19 +0000 |
commit | 71ee68e97873978f1bb1f3fd63511f7c9396b965 (patch) | |
tree | 10e333dbe5118bb8eb10c73229afd089278798b4 /firmware/sound.c | |
parent | 9b1c9db66e1c9c0fc55164ca6e7cf1b95399a7ca (diff) | |
download | rockbox-71ee68e97873978f1bb1f3fd63511f7c9396b965.tar.gz rockbox-71ee68e97873978f1bb1f3fd63511f7c9396b965.zip |
iPod 5G: Correctly implement mute when setting volume
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8863 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/sound.c')
-rw-r--r-- | firmware/sound.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/firmware/sound.c b/firmware/sound.c index f1c9ff79e7..501e01e2d4 100644 --- a/firmware/sound.c +++ b/firmware/sound.c | |||
@@ -76,7 +76,7 @@ static const struct sound_settings_info sound_settings_table[] = { | |||
76 | [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass}, | 76 | [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass}, |
77 | [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, | 77 | [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, |
78 | #elif defined(HAVE_WM8758) | 78 | #elif defined(HAVE_WM8758) |
79 | [SOUND_VOLUME] = {"dB", 0, 1, -57, 6, -25, sound_set_volume}, | 79 | [SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25, sound_set_volume}, |
80 | [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass}, | 80 | [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass}, |
81 | [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, | 81 | [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, |
82 | #elif defined(HAVE_WM8731) | 82 | #elif defined(HAVE_WM8731) |
@@ -324,20 +324,22 @@ static int tenthdb2mixer(int db) | |||
324 | 324 | ||
325 | #elif defined(HAVE_WM8758) | 325 | #elif defined(HAVE_WM8758) |
326 | /* volume/balance/treble/bass interdependency */ | 326 | /* volume/balance/treble/bass interdependency */ |
327 | #define VOLUME_MIN -730 | 327 | #define VOLUME_MIN -570 |
328 | #define VOLUME_MAX 60 | 328 | #define VOLUME_MAX 60 |
329 | 329 | ||
330 | /* convert tenth of dB volume (-730..60) to master volume register value */ | 330 | /* convert tenth of dB volume (-57..6) to master volume register value */ |
331 | static int tenthdb2master(int db) | 331 | static int tenthdb2master(int db) |
332 | { | 332 | { |
333 | /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ | 333 | /* +6 to -57dB in 1dB steps == 64 levels = 6 bits */ |
334 | /* 1111111 == +6dB (0x7f) */ | 334 | /* 0111111 == +6dB (0x3f) = 63) */ |
335 | /* 1111001 == 0dB (0x79) */ | 335 | /* 0111001 == 0dB (0x39) = 57) */ |
336 | /* 0110000 == -73dB (0x30 */ | 336 | /* 0000001 == -56dB (0x01) = */ |
337 | /* 0101111 == mute (0x2f) */ | 337 | /* 0000000 == -57dB (0x00) */ |
338 | 338 | ||
339 | if (db <= -570) { | 339 | /* 1000000 == Mute (0x40) */ |
340 | return 0x0; | 340 | |
341 | if (db < -570) { | ||
342 | return 0x40; | ||
341 | } else { | 343 | } else { |
342 | return((db/10)+57); | 344 | return((db/10)+57); |
343 | } | 345 | } |