backport fixes
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=50
This commit is contained in:
parent
93407d290e
commit
8ed177009c
65
alsa-lib-fix-s24-3le-softvol.diff
Normal file
65
alsa-lib-fix-s24-3le-softvol.diff
Normal file
@ -0,0 +1,65 @@
|
||||
From bdf80e58af79d4e989cd8d701d97f888c9e2dadc Mon Sep 17 00:00:00 2001
|
||||
From: Zerg Cannibal <cnb_zerg@yahoo.com>
|
||||
Date: Mon, 21 Dec 2009 22:19:14 +0100
|
||||
Subject: [PATCH 2/2] pcm: Fix the sound distortions for S24_3LE stream in pcm_softvol plugin
|
||||
|
||||
This patch fixes sound distortions in alsa-lib "softvol"
|
||||
for S24_3LE sound stream, when softvol slider is not at 0.0dB
|
||||
position.
|
||||
|
||||
Signed-off-by: CannibalZerg <cnb_zerg@yahoo.com>
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/pcm/pcm_softvol.c | 22 ++++++++++++++++++++--
|
||||
1 files changed, 20 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c
|
||||
index 637e5cb..2c7c006 100644
|
||||
--- a/src/pcm/pcm_softvol.c
|
||||
+++ b/src/pcm/pcm_softvol.c
|
||||
@@ -107,7 +107,8 @@ static inline int MULTI_DIV_32x16(int a, unsigned short b)
|
||||
v.i = a;
|
||||
y.i = 0;
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
- x.i = (unsigned int)v.s[0] * b;
|
||||
+ x.i = (unsigned short)v.s[0];
|
||||
+ x.i *= b;
|
||||
y.s[0] = x.s[1];
|
||||
y.i += (int)v.s[1] * b;
|
||||
#else
|
||||
@@ -135,6 +136,23 @@ static inline int MULTI_DIV_int(int a, unsigned int b, int swap)
|
||||
return swap ? (int)bswap_32(fraction) : fraction;
|
||||
}
|
||||
|
||||
+/* always little endian */
|
||||
+static inline int MULTI_DIV_24(int a, unsigned int b)
|
||||
+{
|
||||
+ unsigned int gain = b >> VOL_SCALE_SHIFT;
|
||||
+ int fraction;
|
||||
+ fraction = MULTI_DIV_32x16(a, b & VOL_SCALE_MASK);
|
||||
+ if (gain) {
|
||||
+ long long amp = (long long)a * gain + fraction;
|
||||
+ if (amp > (int)0x7fffff)
|
||||
+ amp = (int)0x7fffff;
|
||||
+ else if (amp < (int)0x800000)
|
||||
+ amp = (int)0x800000;
|
||||
+ return (int)amp;
|
||||
+ }
|
||||
+ return fraction;
|
||||
+}
|
||||
+
|
||||
static inline short MULTI_DIV_short(short a, unsigned int b, int swap)
|
||||
{
|
||||
unsigned int gain = b >> VOL_SCALE_SHIFT;
|
||||
@@ -223,7 +241,7 @@ static inline short MULTI_DIV_short(short a, unsigned int b, int swap)
|
||||
tmp = src[0] | \
|
||||
(src[1] << 8) | \
|
||||
(((signed char *) src)[2] << 16); \
|
||||
- tmp = MULTI_DIV_int(tmp, vol_scale, 0); \
|
||||
+ tmp = MULTI_DIV_24(tmp, vol_scale); \
|
||||
dst[0] = tmp; \
|
||||
dst[1] = tmp >> 8; \
|
||||
dst[2] = tmp >> 16; \
|
||||
--
|
||||
1.6.5.7
|
||||
|
65
alsa-lib-pcm-close-event-timer.diff
Normal file
65
alsa-lib-pcm-close-event-timer.diff
Normal file
@ -0,0 +1,65 @@
|
||||
From a256766c10c52cb6667de8a65f5cbb332fad4cc7 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Mon, 21 Dec 2009 09:09:42 +0100
|
||||
Subject: [PATCH 1/2] pcm: Close event timer in pcm_hw plugin
|
||||
|
||||
Dan McCombs discovered that snd_pcm_close() invocations are not leading
|
||||
to associated timers being closed, which results in successively more
|
||||
timers being created but not freed.
|
||||
|
||||
Original patch from Daniel T Chen <crimsun@ubuntu.com>.
|
||||
|
||||
BugLink: https://bugs.launchpad.net/bugs/451893
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/pcm/pcm_hw.c | 26 ++++++++++++++------------
|
||||
1 files changed, 14 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
|
||||
index 2095b01..b557912 100644
|
||||
--- a/src/pcm/pcm_hw.c
|
||||
+++ b/src/pcm/pcm_hw.c
|
||||
@@ -338,18 +338,6 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
|
||||
-{
|
||||
- snd_pcm_hw_t *hw = pcm->private_data;
|
||||
- int fd = hw->fd, err;
|
||||
- if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
|
||||
- err = -errno;
|
||||
- SYSMSG("SNDRV_PCM_IOCTL_HW_FREE failed");
|
||||
- return err;
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static void snd_pcm_hw_close_timer(snd_pcm_hw_t *hw)
|
||||
{
|
||||
if (hw->period_timer) {
|
||||
@@ -421,6 +409,20 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
|
||||
} else {
|
||||
snd_pcm_hw_close_timer(hw);
|
||||
pcm->fast_ops = &snd_pcm_hw_fast_ops;
|
||||
+ hw->period_event = 0;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
|
||||
+{
|
||||
+ snd_pcm_hw_t *hw = pcm->private_data;
|
||||
+ int fd = hw->fd, err;
|
||||
+ snd_pcm_hw_change_timer(pcm, 0);
|
||||
+ if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
|
||||
+ err = -errno;
|
||||
+ SYSMSG("SNDRV_PCM_IOCTL_HW_FREE failed");
|
||||
+ return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
1.6.5.7
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 22 12:03:04 CET 2009 - tiwai@suse.de
|
||||
|
||||
- backport fix patches from GIT
|
||||
* pcm: Close event timer in pcm_hw plugin
|
||||
* Fix the sound distortions for S24_3LE stream in pcm_softvol
|
||||
plugin
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 18 17:36:49 CET 2009 - tiwai@suse.de
|
||||
|
||||
|
@ -52,6 +52,8 @@ Source32: all_notes_off.mid
|
||||
Source33: alsa-info.sh
|
||||
Source34: alsa-init.sh
|
||||
# Patch: alsa-lib-git-fixes.diff
|
||||
Patch1: alsa-lib-pcm-close-event-timer.diff
|
||||
Patch2: alsa-lib-fix-s24-3le-softvol.diff
|
||||
Url: http://www.alsa-project.org/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
@ -127,6 +129,8 @@ Authors:
|
||||
%prep
|
||||
%setup -q -n alsa-lib-%{package_version}
|
||||
# %patch -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
# hack to fix build on older distros
|
||||
%if %suse_version < 1100
|
||||
%ifarch %ix86
|
||||
|
Loading…
Reference in New Issue
Block a user