All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove emu10k1 pops/clicks at the beginning and end of playback (fwd)
@ 2005-03-04  8:33 Jaroslav Kysela
  2005-03-04 18:17 ` Lee Revell
  0 siblings, 1 reply; 12+ messages in thread
From: Jaroslav Kysela @ 2005-03-04  8:33 UTC (permalink / raw)
  To: ALSA development; +Cc: Jindrich Makovicka

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1232 bytes --]

Hi,

	could emu10k1 hackers review this patch?

					Thanks,
						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

---------- Forwarded message ----------
Date: Fri, 04 Mar 2005 09:17:15 +0100
From: Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
To: perex@suse.cz
Subject: [PATCH] remove emu10k1 pops/clicks at the beginning and end of
    playback

Hello,

I experienced very annoying pops and clicks et the end (and sometimes at 
the beginning) of audio playback with ALSA. This is especially bad for 
UI sounds like instant mesaging beeps.

I don't know emu10k architecture much, but there seems to be a bug with 
buffer setup for 16bit samples (as the pop doesn't occur for 8bit) - 
this causes the pop at the end, and also improper purging of the cache - 
which causes a pop at the beginning when playing 16bit sample after an 
8bit one and vice versa.

The attached patch fixes the issue for me. It changes the calculation of 
the start address offset for 16bit samples (previously it was multiplied 
by 2, while the start and end addresses were divided), and it purges all 
cache registers for both channels in invalidate_cache.

Best regards,
-- 
Jindrich Makovicka

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/X-PATCH; NAME="emupcm.c.patch", Size: 1326 bytes --]

--- emupcm.c.orig	2005-03-01 11:18:37.000000000 +0100
+++ emupcm.c	2005-03-03 23:28:07.158769431 +0100
@@ -276,7 +276,7 @@
 	if (master) {
 		unsigned int ccis = stereo ? 28 : 30;
 		if (w_16)
-			ccis *= 2;
+			ccis >>= 1;
 		evoice->epcm->ccca_start_addr = start_addr + ccis;
 		if (extra) {
 			start_addr += ccis;
@@ -490,15 +490,19 @@
 	sample = snd_pcm_format_width(runtime->format) == 16 ? 0 : 0x80808080;
 	if (runtime->channels > 1) {
 		ccis = 28;
-		cs = 4;
+		cs = 16;
 	} else {
 		ccis = 30;
-		cs = 2;
+		cs = 16;
 	}
 	if (sample == 0)	/* 16-bit */
 		ccis *= 2;
-	for (i = 0; i < cs; i++)
-		snd_emu10k1_ptr_write(emu, CD0 + i, voice, sample);
+	for (i = 0; i < cs; i++) {
+    		snd_emu10k1_ptr_write(emu, CD0 + i, voice, sample);
+    		if (runtime->channels > 1) {
+        		snd_emu10k1_ptr_write(emu, CD0 + i, voice + 1, sample);
+		}
+	}
 	// reset cache
 	snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice, 0);
 	snd_emu10k1_ptr_write(emu, CCR_READADDRESS, voice, cra);
@@ -508,6 +512,9 @@
 	}
 	// fill cache
 	snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice, ccis);
+	if (runtime->channels > 1) {
+		snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice + 1, ccis);
+	}
 }
 
 static void snd_emu10k1_playback_prepare_voice(emu10k1_t *emu, emu10k1_voice_t *evoice, int master, int extra)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-03-08 16:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-04  8:33 [PATCH] remove emu10k1 pops/clicks at the beginning and end of playback (fwd) Jaroslav Kysela
2005-03-04 18:17 ` Lee Revell
2005-03-05  8:29   ` Jindrich Makovicka
2005-03-05 11:05     ` James Courtier-Dutton
2005-03-05 11:46       ` Jindrich Makovicka
2005-03-05 14:37         ` James Courtier-Dutton
2005-03-05 14:46           ` Jindrich Makovicka
2005-03-05 19:08             ` Jindrich Makovicka
2005-03-05 20:25               ` Lee Revell
2005-03-05 21:17                 ` Jindrich Makovicka
2005-03-08 16:11               ` Takashi Iwai
2005-03-05 18:39         ` Lee Revell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.