From alsa-devel-owner@alsa.jcu.cz  Mon Nov  2 09:31:25 1998
Received: from cyphyn.219.org (nwhn-sh1-port95.snet.net [204.60.13.95])
	by marvin.jcu.cz (8.9.1a/8.9.1) with ESMTP id JAA08273
	for <alsa-devel@jcu.cz>; Mon, 2 Nov 1998 09:30:08 +0100
Received: from localhost (emng@localhost)
          by cyphyn.219.org (8.8.4/8.8.4) with SMTP
	  id DAA00709 for <alsa-devel@jcu.cz>; Mon, 2 Nov 1998 03:32:51 -0500
Date: Mon, 2 Nov 1998 03:32:51 -0500 (EST)
From: Fred Floberg <emng@geocities.com>
To: alsa-devel@jcu.cz
Subject: Re: ES1371 Bugs again...
In-Reply-To: <199810302340.SAA24428@cyphyn.219.org>
Message-ID: <Pine.LNX.3.95.981102031457.617A-100000@cyphyn.219.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list




On Fri, 30 Oct 1998 perex@jcu.cz wrote:

> On Fri, 30 Oct 1998, Fred Floberg wrote:
> 
> > 
> > Hi all,
> > [blah blah]
> >
> I looked to your code and it seems to be totaly broken. Variable nbytes
> isn't initialized at begin of loop and you don't ensure that input byte
> count must match output byte count. You must also using at minimum two
> record buffers to avoid playback underruns. [...]

Thanks for looking at my code and suggesting the double buffering scheme,
Jaroslav. I really appreciate your assistance.

 
> While looking and testing your code I found stupid bug in ALSA driver.
> Here is fix for record status count variable (which should be negative in
> previous code):

I don't remember it being negative in the output of my duplex prog. but
I could have missed it.

> 
> Index: pcm1_native.c
> ===================================================================
> RCS file: /home/alsa/cvsroot/alsa-driver/kernel/pcm1/pcm1_native.c,v
> retrieving revision 1.10
> diff -u -r1.10 pcm1_native.c
> --- pcm1_native.c       1998/09/15 09:12:01     1.10
> +++ pcm1_native.c       1998/10/30 22:43:25
> @@ -1229,11 +1229,11 @@
>    } else {
>      ptr = 0;
>    }
> -  if ( !pchn -> used )
> +  if ( !pchn -> used ) {
>      status.count = 0;
> -   else
> -    status.count = (pchn -> used - 1) * pchn -> block_size -
> -                   (pchn -> block_size - pchn -> frag_size);
> +  } else {
> +    status.count = (pchn -> used - 1) * pchn -> block_size + pchn -> frag_size;
> +  }
>    status.free = ((pchn -> blocks - pchn -> used) * pchn -> block_size) - ptr;
>    status.overrun = pchn -> xruns & 0x7fffffff; pchn -> xruns = 0;
>    status.scount = pchn -> processed_bytes + ptr;
> 
> 
I applied this patch and recompiled, etc. but aplay and
wavplay (OSS program) sleep forever now. Don't know what's wrong.


Fred



