From: "Ahmet İnan" <ainan@mathematik.uni-freiburg.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ
Date: Fri, 22 Feb 2008 19:05:28 +0100 [thread overview]
Message-ID: <20080222180528.GD6860@mathematik.uni-freiburg.de> (raw)
In-Reply-To: <s5hmypusssj.wl%tiwai@suse.de>
[-- Attachment #1: Type: text/plain, Size: 949 bytes --]
when the time interval for a period is smaller than kernel HZ, then
snd-aloop and snd-dummy cannot call snd_pcm_period_elapsed as fast enough
annymore. this happens for example with games. but the app still needs to
see, that the buffer actually did go further, which is provided by these
patches.
[snd-aloop - better realtime app support]
http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-driver-hg-aloop-ainan-patch2.diff
[Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de>]
[snd-dummy - better realtime app support]
http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-kernel-hg-dummy-ainan-patch1.diff
[Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de>]
patches are relative to current hg-tree.
finally even realtime apps like games work smooth.
only one thing left for perfection :)
ahmet
--
admin der abteilung für angewandte mathematik, tel. 0761-203-5626
[-- Attachment #2: alsa-driver-hg-aloop-ainan-patch2.diff --]
[-- Type: text/plain, Size: 1070 bytes --]
diff -r 89222d702376 drivers/aloop-kernel.c
--- a/drivers/aloop-kernel.c Thu Feb 21 07:54:16 2008 +0100
+++ b/drivers/aloop-kernel.c Fri Feb 22 18:16:56 2008 +0100
@@ -198,10 +198,10 @@ static void snd_card_loopback_timer_func
spin_lock_irq(&dpcm->lock);
dpcm->pcm_irq_pos += dpcm->pcm_bps;
+ dpcm->pcm_buf_pos += dpcm->pcm_bps;
+ dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size * dpcm->pcm_hz;
if (dpcm->pcm_irq_pos >= dpcm->pcm_period_size * dpcm->pcm_hz) {
dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz;
- dpcm->pcm_buf_pos += dpcm->pcm_period_size;
- dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size;
spin_unlock_irq(&dpcm->lock);
snd_pcm_period_elapsed(dpcm->substream);
} else {
@@ -213,7 +213,7 @@ static snd_pcm_uframes_t snd_card_loopba
{
struct snd_pcm_runtime *runtime = substream->runtime;
snd_card_loopback_pcm_t *dpcm = runtime->private_data;
- return bytes_to_frames(runtime, dpcm->pcm_buf_pos);
+ return bytes_to_frames(runtime, dpcm->pcm_buf_pos / dpcm->pcm_hz);
}
static struct snd_pcm_hardware snd_card_loopback_info =
[-- Attachment #3: alsa-kernel-hg-dummy-ainan-patch1.diff --]
[-- Type: text/plain, Size: 1089 bytes --]
diff -r 1d499d7e155e drivers/dummy.c
--- a/drivers/dummy.c Thu Feb 21 12:40:00 2008 +0100
+++ b/drivers/dummy.c Fri Feb 22 18:25:20 2008 +0100
@@ -259,10 +259,10 @@ static void snd_card_dummy_pcm_timer_fun
dpcm->timer.expires = 1 + jiffies;
add_timer(&dpcm->timer);
dpcm->pcm_irq_pos += dpcm->pcm_bps;
+ dpcm->pcm_buf_pos += dpcm->pcm_bps;
+ dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size * dpcm->pcm_hz;
if (dpcm->pcm_irq_pos >= dpcm->pcm_period_size * dpcm->pcm_hz) {
dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz;
- dpcm->pcm_buf_pos += dpcm->pcm_period_size;
- dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size;
spin_unlock_irqrestore(&dpcm->lock, flags);
snd_pcm_period_elapsed(dpcm->substream);
} else
@@ -274,7 +274,7 @@ static snd_pcm_uframes_t snd_card_dummy_
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_dummy_pcm *dpcm = runtime->private_data;
- return bytes_to_frames(runtime, dpcm->pcm_buf_pos);
+ return bytes_to_frames(runtime, dpcm->pcm_buf_pos / dpcm->pcm_hz);
}
static struct snd_pcm_hardware snd_card_dummy_playback =
[-- Attachment #4: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2008-02-22 18:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-19 3:01 [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ Ahmet İnan
2008-02-19 12:50 ` Ahmet İnan
2008-02-20 11:47 ` Takashi Iwai
2008-02-20 14:19 ` Ahmet İnan
2008-02-20 16:08 ` Takashi Iwai
2008-02-21 0:06 ` Ahmet İnan
2008-02-21 6:54 ` Takashi Iwai
2008-02-22 18:05 ` Ahmet İnan [this message]
2008-02-28 11:48 ` Takashi Iwai
2008-03-01 11:55 ` Ahmet İnan
2008-03-01 15:22 ` Takashi Iwai
2008-03-01 23:35 ` Ahmet İnan
2008-03-06 15:51 ` Takashi Iwai
2008-03-06 20:51 ` Ahmet İnan
2008-05-31 20:00 ` Problem with aloop Ahmet İnan
2008-06-01 16:15 ` Benjamin van den Hout
2008-06-02 8:08 ` Ahmet İnan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080222180528.GD6860@mathematik.uni-freiburg.de \
--to=ainan@mathematik.uni-freiburg.de \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox