summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2007-12-10 11:07:38 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2007-12-10 11:07:38 +0000
commitdcf244192b4f5015a42e2d0d359b2c8c304d5ddd (patch)
tree325c106708929e4406dfecea67be10d7864ba073
parentec8ce3bfc20e359cc13b50af00272066ea7ee7c6 (diff)
downloadrockbox-dcf244192b4f5015a42e2d0d359b2c8c304d5ddd.tar.gz
rockbox-dcf244192b4f5015a42e2d0d359b2c8c304d5ddd.zip
use dB units for balance control
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15902 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/audio/as3514.c2
-rw-r--r--firmware/drivers/audio/mas35xx.c3
-rw-r--r--firmware/drivers/audio/tlv320.c2
-rw-r--r--firmware/drivers/audio/uda1380.c2
-rw-r--r--firmware/drivers/audio/wm8721.c2
-rw-r--r--firmware/drivers/audio/wm8731.c2
-rw-r--r--firmware/drivers/audio/wm8751.c2
-rw-r--r--firmware/drivers/audio/wm8758.c2
-rw-r--r--firmware/drivers/audio/wm8975.c2
-rw-r--r--firmware/sound.c6
10 files changed, 13 insertions, 12 deletions
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c
index 2dc1513668..413b32e8d7 100644
--- a/firmware/drivers/audio/as3514.c
+++ b/firmware/drivers/audio/as3514.c
@@ -33,7 +33,7 @@ const struct sound_settings_info audiohw_settings[] = {
33 /* HAVE_SW_TONE_CONTROLS */ 33 /* HAVE_SW_TONE_CONTROLS */
34 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, 34 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
35 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, 35 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
36 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 36 [SOUND_BALANCE] = {"dB", 0, 1, -80, 80, 0},
37 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 37 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
38 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 38 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
39 [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 39, 23}, 39 [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 39, 23},
diff --git a/firmware/drivers/audio/mas35xx.c b/firmware/drivers/audio/mas35xx.c
index 813b02e1ca..2a7a37aac4 100644
--- a/firmware/drivers/audio/mas35xx.c
+++ b/firmware/drivers/audio/mas35xx.c
@@ -28,12 +28,13 @@ const struct sound_settings_info audiohw_settings[] = {
28 [SOUND_VOLUME] = {"dB", 0, 1,-100, 12, -25}, 28 [SOUND_VOLUME] = {"dB", 0, 1,-100, 12, -25},
29 [SOUND_BASS] = {"dB", 0, 1, -12, 12, 6}, 29 [SOUND_BASS] = {"dB", 0, 1, -12, 12, 6},
30 [SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 6}, 30 [SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 6},
31 [SOUND_BALANCE] = {"dB", 0, 1,-128, 127, 0},
31#else /* MAS3507D */ 32#else /* MAS3507D */
32 [SOUND_VOLUME] = {"dB", 0, 1, -78, 18, -18}, 33 [SOUND_VOLUME] = {"dB", 0, 1, -78, 18, -18},
33 [SOUND_BASS] = {"dB", 0, 1, -15, 15, 7}, 34 [SOUND_BASS] = {"dB", 0, 1, -15, 15, 7},
34 [SOUND_TREBLE] = {"dB", 0, 1, -15, 15, 7}, 35 [SOUND_TREBLE] = {"dB", 0, 1, -15, 15, 7},
36 [SOUND_BALANCE] = {"dB", 0, 1, -96, 96, 0},
35#endif 37#endif
36 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
37 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 38 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
38 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 39 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
39#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 40#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
diff --git a/firmware/drivers/audio/tlv320.c b/firmware/drivers/audio/tlv320.c
index c0f37302fc..121362acaa 100644
--- a/firmware/drivers/audio/tlv320.c
+++ b/firmware/drivers/audio/tlv320.c
@@ -29,7 +29,7 @@ const struct sound_settings_info audiohw_settings[] = {
29 /* HAVE_SW_TONE_CONTROLS */ 29 /* HAVE_SW_TONE_CONTROLS */
30 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, 30 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
31 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, 31 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
32 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 32 [SOUND_BALANCE] = {"dB", 0, 1, -79, 79, 0},
33 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 33 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
34 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 34 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
35 [SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 31, 23}, 35 [SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 31, 23},
diff --git a/firmware/drivers/audio/uda1380.c b/firmware/drivers/audio/uda1380.c
index 91bc9a1a8e..2a7c2129ae 100644
--- a/firmware/drivers/audio/uda1380.c
+++ b/firmware/drivers/audio/uda1380.c
@@ -30,7 +30,7 @@ const struct sound_settings_info audiohw_settings[] = {
30 [SOUND_VOLUME] = {"dB", 0, 1, -84, 0, -25}, 30 [SOUND_VOLUME] = {"dB", 0, 1, -84, 0, -25},
31 [SOUND_BASS] = {"dB", 0, 2, 0, 24, 0}, 31 [SOUND_BASS] = {"dB", 0, 2, 0, 24, 0},
32 [SOUND_TREBLE] = {"dB", 0, 2, 0, 6, 0}, 32 [SOUND_TREBLE] = {"dB", 0, 2, 0, 6, 0},
33 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 33 [SOUND_BALANCE] = {"dB", 0, 1, -84, 84, 0},
34 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 34 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
35 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 35 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
36 [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0}, 36 [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0},
diff --git a/firmware/drivers/audio/wm8721.c b/firmware/drivers/audio/wm8721.c
index dd3c1332fc..0efbd8570d 100644
--- a/firmware/drivers/audio/wm8721.c
+++ b/firmware/drivers/audio/wm8721.c
@@ -43,7 +43,7 @@ const struct sound_settings_info audiohw_settings[] = {
43 /* HAVE_SW_TONE_CONTROLS */ 43 /* HAVE_SW_TONE_CONTROLS */
44 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, 44 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
45 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, 45 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
46 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 46 [SOUND_BALANCE] = {"dB", 0, 1, -80, 80, 0},
47 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 47 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
48 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 48 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
49}; 49};
diff --git a/firmware/drivers/audio/wm8731.c b/firmware/drivers/audio/wm8731.c
index e0e7cb38c0..48c8a6db15 100644
--- a/firmware/drivers/audio/wm8731.c
+++ b/firmware/drivers/audio/wm8731.c
@@ -38,7 +38,7 @@ const struct sound_settings_info audiohw_settings[] = {
38 /* HAVE_SW_TONE_CONTROLS */ 38 /* HAVE_SW_TONE_CONTROLS */
39 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, 39 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
40 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, 40 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
41 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 41 [SOUND_BALANCE] = {"dB", 0, 1, -80, 80, 0},
42 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 42 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
43 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 43 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
44#ifdef HAVE_RECORDING 44#ifdef HAVE_RECORDING
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c
index 78e129803e..0b511f8857 100644
--- a/firmware/drivers/audio/wm8751.c
+++ b/firmware/drivers/audio/wm8751.c
@@ -37,7 +37,7 @@ const struct sound_settings_info audiohw_settings[] = {
37 [SOUND_BASS] = {"dB", 1, 15, -60, 90, 0}, 37 [SOUND_BASS] = {"dB", 1, 15, -60, 90, 0},
38#endif 38#endif
39 [SOUND_TREBLE] = {"dB", 1, 15, -60, 90, 0}, 39 [SOUND_TREBLE] = {"dB", 1, 15, -60, 90, 0},
40 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 40 [SOUND_BALANCE] = {"dB", 0, 1, -80, 80, 0},
41 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 41 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
42 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 42 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
43}; 43};
diff --git a/firmware/drivers/audio/wm8758.c b/firmware/drivers/audio/wm8758.c
index a9f10fbe67..02719f0b9d 100644
--- a/firmware/drivers/audio/wm8758.c
+++ b/firmware/drivers/audio/wm8758.c
@@ -35,7 +35,7 @@ const struct sound_settings_info audiohw_settings[] = {
35 [SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25}, 35 [SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25},
36 [SOUND_BASS] = {"dB", 0, 1, -12, 12, 0}, 36 [SOUND_BASS] = {"dB", 0, 1, -12, 12, 0},
37 [SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 0}, 37 [SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 0},
38 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 38 [SOUND_BALANCE] = {"dB", 0, 1, -64, 64, 0},
39 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 39 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
40 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 40 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
41 [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0}, 41 [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0},
diff --git a/firmware/drivers/audio/wm8975.c b/firmware/drivers/audio/wm8975.c
index 7762224254..1603d42eea 100644
--- a/firmware/drivers/audio/wm8975.c
+++ b/firmware/drivers/audio/wm8975.c
@@ -39,7 +39,7 @@ const struct sound_settings_info audiohw_settings[] = {
39 [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, 39 [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25},
40 [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0}, 40 [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0},
41 [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0}, 41 [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0},
42 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 42 [SOUND_BALANCE] = {"dB", 0, 1, -80, 80, 0},
43 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 43 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
44 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 44 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
45 [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0}, 45 [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0},
diff --git a/firmware/sound.c b/firmware/sound.c
index 5a1a1e97b7..2dd5522e38 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -61,7 +61,7 @@ const struct sound_settings_info audiohw_settings[] = {
61 [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN / 10, VOLUME_MAX / 10, -25}, 61 [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN / 10, VOLUME_MAX / 10, -25},
62 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, 62 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
63 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, 63 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
64 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 64 [SOUND_BALANCE] = {"dB", 0, 1, VOLUME_RANGE / 10, -VOLUME_RANGE / 10, 0},
65 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 65 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
66 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 66 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
67#if CONFIG_CODEC == MAS3587F || defined(HAVE_UDA1380) || defined(HAVE_TLV320)\ 67#if CONFIG_CODEC == MAS3587F || defined(HAVE_UDA1380) || defined(HAVE_TLV320)\
@@ -418,13 +418,13 @@ void sound_set_balance(int value)
418 if(!audio_is_initialized) 418 if(!audio_is_initialized)
419 return; 419 return;
420#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 420#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
421 unsigned tmp = ((unsigned)(value * 127 / 100) & 0xff) << 8; 421 unsigned tmp = ((unsigned)(value) & 0xff) << 8;
422 mas_codec_writereg(0x11, tmp); 422 mas_codec_writereg(0x11, tmp);
423#elif CONFIG_CODEC == MAS3507D || defined HAVE_UDA1380 \ 423#elif CONFIG_CODEC == MAS3507D || defined HAVE_UDA1380 \
424 || defined HAVE_WM8975 || defined HAVE_WM8758 || defined HAVE_WM8731 \ 424 || defined HAVE_WM8975 || defined HAVE_WM8758 || defined HAVE_WM8731 \
425 || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) \ 425 || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) \
426 || defined(HAVE_AS3514) 426 || defined(HAVE_AS3514)
427 current_balance = value * VOLUME_RANGE / 100; /* tenth of dB */ 427 current_balance = value * 10; /* tenth of dB */
428 set_prescaled_volume(); 428 set_prescaled_volume();
429#elif CONFIG_CPU == PNX0101 429#elif CONFIG_CPU == PNX0101
430 /* TODO: implement for iFP */ 430 /* TODO: implement for iFP */