use dB units for balance control
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15902 a1c6a512-1295-4272-9138-f99709370657
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c
index 2dc1513..413b32e 100644
--- a/firmware/drivers/audio/as3514.c
+++ b/firmware/drivers/audio/as3514.c
@@ -33,7 +33,7 @@
/* HAVE_SW_TONE_CONTROLS */
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
+ [SOUND_BALANCE] = {"dB", 0, 1, -80, 80, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
[SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 39, 23},
diff --git a/firmware/drivers/audio/mas35xx.c b/firmware/drivers/audio/mas35xx.c
index 813b02e..2a7a37a 100644
--- a/firmware/drivers/audio/mas35xx.c
+++ b/firmware/drivers/audio/mas35xx.c
@@ -28,12 +28,13 @@
[SOUND_VOLUME] = {"dB", 0, 1,-100, 12, -25},
[SOUND_BASS] = {"dB", 0, 1, -12, 12, 6},
[SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 6},
+ [SOUND_BALANCE] = {"dB", 0, 1,-128, 127, 0},
#else /* MAS3507D */
[SOUND_VOLUME] = {"dB", 0, 1, -78, 18, -18},
[SOUND_BASS] = {"dB", 0, 1, -15, 15, 7},
[SOUND_TREBLE] = {"dB", 0, 1, -15, 15, 7},
+ [SOUND_BALANCE] = {"dB", 0, 1, -96, 96, 0},
#endif
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
diff --git a/firmware/drivers/audio/tlv320.c b/firmware/drivers/audio/tlv320.c
index c0f3730..121362a 100644
--- a/firmware/drivers/audio/tlv320.c
+++ b/firmware/drivers/audio/tlv320.c
@@ -29,7 +29,7 @@
/* HAVE_SW_TONE_CONTROLS */
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
+ [SOUND_BALANCE] = {"dB", 0, 1, -79, 79, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
[SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 31, 23},
diff --git a/firmware/drivers/audio/uda1380.c b/firmware/drivers/audio/uda1380.c
index 91bc9a1..2a7c212 100644
--- a/firmware/drivers/audio/uda1380.c
+++ b/firmware/drivers/audio/uda1380.c
@@ -30,7 +30,7 @@
[SOUND_VOLUME] = {"dB", 0, 1, -84, 0, -25},
[SOUND_BASS] = {"dB", 0, 2, 0, 24, 0},
[SOUND_TREBLE] = {"dB", 0, 2, 0, 6, 0},
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
+ [SOUND_BALANCE] = {"dB", 0, 1, -84, 84, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
[SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0},
diff --git a/firmware/drivers/audio/wm8721.c b/firmware/drivers/audio/wm8721.c
index dd3c133..0efbd85 100644
--- a/firmware/drivers/audio/wm8721.c
+++ b/firmware/drivers/audio/wm8721.c
@@ -43,7 +43,7 @@
/* HAVE_SW_TONE_CONTROLS */
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
+ [SOUND_BALANCE] = {"dB", 0, 1, -80, 80, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
};
diff --git a/firmware/drivers/audio/wm8731.c b/firmware/drivers/audio/wm8731.c
index e0e7cb3..48c8a6d 100644
--- a/firmware/drivers/audio/wm8731.c
+++ b/firmware/drivers/audio/wm8731.c
@@ -38,7 +38,7 @@
/* HAVE_SW_TONE_CONTROLS */
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
+ [SOUND_BALANCE] = {"dB", 0, 1, -80, 80, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
#ifdef HAVE_RECORDING
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c
index 78e1298..0b511f8 100644
--- a/firmware/drivers/audio/wm8751.c
+++ b/firmware/drivers/audio/wm8751.c
@@ -37,7 +37,7 @@
[SOUND_BASS] = {"dB", 1, 15, -60, 90, 0},
#endif
[SOUND_TREBLE] = {"dB", 1, 15, -60, 90, 0},
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
+ [SOUND_BALANCE] = {"dB", 0, 1, -80, 80, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
};
diff --git a/firmware/drivers/audio/wm8758.c b/firmware/drivers/audio/wm8758.c
index a9f10fb..02719f0 100644
--- a/firmware/drivers/audio/wm8758.c
+++ b/firmware/drivers/audio/wm8758.c
@@ -35,7 +35,7 @@
[SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25},
[SOUND_BASS] = {"dB", 0, 1, -12, 12, 0},
[SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 0},
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
+ [SOUND_BALANCE] = {"dB", 0, 1, -64, 64, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
[SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0},
diff --git a/firmware/drivers/audio/wm8975.c b/firmware/drivers/audio/wm8975.c
index 7762224..1603d42 100644
--- a/firmware/drivers/audio/wm8975.c
+++ b/firmware/drivers/audio/wm8975.c
@@ -39,7 +39,7 @@
[SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25},
[SOUND_BASS] = {"dB", 0, 1, -6, 9, 0},
[SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0},
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
+ [SOUND_BALANCE] = {"dB", 0, 1, -80, 80, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
[SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0},
diff --git a/firmware/sound.c b/firmware/sound.c
index 5a1a1e9..2dd5522 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -61,7 +61,7 @@
[SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN / 10, VOLUME_MAX / 10, -25},
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
- [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
+ [SOUND_BALANCE] = {"dB", 0, 1, VOLUME_RANGE / 10, -VOLUME_RANGE / 10, 0},
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
#if CONFIG_CODEC == MAS3587F || defined(HAVE_UDA1380) || defined(HAVE_TLV320)\
@@ -418,13 +418,13 @@
if(!audio_is_initialized)
return;
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
- unsigned tmp = ((unsigned)(value * 127 / 100) & 0xff) << 8;
+ unsigned tmp = ((unsigned)(value) & 0xff) << 8;
mas_codec_writereg(0x11, tmp);
#elif CONFIG_CODEC == MAS3507D || defined HAVE_UDA1380 \
|| defined HAVE_WM8975 || defined HAVE_WM8758 || defined HAVE_WM8731 \
|| defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) \
|| defined(HAVE_AS3514)
- current_balance = value * VOLUME_RANGE / 100; /* tenth of dB */
+ current_balance = value * 10; /* tenth of dB */
set_prescaled_volume();
#elif CONFIG_CPU == PNX0101
/* TODO: implement for iFP */