* [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ
@ 2008-02-19 3:01 Ahmet İnan
2008-02-19 12:50 ` Ahmet İnan
0 siblings, 1 reply; 17+ messages in thread
From: Ahmet İnan @ 2008-02-19 3:01 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 929 bytes --]
after using a HZ:=300 kernel for some time now and needing snd-aloop again i
found out, that i either had to correct the hardcoded number, or fix the
problem permanently, which couses stuttering and other problems.
i also removed the SYNC on start code, not just because its more or less
useless and brings problems, but ive got a nice idea how to fix this
overrun/underrun problem in a much nicer way.
so stay tuned for the next patch, until its implemented.
this patch here is more or less experimental, id like to hear some feedback.
http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-driver-1.0.15-aloop-ainan-patch0.diff
Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de>
please also include my email address when responding - i have no intention
to enable recieving emails from the list.
ahmet
--
admin der abteilung für angewandte mathematik, tel. 0761-203-5626
[-- Attachment #2: alsa-driver-1.0.15-aloop-ainan-patch0.diff --]
[-- Type: text/plain, Size: 5224 bytes --]
--- aloop-kernel-orig.c 2008-02-19 03:27:10.203115360 +0100
+++ aloop-kernel.c 2008-02-19 03:23:56.874121702 +0100
@@ -32,9 +32,6 @@
/* comment in to trash your kernel logfiles */
/* #define SND_CARD_LOOPBACK_VERBOSE */
-/* comment in for synchronization on start trigger
- * works well on alsa apps but bad on oss emulation */
-/* #define SND_CARD_LOOPBACK_START_SYNC */
MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
MODULE_DESCRIPTION("A loopback soundcard");
@@ -85,16 +82,13 @@
snd_card_loopback_t *loopback;
spinlock_t lock;
struct timer_list timer;
- int stream;
- unsigned int pcm_1000_size;
- unsigned int pcm_1000_count;
- unsigned int pcm_size;
- unsigned int pcm_count;
+ unsigned int pcm_size_hz;
+ unsigned int pcm_count_hz;
unsigned int pcm_bps; /* bytes per second */
- unsigned int pcm_1000_jiffie; /* 1000 * bytes per one jiffie */
- unsigned int pcm_1000_irq_pos; /* IRQ position */
- unsigned int pcm_1000_buf_pos; /* position in buffer */
- unsigned int pcm_period_pos; /* period aligned pos in buffer */
+ unsigned int pcm_hz; /* HZ */
+ unsigned int pcm_irq_pos_hz; /* IRQ position * HZ */
+ unsigned int pcm_buf_pos_hz; /* position in buffer * HZ */
+ unsigned int pcm_period_pos_hz; /* period aligned pos in buffer * HZ */
struct snd_pcm_substream *substream;
struct snd_card_loopback_cable *cable;
} snd_card_loopback_pcm_t;
@@ -123,18 +117,7 @@
{
struct snd_pcm_runtime *runtime = substream->runtime;
snd_card_loopback_pcm_t *dpcm = runtime->private_data;
-#ifdef SND_CARD_LOOPBACK_START_SYNC
- snd_card_loopback_pcm_t *capture_dpcm;
-#endif
if (cmd == SNDRV_PCM_TRIGGER_START) {
-#ifdef SND_CARD_LOOPBACK_START_SYNC
- if (dpcm->cable->capture_running) {
- capture_dpcm = dpcm->cable->capture->runtime->private_data;
- dpcm->pcm_1000_irq_pos = capture_dpcm->pcm_1000_irq_pos;
- dpcm->pcm_1000_buf_pos = capture_dpcm->pcm_1000_buf_pos;
- dpcm->pcm_period_pos = capture_dpcm->pcm_period_pos;
- }
-#endif
dpcm->cable->playback_running = 1;
snd_card_loopback_timer_start(substream);
} else if (cmd == SNDRV_PCM_TRIGGER_STOP) {
@@ -154,18 +137,7 @@
{
struct snd_pcm_runtime *runtime = substream->runtime;
snd_card_loopback_pcm_t *dpcm = runtime->private_data;
-#ifdef SND_CARD_LOOPBACK_START_SYNC
- snd_card_loopback_pcm_t *playback_dpcm;
-#endif
if (cmd == SNDRV_PCM_TRIGGER_START) {
-#ifdef SND_CARD_LOOPBACK_START_SYNC
- if (dpcm->cable->playback_running) {
- playback_dpcm = dpcm->cable->playback->runtime->private_data;
- dpcm->pcm_1000_irq_pos = playback_dpcm->pcm_1000_irq_pos;
- dpcm->pcm_1000_buf_pos = playback_dpcm->pcm_1000_buf_pos;
- dpcm->pcm_period_pos = playback_dpcm->pcm_period_pos;
- }
-#endif
dpcm->cable->capture_running = 1;
snd_card_loopback_timer_start(substream);
} else if (cmd == SNDRV_PCM_TRIGGER_STOP) {
@@ -190,14 +162,12 @@
if (bps <= 0)
return -EINVAL;
dpcm->pcm_bps = bps;
- dpcm->pcm_1000_jiffie = (1000 * bps) / HZ;
- dpcm->pcm_size = frames_to_bytes(runtime, runtime->buffer_size);
- dpcm->pcm_count = frames_to_bytes(runtime, runtime->period_size);
- dpcm->pcm_1000_size = 1000 * frames_to_bytes(runtime, runtime->buffer_size);
- dpcm->pcm_1000_count = 1000 * frames_to_bytes(runtime, runtime->period_size);
- dpcm->pcm_1000_irq_pos = 0;
- dpcm->pcm_1000_buf_pos = 0;
- dpcm->pcm_period_pos = 0;
+ dpcm->pcm_hz = HZ;
+ dpcm->pcm_size_hz = frames_to_bytes(runtime, runtime->buffer_size) * dpcm->pcm_hz;
+ dpcm->pcm_count_hz = frames_to_bytes(runtime, runtime->period_size) * dpcm->pcm_hz;
+ dpcm->pcm_irq_pos_hz = 0;
+ dpcm->pcm_buf_pos_hz = 0;
+ dpcm->pcm_period_pos_hz = 0;
cable->hw.formats = (1ULL << runtime->format);
cable->hw.rate_min = runtime->rate;
@@ -246,13 +216,13 @@
add_timer(&dpcm->timer);
spin_lock_irq(&dpcm->lock);
- dpcm->pcm_1000_irq_pos += dpcm->pcm_1000_jiffie;
- dpcm->pcm_1000_buf_pos += dpcm->pcm_1000_jiffie;
- dpcm->pcm_1000_buf_pos %= dpcm->pcm_1000_size;
- if (dpcm->pcm_1000_irq_pos >= dpcm->pcm_1000_count) {
- dpcm->pcm_1000_irq_pos %= dpcm->pcm_1000_count;
- dpcm->pcm_period_pos += dpcm->pcm_count;
- dpcm->pcm_period_pos %= dpcm->pcm_size;
+ dpcm->pcm_irq_pos_hz += dpcm->pcm_bps;
+ dpcm->pcm_buf_pos_hz += dpcm->pcm_bps;
+ dpcm->pcm_buf_pos_hz %= dpcm->pcm_size_hz;
+ if (dpcm->pcm_irq_pos_hz >= dpcm->pcm_count_hz) {
+ dpcm->pcm_irq_pos_hz %= dpcm->pcm_count_hz;
+ dpcm->pcm_period_pos_hz += dpcm->pcm_count_hz;
+ dpcm->pcm_period_pos_hz %= dpcm->pcm_size_hz;
spin_unlock_irq(&dpcm->lock);
snd_pcm_period_elapsed(dpcm->substream);
} else {
@@ -264,7 +234,7 @@
{
struct snd_pcm_runtime *runtime = substream->runtime;
snd_card_loopback_pcm_t *dpcm = runtime->private_data;
- return bytes_to_frames(runtime, dpcm->pcm_period_pos);
+ return bytes_to_frames(runtime, dpcm->pcm_period_pos_hz / dpcm->pcm_hz);
}
static struct snd_pcm_hardware snd_card_loopback_info =
@@ -381,7 +351,6 @@
dpcm->timer.data = (unsigned long)dpcm;
dpcm->timer.function = snd_card_loopback_timer_function;
dpcm->cable = &loopback->cables[substream->number][half];
- dpcm->stream = substream->stream;
runtime->private_data = dpcm;
runtime->private_free = snd_card_loopback_runtime_free;
runtime->hw = snd_card_loopback_info;
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 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 0 siblings, 1 reply; 17+ messages in thread From: Ahmet İnan @ 2008-02-19 12:50 UTC (permalink / raw) To: alsa-devel [-- Attachment #1: Type: text/plain, Size: 487 bytes --] sorry, forget about the patch before. this one here is a lot better to read and fixes one silly mistake. http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-driver-1.0.15-aloop-ainan-patch1.diff Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de> please also include my email address when responding - i have no intention to enable recieving emails from the list. ahmet -- admin der abteilung für angewandte mathematik, tel. 0761-203-5626 [-- Attachment #2: alsa-driver-1.0.15-aloop-ainan-patch1.diff --] [-- Type: text/plain, Size: 4340 bytes --] --- aloop-kernel-orig.c 2008-02-19 03:27:10.203115360 +0100 +++ aloop-kernel.c 2008-02-19 13:39:27.040593408 +0100 @@ -32,9 +32,6 @@ /* comment in to trash your kernel logfiles */ /* #define SND_CARD_LOOPBACK_VERBOSE */ -/* comment in for synchronization on start trigger - * works well on alsa apps but bad on oss emulation */ -/* #define SND_CARD_LOOPBACK_START_SYNC */ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); MODULE_DESCRIPTION("A loopback soundcard"); @@ -85,15 +82,12 @@ snd_card_loopback_t *loopback; spinlock_t lock; struct timer_list timer; - int stream; - unsigned int pcm_1000_size; - unsigned int pcm_1000_count; unsigned int pcm_size; unsigned int pcm_count; unsigned int pcm_bps; /* bytes per second */ - unsigned int pcm_1000_jiffie; /* 1000 * bytes per one jiffie */ - unsigned int pcm_1000_irq_pos; /* IRQ position */ - unsigned int pcm_1000_buf_pos; /* position in buffer */ + unsigned int pcm_hz; /* HZ */ + unsigned int pcm_irq_pos; /* IRQ position */ + unsigned int pcm_buf_pos; /* position in buffer */ unsigned int pcm_period_pos; /* period aligned pos in buffer */ struct snd_pcm_substream *substream; struct snd_card_loopback_cable *cable; @@ -123,18 +117,7 @@ { struct snd_pcm_runtime *runtime = substream->runtime; snd_card_loopback_pcm_t *dpcm = runtime->private_data; -#ifdef SND_CARD_LOOPBACK_START_SYNC - snd_card_loopback_pcm_t *capture_dpcm; -#endif if (cmd == SNDRV_PCM_TRIGGER_START) { -#ifdef SND_CARD_LOOPBACK_START_SYNC - if (dpcm->cable->capture_running) { - capture_dpcm = dpcm->cable->capture->runtime->private_data; - dpcm->pcm_1000_irq_pos = capture_dpcm->pcm_1000_irq_pos; - dpcm->pcm_1000_buf_pos = capture_dpcm->pcm_1000_buf_pos; - dpcm->pcm_period_pos = capture_dpcm->pcm_period_pos; - } -#endif dpcm->cable->playback_running = 1; snd_card_loopback_timer_start(substream); } else if (cmd == SNDRV_PCM_TRIGGER_STOP) { @@ -154,18 +137,7 @@ { struct snd_pcm_runtime *runtime = substream->runtime; snd_card_loopback_pcm_t *dpcm = runtime->private_data; -#ifdef SND_CARD_LOOPBACK_START_SYNC - snd_card_loopback_pcm_t *playback_dpcm; -#endif if (cmd == SNDRV_PCM_TRIGGER_START) { -#ifdef SND_CARD_LOOPBACK_START_SYNC - if (dpcm->cable->playback_running) { - playback_dpcm = dpcm->cable->playback->runtime->private_data; - dpcm->pcm_1000_irq_pos = playback_dpcm->pcm_1000_irq_pos; - dpcm->pcm_1000_buf_pos = playback_dpcm->pcm_1000_buf_pos; - dpcm->pcm_period_pos = playback_dpcm->pcm_period_pos; - } -#endif dpcm->cable->capture_running = 1; snd_card_loopback_timer_start(substream); } else if (cmd == SNDRV_PCM_TRIGGER_STOP) { @@ -190,13 +162,11 @@ if (bps <= 0) return -EINVAL; dpcm->pcm_bps = bps; - dpcm->pcm_1000_jiffie = (1000 * bps) / HZ; + dpcm->pcm_hz = HZ; dpcm->pcm_size = frames_to_bytes(runtime, runtime->buffer_size); dpcm->pcm_count = frames_to_bytes(runtime, runtime->period_size); - dpcm->pcm_1000_size = 1000 * frames_to_bytes(runtime, runtime->buffer_size); - dpcm->pcm_1000_count = 1000 * frames_to_bytes(runtime, runtime->period_size); - dpcm->pcm_1000_irq_pos = 0; - dpcm->pcm_1000_buf_pos = 0; + dpcm->pcm_irq_pos = 0; + dpcm->pcm_buf_pos = 0; dpcm->pcm_period_pos = 0; cable->hw.formats = (1ULL << runtime->format); @@ -246,11 +216,11 @@ add_timer(&dpcm->timer); spin_lock_irq(&dpcm->lock); - dpcm->pcm_1000_irq_pos += dpcm->pcm_1000_jiffie; - dpcm->pcm_1000_buf_pos += dpcm->pcm_1000_jiffie; - dpcm->pcm_1000_buf_pos %= dpcm->pcm_1000_size; - if (dpcm->pcm_1000_irq_pos >= dpcm->pcm_1000_count) { - dpcm->pcm_1000_irq_pos %= dpcm->pcm_1000_count; + dpcm->pcm_irq_pos += dpcm->pcm_bps; + dpcm->pcm_buf_pos += dpcm->pcm_bps; + dpcm->pcm_buf_pos %= dpcm->pcm_size * dpcm->pcm_hz; + if (dpcm->pcm_irq_pos >= dpcm->pcm_count * dpcm->pcm_hz) { + dpcm->pcm_irq_pos %= dpcm->pcm_count * dpcm->pcm_hz; dpcm->pcm_period_pos += dpcm->pcm_count; dpcm->pcm_period_pos %= dpcm->pcm_size; spin_unlock_irq(&dpcm->lock); @@ -381,7 +351,6 @@ dpcm->timer.data = (unsigned long)dpcm; dpcm->timer.function = snd_card_loopback_timer_function; dpcm->cable = &loopback->cables[substream->number][half]; - dpcm->stream = substream->stream; runtime->private_data = dpcm; runtime->private_free = snd_card_loopback_runtime_free; runtime->hw = snd_card_loopback_info; [-- Attachment #3: Type: text/plain, Size: 160 bytes --] _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-02-19 12:50 ` Ahmet İnan @ 2008-02-20 11:47 ` Takashi Iwai 2008-02-20 14:19 ` Ahmet İnan 0 siblings, 1 reply; 17+ messages in thread From: Takashi Iwai @ 2008-02-20 11:47 UTC (permalink / raw) To: Ahmet İnan; +Cc: alsa-devel At Tue, 19 Feb 2008 13:50:46 +0100, Ahmet İnan wrote: > > sorry, forget about the patch before. this one here is a lot better to read > and fixes one silly mistake. > > http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-driver-1.0.15-aloop-ainan-patch1.diff > > Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de> Looks like a good clean up. Applied to HG tree now. Thanks! Takashi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-02-20 11:47 ` Takashi Iwai @ 2008-02-20 14:19 ` Ahmet İnan 2008-02-20 16:08 ` Takashi Iwai 0 siblings, 1 reply; 17+ messages in thread From: Ahmet İnan @ 2008-02-20 14:19 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- Attachment #1: Type: text/plain, Size: 453 bytes --] more cleanups. removed some unneeded stuff. patch is relative to current hg-tree. http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-driver-hg-aloop-ainan-patch0.diff Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de> btw, my "nice" idea turned out to be a bitch, again. its really funny how worse almoust always is better. :( ahmet -- admin der abteilung für angewandte mathematik, tel. 0761-203-5626 [-- Attachment #2: alsa-driver-hg-aloop-ainan-patch0.diff --] [-- Type: text/plain, Size: 1257 bytes --] diff -r 4ce2c0f9f2ef drivers/aloop-kernel.c --- a/drivers/aloop-kernel.c Wed Feb 20 12:46:42 2008 +0100 +++ b/drivers/aloop-kernel.c Wed Feb 20 15:05:16 2008 +0100 @@ -86,7 +86,6 @@ typedef struct snd_card_loopback_pcm { unsigned int pcm_bps; /* bytes per second */ unsigned int pcm_hz; /* HZ */ unsigned int pcm_irq_pos; /* IRQ position */ - unsigned int pcm_buf_pos; /* position in buffer */ unsigned int pcm_period_pos; /* period aligned pos in buffer */ struct snd_pcm_substream *substream; struct snd_card_loopback_cable *cable; @@ -165,7 +164,6 @@ static int snd_card_loopback_prepare(str dpcm->pcm_size = frames_to_bytes(runtime, runtime->buffer_size); dpcm->pcm_count = frames_to_bytes(runtime, runtime->period_size); dpcm->pcm_irq_pos = 0; - dpcm->pcm_buf_pos = 0; dpcm->pcm_period_pos = 0; cable->hw.formats = (1ULL << runtime->format); @@ -216,8 +214,6 @@ 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_size * dpcm->pcm_hz; if (dpcm->pcm_irq_pos >= dpcm->pcm_count * dpcm->pcm_hz) { dpcm->pcm_irq_pos %= dpcm->pcm_count * dpcm->pcm_hz; dpcm->pcm_period_pos += dpcm->pcm_count; [-- Attachment #3: Type: text/plain, Size: 160 bytes --] _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-02-20 14:19 ` Ahmet İnan @ 2008-02-20 16:08 ` Takashi Iwai 2008-02-21 0:06 ` Ahmet İnan 0 siblings, 1 reply; 17+ messages in thread From: Takashi Iwai @ 2008-02-20 16:08 UTC (permalink / raw) To: Ahmet İnan; +Cc: alsa-devel At Wed, 20 Feb 2008 15:19:06 +0100, Ahmet İnan wrote: > > more cleanups. > > removed some unneeded stuff. > patch is relative to current hg-tree. > > http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-driver-hg-aloop-ainan-patch0.diff > > Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de> Thanks, applied now to HG tree. Takashi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-02-20 16:08 ` Takashi Iwai @ 2008-02-21 0:06 ` Ahmet İnan 2008-02-21 6:54 ` Takashi Iwai 0 siblings, 1 reply; 17+ messages in thread From: Ahmet İnan @ 2008-02-21 0:06 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- Attachment #1: Type: text/plain, Size: 808 bytes --] removed my old debugging macros. renamed variables to make it more clear. [snd-aloop - even more cleanups] http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-driver-hg-aloop-ainan-patch1.diff [Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de>] i promised to improve and clean up snd-dummy too, so here it is: reused the same method to improve timing, renamed the variables, added snd_pcm_format_set_silence on prepare. [snd-dummy - improved timing, silence on prepare] http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-kernel-hg-dummy-ainan-patch0.diff [Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de>] patches are relative to current hg-tree. ahmet -- admin der abteilung für angewandte mathematik, tel. 0761-203-5626 [-- Attachment #2: alsa-driver-hg-aloop-ainan-patch1.diff --] [-- Type: text/plain, Size: 3929 bytes --] diff -r 04f0b432fb15 drivers/aloop-kernel.c --- a/drivers/aloop-kernel.c Wed Feb 20 17:10:53 2008 +0100 +++ b/drivers/aloop-kernel.c Wed Feb 20 23:50:27 2008 +0100 @@ -29,9 +29,6 @@ #include <sound/pcm.h> #include <sound/initval.h> -/* comment in to trash your kernel logfiles */ -/* #define SND_CARD_LOOPBACK_VERBOSE */ - MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); MODULE_DESCRIPTION("A loopback soundcard"); MODULE_LICENSE("GPL"); @@ -81,12 +78,12 @@ typedef struct snd_card_loopback_pcm { snd_card_loopback_t *loopback; spinlock_t lock; struct timer_list timer; - unsigned int pcm_size; - unsigned int pcm_count; + unsigned int pcm_buffer_size; + unsigned int pcm_period_size; unsigned int pcm_bps; /* bytes per second */ unsigned int pcm_hz; /* HZ */ unsigned int pcm_irq_pos; /* IRQ position */ - unsigned int pcm_period_pos; /* period aligned pos in buffer */ + unsigned int pcm_buf_pos; /* position in buffer */ struct snd_pcm_substream *substream; struct snd_card_loopback_cable *cable; } snd_card_loopback_pcm_t; @@ -161,10 +158,10 @@ static int snd_card_loopback_prepare(str return -EINVAL; dpcm->pcm_bps = bps; dpcm->pcm_hz = HZ; - dpcm->pcm_size = frames_to_bytes(runtime, runtime->buffer_size); - dpcm->pcm_count = frames_to_bytes(runtime, runtime->period_size); + dpcm->pcm_buffer_size = frames_to_bytes(runtime, runtime->buffer_size); + dpcm->pcm_period_size = frames_to_bytes(runtime, runtime->period_size); dpcm->pcm_irq_pos = 0; - dpcm->pcm_period_pos = 0; + dpcm->pcm_buf_pos = 0; cable->hw.formats = (1ULL << runtime->format); cable->hw.rate_min = runtime->rate; @@ -189,19 +186,6 @@ static int snd_card_loopback_prepare(str cable->capture_valid = 1; } -#ifdef SND_CARD_LOOPBACK_VERBOSE - printk(KERN_INFO "snd-aloop(c%dd%ds%d%c): frq=%d chs=%d fmt=%d buf=%d per=%d pers=%d\n", - substream->pcm->card->number, - substream->pcm->device, - substream->stream, - (SNDRV_PCM_STREAM_PLAYBACK == substream->stream ? 'p' : 'c'), - runtime->rate, - runtime->channels, - snd_pcm_format_width(runtime->format), - frames_to_bytes(runtime, runtime->buffer_size), - frames_to_bytes(runtime, runtime->period_size), - runtime->periods); -#endif return 0; } @@ -214,10 +198,10 @@ static void snd_card_loopback_timer_func spin_lock_irq(&dpcm->lock); dpcm->pcm_irq_pos += dpcm->pcm_bps; - if (dpcm->pcm_irq_pos >= dpcm->pcm_count * dpcm->pcm_hz) { - dpcm->pcm_irq_pos %= dpcm->pcm_count * dpcm->pcm_hz; - dpcm->pcm_period_pos += dpcm->pcm_count; - dpcm->pcm_period_pos %= dpcm->pcm_size; + 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 { @@ -229,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_period_pos); + return bytes_to_frames(runtime, dpcm->pcm_buf_pos); } static struct snd_pcm_hardware snd_card_loopback_info = @@ -263,9 +247,6 @@ static int snd_card_loopback_hw_params(s snd_card_loopback_pcm_t *dpcm = runtime->private_data; struct snd_dma_buffer *dmab = NULL; if (NULL == dpcm->cable->dma_buffer) { -#ifdef SND_CARD_LOOPBACK_VERBOSE - printk(KERN_INFO "snd-aloop: allocating dma buffer\n"); -#endif dmab = kzalloc(sizeof(*dmab), GFP_KERNEL); if (NULL == dmab) return -ENOMEM; @@ -302,9 +283,6 @@ static int snd_card_loopback_hw_free(str if (NULL == cable->dma_buffer) return 0; -#ifdef SND_CARD_LOOPBACK_VERBOSE - printk(KERN_INFO "snd-aloop: freeing dma buffer\n"); -#endif snd_dma_free_pages(cable->dma_buffer); kfree(cable->dma_buffer); cable->dma_buffer = NULL; [-- Attachment #3: alsa-kernel-hg-dummy-ainan-patch0.diff --] [-- Type: text/plain, Size: 1987 bytes --] diff -r 97f6e4d58851 drivers/dummy.c --- a/drivers/dummy.c Wed Feb 20 17:13:44 2008 +0100 +++ b/drivers/dummy.c Thu Feb 21 00:14:46 2008 +0100 @@ -181,10 +181,10 @@ struct snd_dummy_pcm { struct snd_dummy *dummy; spinlock_t lock; struct timer_list timer; - unsigned int pcm_size; - unsigned int pcm_count; + unsigned int pcm_buffer_size; + unsigned int pcm_period_size; unsigned int pcm_bps; /* bytes per second */ - unsigned int pcm_jiffie; /* bytes per one jiffie */ + unsigned int pcm_hz; /* HZ */ unsigned int pcm_irq_pos; /* IRQ position */ unsigned int pcm_buf_pos; /* position in buffer */ struct snd_pcm_substream *substream; @@ -238,11 +238,15 @@ static int snd_card_dummy_pcm_prepare(st if (bps <= 0) return -EINVAL; dpcm->pcm_bps = bps; - dpcm->pcm_jiffie = bps / HZ; - dpcm->pcm_size = snd_pcm_lib_buffer_bytes(substream); - dpcm->pcm_count = snd_pcm_lib_period_bytes(substream); + dpcm->pcm_hz = HZ; + dpcm->pcm_buffer_size = snd_pcm_lib_buffer_bytes(substream); + dpcm->pcm_period_size = snd_pcm_lib_period_bytes(substream); dpcm->pcm_irq_pos = 0; dpcm->pcm_buf_pos = 0; + + snd_pcm_format_set_silence(runtime->format, runtime->dma_area, + bytes_to_samples(runtime, runtime->dma_bytes)); + return 0; } @@ -254,11 +258,11 @@ static void snd_card_dummy_pcm_timer_fun spin_lock_irqsave(&dpcm->lock, flags); dpcm->timer.expires = 1 + jiffies; add_timer(&dpcm->timer); - dpcm->pcm_irq_pos += dpcm->pcm_jiffie; - dpcm->pcm_buf_pos += dpcm->pcm_jiffie; - dpcm->pcm_buf_pos %= dpcm->pcm_size; - if (dpcm->pcm_irq_pos >= dpcm->pcm_count) { - dpcm->pcm_irq_pos %= dpcm->pcm_count; + dpcm->pcm_irq_pos += dpcm->pcm_bps; + 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 [-- 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 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-02-21 0:06 ` Ahmet İnan @ 2008-02-21 6:54 ` Takashi Iwai 2008-02-22 18:05 ` Ahmet İnan 0 siblings, 1 reply; 17+ messages in thread From: Takashi Iwai @ 2008-02-21 6:54 UTC (permalink / raw) To: Ahmet İnan; +Cc: alsa-devel At Thu, 21 Feb 2008 01:06:01 +0100, Ahmet İnan wrote: At Thu, 21 Feb 2008 01:06:01 +0100, Ahmet İnan wrote: > > [snd-aloop - even more cleanups] > http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-driver-hg-aloop-ainan-patch1.diff > [Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de>] > > i promised to improve and clean up snd-dummy too, so here it is: > reused the same method to improve timing, renamed the variables, > added snd_pcm_format_set_silence on prepare. > > [snd-dummy - improved timing, silence on prepare] > http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-kernel-hg-dummy-ainan-patch0.diff > [Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de>] > > patches are relative to current hg-tree. Thanks, applied both to HG tree now. Takashi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-02-21 6:54 ` Takashi Iwai @ 2008-02-22 18:05 ` Ahmet İnan 2008-02-28 11:48 ` Takashi Iwai 0 siblings, 1 reply; 17+ messages in thread From: Ahmet İnan @ 2008-02-22 18:05 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- 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 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-02-22 18:05 ` Ahmet İnan @ 2008-02-28 11:48 ` Takashi Iwai 2008-03-01 11:55 ` Ahmet İnan 0 siblings, 1 reply; 17+ messages in thread From: Takashi Iwai @ 2008-02-28 11:48 UTC (permalink / raw) To: Ahmet İnan; +Cc: alsa-devel At Fri, 22 Feb 2008 19:05:28 +0100, Ahmet İnan wrote: > > 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. Applied to HG tree now. Thanks. Takashi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-02-28 11:48 ` Takashi Iwai @ 2008-03-01 11:55 ` Ahmet İnan 2008-03-01 15:22 ` Takashi Iwai 0 siblings, 1 reply; 17+ messages in thread From: Ahmet İnan @ 2008-03-01 11:55 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel > > see, that the buffer actually did go further, which is provided by these > > patches. > Applied to HG tree now. Thanks. could it be, that you still forgot to apply this patch, but did the other? [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>] or you havent synced home alsa-driver with main repository yet, then never mind :) thanks ahmet -- admin der abteilung für angewandte mathematik, tel. 0761-203-5626 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-03-01 11:55 ` Ahmet İnan @ 2008-03-01 15:22 ` Takashi Iwai 2008-03-01 23:35 ` Ahmet İnan 0 siblings, 1 reply; 17+ messages in thread From: Takashi Iwai @ 2008-03-01 15:22 UTC (permalink / raw) To: Ahmet İnan; +Cc: alsa-devel At Sat, 1 Mar 2008 12:55:06 +0100, Ahmet İnan wrote: > > > > see, that the buffer actually did go further, which is provided by these > > > patches. > > Applied to HG tree now. Thanks. > > could it be, that you still forgot to apply this patch, but did the other? It was already applied but a different subject. Please follow the standard patch style at the next time. Takashi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-03-01 15:22 ` Takashi Iwai @ 2008-03-01 23:35 ` Ahmet İnan 2008-03-06 15:51 ` Takashi Iwai 0 siblings, 1 reply; 17+ messages in thread From: Ahmet İnan @ 2008-03-01 23:35 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel moved module parameter pcm_substreams range check code around, to prevent catastrophe. removed bogus module parameter pcm_devs code - aloop creates only one pair of devices. allowed float_le, too. removed obsolete code. [snd-aloop - more cleanups] http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-driver-hg-aloop-ainan-patch3.diff [Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de>] patch is relative to my previous patch. will fix bogus wiki entries, about the module parameters, too. ahmet -- admin der abteilung für angewandte mathematik, tel. 0761-203-5626 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 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 0 siblings, 2 replies; 17+ messages in thread From: Takashi Iwai @ 2008-03-06 15:51 UTC (permalink / raw) To: Ahmet İnan; +Cc: alsa-devel At Sun, 2 Mar 2008 00:35:03 +0100, Ahmet İnan wrote: > > moved module parameter pcm_substreams range check code around, to prevent catastrophe. > removed bogus module parameter pcm_devs code - aloop creates only one pair of devices. > allowed float_le, too. > removed obsolete code. > > [snd-aloop - more cleanups] > http://www.mathematik.uni-freiburg.de/IAM/homepages/ainan/alsa-driver-hg-aloop-ainan-patch3.diff > [Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de>] > > patch is relative to my previous patch. Please post the patch instead of URL. Also, it'd be appreciated if you follow the standard rule for submitting patches. We follow the linux kernel rule for alsa-driver tree, too. See $LINUX/Documentation/SubmittingPatches. thanks, Takashi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] improved snd-aloop quality when using certain samplerates and kernel HZ 2008-03-06 15:51 ` Takashi Iwai @ 2008-03-06 20:51 ` Ahmet İnan 2008-05-31 20:00 ` Problem with aloop Ahmet İnan 1 sibling, 0 replies; 17+ messages in thread From: Ahmet İnan @ 2008-03-06 20:51 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- Attachment #1: Type: text/plain, Size: 490 bytes --] > Also, it'd be appreciated if you follow the standard rule for thank you for pointing this out. will try my best. patch is relative to current hg-tree. ahmet snd-aloop - more cleanups moved module parameter pcm_substreams range check code around, to prevent catastrophe. removed bogus module parameter pcm_devs code - aloop creates only one pair of devices. allowed float_le, too. removed obsolete code. Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de> [-- Attachment #2: alsa-driver-hg-aloop-ainan-patch5.diff --] [-- Type: text/plain, Size: 3903 bytes --] diff -r 6def4892d3f5 drivers/aloop-kernel.c --- a/drivers/aloop-kernel.c Mon Mar 03 11:05:48 2008 +0100 +++ b/drivers/aloop-kernel.c Thu Mar 06 21:24:24 2008 +0100 @@ -39,9 +39,7 @@ static int index[SNDRV_CARDS] = SNDRV_DE static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; -static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8}; -/* static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for loopback soundcard."); @@ -49,12 +47,8 @@ MODULE_PARM_DESC(id, "ID string for loop MODULE_PARM_DESC(id, "ID string for loopback soundcard."); module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable this loopback soundcard."); -module_param_array(pcm_devs, int, NULL, 0444); -MODULE_PARM_DESC(pcm_devs, "PCM devices # (0-4) for loopback driver."); module_param_array(pcm_substreams, int, NULL, 0444); MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-8) for loopback driver."); -/* module_param_array(midi_devs, int, NULL, 0444); - * MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for loopback driver."); */ typedef struct snd_card_loopback_cable { struct snd_pcm_substream *playback; @@ -220,7 +214,8 @@ static struct snd_pcm_hardware snd_card_ { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID), - .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE), + .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_FLOAT_LE), .rates = (SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_192000), .rate_min = 8000, .rate_max = 192000, @@ -395,17 +390,11 @@ static int __init snd_card_loopback_pcm( struct snd_pcm *pcm; int err; - if (0 == device) { - if ((err = snd_pcm_new(loopback->card, "Loopback PCM", device, substreams, substreams, &pcm)) < 0) - return err; - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_loopback_playback_ops); - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_loopback_capture_ops); - } else { - if ((err = snd_pcm_new(loopback->card, "Loopback PCM", device, substreams, substreams, &pcm)) < 0) - return err; - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_loopback_playback_ops); - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_loopback_capture_ops); - } + if ((err = snd_pcm_new(loopback->card, "Loopback PCM", device, substreams, substreams, &pcm)) < 0) + return err; + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_loopback_playback_ops); + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_loopback_capture_ops); + pcm->private_data = loopback; pcm->info_flags = 0; strcpy(pcm->name, "Loopback PCM"); @@ -435,6 +424,11 @@ static int __init snd_card_loopback_prob return -ENOMEM; loopback = (struct snd_card_loopback *)card->private_data; + if (pcm_substreams[dev] < 1) + pcm_substreams[dev] = 1; + if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS) + pcm_substreams[dev] = MAX_PCM_SUBSTREAMS; + for (subdev = 0; subdev < pcm_substreams[dev]; subdev++) { for (half = 0; half < 2; half++) { loopback->cables[subdev][half].playback = NULL; @@ -450,10 +444,6 @@ static int __init snd_card_loopback_prob } loopback->card = card; - if (pcm_substreams[dev] < 1) - pcm_substreams[dev] = 1; - if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS) - pcm_substreams[dev] = MAX_PCM_SUBSTREAMS; if ((err = snd_card_loopback_pcm(loopback, 0, pcm_substreams[dev])) < 0) goto __nodev; if ((err = snd_card_loopback_pcm(loopback, 1, pcm_substreams[dev])) < 0) [-- Attachment #3: Type: text/plain, Size: 160 bytes --] _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Problem with aloop 2008-03-06 15:51 ` Takashi Iwai 2008-03-06 20:51 ` Ahmet İnan @ 2008-05-31 20:00 ` Ahmet İnan 2008-06-01 16:15 ` Benjamin van den Hout 1 sibling, 1 reply; 17+ messages in thread From: Ahmet İnan @ 2008-05-31 20:00 UTC (permalink / raw) To: alsa-devel; +Cc: Gustavo da Silva Serra, Benjamin van den Hout ive just read about aloop problems by chance, so excuse the late answer, for ive disabled recieving mails from this list. so also cc me when replying :) > repeating stuttering try tickless kernel, as it improves the quality of timer interrupts dramatically. dont forget to enable high resolution timer support, hpet and so on. > synchronization issue at the beginning this is still not resolved and its a pain in the ass to get this done right. ive implemented 4 different ways to solve it and im still not happy with what ive got. > kernel crash when closing do you really have to put at this manny places this del_timer? try to find the right place and resubmit. :) ahmet -- admin der abteilung für angewandte mathematik, tel. 0761-203-5626 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Problem with aloop 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 0 siblings, 1 reply; 17+ messages in thread From: Benjamin van den Hout @ 2008-06-01 16:15 UTC (permalink / raw) To: Ahmet İnan; +Cc: alsa-devel, Gustavo da Silva Serra Hi Ahmet, ive just read about aloop problems by chance, so excuse the late answer, > for ive disabled recieving mails from this list. so also cc me when > replying :) > No problem, I'm delighted somebody is answering my e-mails at all :) > repeating stuttering > try tickless kernel, as it improves the quality of timer interrupts > dramatically. > dont forget to enable high resolution timer support, hpet and so on. > OK, excellent tip. Thanks! High resolution timer support is already enabled and I've got the kernel configured for "realtime" performance (CONFIG_HZ or whatever it was called set to 1000 etc.). I'll try to see if the tickless kernel makes any difference. > > synchronization issue at the beginning > this is still not resolved and its a pain in the ass to get this done > right. > ive implemented 4 different ways to solve it and im still not happy with > what ive got. > The funny thing is, after I reverted to the 10.0.16 release tarball these stuttering problems went away. So the fixes that were committed in february/march under the 'fixes realtime behaviour' label actually made things much worse.. > > kernel crash when closing > do you really have to put at this manny places this del_timer? > try to find the right place and resubmit. :) > I already presumed it was a bit much, I'll be the last one to deny that! ;-) But then again, I'm not too familiar with ALSA kernel stuff anyway and the existing documentation seems a bit sparse. Also, this patch was made as part of a time-limited project at my company so I sadly couldn't spend more time on it after I (crudely) fixed the bug. However, I'd love to refine my patch (in my own spare time). Can you give me any pointers perhaps? They would be greatly appreciated. Thanks for taking the time to reply! Kind regards, Benjamin ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Problem with aloop 2008-06-01 16:15 ` Benjamin van den Hout @ 2008-06-02 8:08 ` Ahmet İnan 0 siblings, 0 replies; 17+ messages in thread From: Ahmet İnan @ 2008-06-02 8:08 UTC (permalink / raw) To: Benjamin van den Hout; +Cc: alsa-devel, Gustavo da Silva Serra > > > synchronization issue at the beginning > > this is still not resolved and its a pain in the ass to get this done > The funny thing is, after I reverted to the 10.0.16 release tarball these > stuttering problems went away. So the fixes that were committed in > february/march under the 'fixes realtime behaviour' label actually made > things much worse.. without SND_CARD_LOOPBACK_START_SYNC, its still the same. you should really get a tickless kernel first. otherwise its just pure luck and frustration. > > try to find the right place and resubmit. :) > (in my own spare time). Can you give me any pointers perhaps? They would be usually snd_card_loopback_playback_trigger gets called with SNDRV_PCM_TRIGGER_STOP whenever the device is about to be closed. so the next function would be snd_card_loopback_close. try snd_card_loopback_timer_stop there and report :D ahmet -- admin der abteilung für angewandte mathematik, tel. 0761-203-5626 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2008-06-02 8:08 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox