Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Revell <rlrevell@joe-job.com>
To: Mikael Magnusson <mikaelmagnusson@glocalnet.net>
Cc: alsa-devel <alsa-devel@lists.sourceforge.net>
Subject: Re: Bug in emu10k1 multichannel support
Date: Fri, 11 Feb 2005 13:41:10 -0500	[thread overview]
Message-ID: <1108147270.20365.0.camel@krustophenia.net> (raw)
In-Reply-To: <1108086929.16531.2.camel@krustophenia.net>

On Thu, 2005-02-10 at 20:55 -0500, Lee Revell wrote:
> On Fri, 2005-02-11 at 00:26 +0100, Mikael Magnusson wrote:
> > I'm still having the same problem with emu10k1-multichannel-v009.patch 
> > and current CVS.
> > 
> 
> Thanks, I verified the bug is still there in 009.  I must have screwed
> up the patch, because I'm sure I fixed it.  I will post version 010
> soon.
> 

Please try this patch, on top of 009.

Lee

--- ../../alsa-v009-test/alsa-kernel/pci/emu10k1/voice.c	2005-02-10 16:55:56.000000000 -0500
+++ alsa-kernel/pci/emu10k1/voice.c	2005-02-06 05:16:49.000000000 -0500
@@ -48,47 +48,50 @@
 static int voice_alloc(emu10k1_t *emu, emu10k1_voice_type_t type, int number, emu10k1_voice_t **rvoice)
 {
 	emu10k1_voice_t *voice;
-	int idx, pair, i, j, k, first_voice, last_voice, skip;
+	int i, j, k, first_voice, last_voice, skip;
 
-	first_voice = last_voice = skip = 0;	
 	*rvoice = NULL;
-	for (i = emu->next_free_voice, j=0; j < NUM_G ; i += number, j+= number) {
+	first_voice = last_voice = 0;
+	for (i = emu->next_free_voice, j = 0; j < NUM_G ; i += number, j += number) {
 		// printk("i %d j %d next free %d!\n", i, j, emu->next_free_voice);
 		i %= NUM_G;
-		if ((i % 2) && (number == 2)) {
+
+		/* stereo voices must be even/odd */
+		if ((number == 2) && (i % 2)) {
 			i++;
 			continue;
 		}
 			
 		/* make sure the block of voices does not cross the 32 voice boundary */
-		if (((i % 32) + number) > 32)
-			continue;
+		//if (((i % 32) + number) > 32)
+		//	continue;
+
+		skip = 0;
 		for (k = 0; k < number; k++) {
-			voice = &emu->voices[i+k];
+			voice = &emu->voices[(i+k) % NUM_G];
 			if (voice->use) {
-				// printk("voice %d: use=1!\n", i+k);
+				printk("voice %d: use=1!\n", i+k);
 				skip = 1;
 			}
 		}
 		if (!skip) {
 			// printk("allocated voice %d\n", i);
 			first_voice = i;
-			last_voice = i + number;
+			last_voice = (i + number) % NUM_G;
 			emu->next_free_voice = last_voice;
-			emu->next_free_voice %= NUM_G;
 			break;
 		}
 	}
 	
 	if (first_voice == last_voice) {
-		printk("first==last, number %d, next free %d!\n", number, emu->next_free_voice);
-		/* BUG (or not enough voices)! */
+		printk("BUG (or not enough voices), number %d, next free %d!\n",
+				number,
+				emu->next_free_voice);
 		return -ENOMEM;
 	}	
 	
-	pair = ( number == 2 ) ? 1 : 0;
-	for (idx=first_voice; idx < last_voice; idx++) {
-		voice = &emu->voices[idx];
+	for (i=0; i < number; i++) {
+		voice = &emu->voices[(first_voice + i) % NUM_G];
 		// printk("voice alloc - %i, %i of %i\n", voice->number, idx-first_voice+1, number);
 		voice->use = 1;
 		switch (type) {




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

  reply	other threads:[~2005-02-11 18:41 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-18 23:31 [PATCH] emu10k1 multichannel support Lee Revell
2005-01-19 14:38 ` William
2005-01-19 16:10   ` Lee Revell
2005-01-19 16:59   ` Lee Revell
2005-01-19 17:49     ` William
2005-01-19 18:20     ` William
2005-01-19 18:24       ` Lee Revell
2005-01-19 16:48 ` Takashi Iwai
2005-01-19 19:10   ` Lee Revell
2005-01-21 21:45   ` Lee Revell
2005-01-23  0:49     ` James Courtier-Dutton
2005-01-26 18:05       ` Lee Revell
2005-01-23 20:05     ` Lee Revell
2005-01-29  3:54   ` Lee Revell
2005-01-31 16:09     ` Bug in " Mikael Magnusson
2005-02-10 22:17       ` Lee Revell
2005-02-10 23:26         ` Mikael Magnusson
2005-02-11  1:55           ` Lee Revell
2005-02-11 18:41             ` Lee Revell [this message]
2005-02-11 20:32               ` Mikael Magnusson
2005-02-10 23:33         ` Shayne O'Connor
2005-02-11  0:59           ` Lee Revell
2005-02-11  1:35             ` Shayne O'Connor
2005-02-11  1:33               ` Lee Revell
2005-02-11  2:31                 ` Shayne O'Connor
2005-02-11  3:55                   ` Lee Revell
2005-02-11  9:54                     ` Takashi Iwai
2005-01-19 19:51 ` [Alsa-user] [PATCH] " Alexander Samad
2005-01-19 21:11   ` Lee Revell
2005-01-19 21:25     ` Alexander Samad
2005-01-19 22:16     ` Alexander Samad
2005-01-19 22:19     ` Alexander Samad
2005-01-19 22:54       ` [Alsa-user] " Lee Revell
2005-01-21 21:41       ` Lee Revell
2005-01-22  0:49         ` James Courtier-Dutton
2005-01-23 20:31         ` [Alsa-devel] " Alexander Samad
2005-01-25 17:09 ` Brian L Scipioni
2005-01-25 18:43   ` [Alsa-user] " Lee Revell
     [not found]     ` <1106743059.30763.21.camel@radium.gaugetheory.org>
     [not found]       ` <1106756424.2935.1.camel@krustophenia.net>
     [not found]         ` <s5hu0p3nimh.wl@alsa2.suse.de>
2005-01-27 18:41           ` [Alsa-user] emu10k1 alsamixer items Lee Revell
2005-01-28 15:33             ` Takashi Iwai
     [not found]     ` <1108148365.4267.22.camel@radium.gaugetheory.org>
2005-02-11 19:41       ` [PATCH] emu10k1 multichannel support Lee Revell
2005-02-11 20:11         ` Brian L Scipioni
2005-02-11 20:14           ` [Alsa-user] " Lee Revell
2005-02-15 14:20         ` Brian L Scipioni
     [not found]     ` <1108148630.4267.28.camel@radium.gaugetheory.org>
2005-02-11 19:44       ` emu10k1 MIDI record Lee Revell
2005-02-11 20:06         ` Brian L Scipioni
2005-02-11 20:12           ` [Alsa-user] " Lee Revell
2005-02-12 15:34             ` Brian L Scipioni
2005-02-12 23:51               ` [Alsa-user] " Lee Revell
2005-02-15 14:44                 ` Brian L Scipioni
2005-01-25 21:33   ` [Alsa-user] [PATCH] emu10k1 multichannel support Lee Revell

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=1108147270.20365.0.camel@krustophenia.net \
    --to=rlrevell@joe-job.com \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=mikaelmagnusson@glocalnet.net \
    /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