alsa/0026-tlv-fix-returned-dB-information-for-min-is-mute-cont.patch
Takashi Iwai 5e256f9e35 - Fix loopback config
* 0022-Fix-typo-for-surround-PCMs-in-src-conf-cards-Loopbac.patch
- Fix config syntax for hw device
  * 0023-namehint-Fix-hw-device-evaluation-missing-last-devic.patch
  * 0024-namehint-Another-fix-to-properly-evaluate-hw-devices.patch
  * 0025-config-file-processing-rewrite-the-locking-use-one-r.patch
- Fix dB-volume range with mute bit (bnc#648925)
  * 0026-tlv-fix-returned-dB-information-for-min-is-mute-cont.patch

OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=65
2010-10-25 07:41:00 +00:00

86 lines
2.6 KiB
Diff

From 2f6206da0c1ff88235e6eca0077343f22a4b43ee Mon Sep 17 00:00:00 2001
From: Clemens Ladisch <clemens@ladisch.de>
Date: Fri, 15 Oct 2010 10:33:20 +0200
Subject: [PATCH] tlv: fix returned dB information for min-is-mute controls
For TLV information that indicates that the minimum value is actually
muted, the returned range used the wrong minimum dB value, and
converting dB values to raw control values did not round up correctly
near the minimum.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/control/tlv.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/control/tlv.c b/src/control/tlv.c
index ba52752..f7c9976 100644
--- a/src/control/tlv.c
+++ b/src/control/tlv.c
@@ -167,17 +167,23 @@ int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
}
case SND_CTL_TLVT_DB_SCALE: {
int step;
- *min = (int)tlv[2];
+ if (tlv[3] & 0x10000)
+ *min = SND_CTL_TLV_DB_GAIN_MUTE;
+ else
+ *min = (int)tlv[2];
step = (tlv[3] & 0xffff);
- *max = *min + (long)(step * (rangemax - rangemin));
+ *max = (int)tlv[2] + step * (rangemax - rangemin);
return 0;
}
case SND_CTL_TLVT_DB_MINMAX:
- case SND_CTL_TLVT_DB_MINMAX_MUTE:
case SND_CTL_TLVT_DB_LINEAR:
*min = (int)tlv[2];
*max = (int)tlv[3];
return 0;
+ case SND_CTL_TLVT_DB_MINMAX_MUTE:
+ *min = SND_CTL_TLV_DB_GAIN_MUTE;
+ *max = (int)tlv[3];
+ return 0;
}
return -EINVAL;
}
@@ -217,7 +223,7 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
min = tlv[2];
step = (tlv[3] & 0xffff);
mute = (tlv[3] >> 16) & 1;
- if (mute && volume == rangemin)
+ if (mute && volume <= rangemin)
*db_gain = SND_CTL_TLV_DB_GAIN_MUTE;
else
*db_gain = (volume - rangemin) * step + min;
@@ -327,7 +333,11 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
step = (tlv[3] & 0xffff);
max = min + (int)(step * (rangemax - rangemin));
if (db_gain <= min)
- *value = rangemin;
+ if (db_gain > SND_CTL_TLV_DB_GAIN_MUTE && xdir > 0 &&
+ (tlv[3] & 0x10000))
+ *value = rangemin + 1;
+ else
+ *value = rangemin;
else if (db_gain >= max)
*value = rangemax;
else {
@@ -345,7 +355,11 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
min = tlv[2];
max = tlv[3];
if (db_gain <= min)
- *value = rangemin;
+ if (db_gain > SND_CTL_TLV_DB_GAIN_MUTE && xdir > 0 &&
+ tlv[0] == SND_CTL_TLVT_DB_MINMAX_MUTE)
+ *value = rangemin + 1;
+ else
+ *value = rangemin;
else if (db_gain >= max)
*value = rangemax;
else {
--
1.7.3.1