Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
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: Thu, 6 Mar 2008 21:51:24 +0100	[thread overview]
Message-ID: <20080306205124.GC32692@mathematik.uni-freiburg.de> (raw)
In-Reply-To: <s5h7igf3l71.wl%tiwai@suse.de>

[-- 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

  reply	other threads:[~2008-03-06 20:51 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
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 [this message]
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=20080306205124.GC32692@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