alsa/alsa-lib-fix-snd_pcm_sw_params_set_period_event.diff

32 lines
1.6 KiB
Diff

From f1713475087027925358c3f9dd3db70723ed8d11 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@t61.perex-int.cz>
Date: Tue, 23 Feb 2010 10:58:00 +0100
Subject: [PATCH] Fix snd_pcm_sw_params_set_period_event() implementation
Fix the PCM timer open subdevice number in the pcm_hw plugin.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/pcm/pcm_hw.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index b557912..265335c 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -355,9 +355,9 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
if (enable) {
snd_timer_params_alloca(&params);
- err = snd_timer_hw_open(&hw->period_timer, "hw-pcm-period-event", SND_TIMER_CLASS_PCM, SND_TIMER_SCLASS_NONE, hw->card, hw->device, hw->subdevice, SND_TIMER_OPEN_NONBLOCK | SND_TIMER_OPEN_TREAD);
+ err = snd_timer_hw_open(&hw->period_timer, "hw-pcm-period-event", SND_TIMER_CLASS_PCM, SND_TIMER_SCLASS_NONE, hw->card, hw->device, (hw->subdevice << 1) | (pcm->stream & 1), SND_TIMER_OPEN_NONBLOCK | SND_TIMER_OPEN_TREAD);
if (err < 0) {
- err = snd_timer_hw_open(&hw->period_timer, "hw-pcm-period-event", SND_TIMER_CLASS_PCM, SND_TIMER_SCLASS_NONE, hw->card, hw->device, hw->subdevice, SND_TIMER_OPEN_NONBLOCK);
+ err = snd_timer_hw_open(&hw->period_timer, "hw-pcm-period-event", SND_TIMER_CLASS_PCM, SND_TIMER_SCLASS_NONE, hw->card, hw->device, (hw->subdevice << 1) | (pcm->stream & 1), SND_TIMER_OPEN_NONBLOCK);
return err;
}
if (snd_timer_poll_descriptors_count(hw->period_timer) != 1) {
--
1.7.0.1