From: Takashi Iwai Subject: Re: S24_LE is 3 bytes ? in alsa-lib example pcm.c Date: Thu, 10 Jul 2008 18:46:36 +0200 Message-ID: References: <4875C730.7080003@aimvalley.nl> <4875D4FE.3000607@ladisch.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 8C825246ED for ; Thu, 10 Jul 2008 12:46:39 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Jaroslav Kysela Cc: ALSA development , Clemens Ladisch , Norbert van Bolhuis List-Id: alsa-devel@alsa-project.org At Thu, 10 Jul 2008 12:41:39 +0200 (CEST), Jaroslav Kysela wrote: > > On Thu, 10 Jul 2008, Takashi Iwai wrote: > > > At Thu, 10 Jul 2008 12:19:05 +0200 (CEST), > > Jaroslav Kysela wrote: > > > > > > On Thu, 10 Jul 2008, Clemens Ladisch wrote: > > > > > > > Norbert van Bolhuis wrote: > > > > > as far as I know: > > > > > sample format S24_LE is 24bit sample in 4 bytes > > > > > sample format S24_3LE is 24bit sample in 3 bytes > > > > > (why else have separate definitions), right ? > > > > > > > > Yes. > > > > > > > > > In the ALSA-LIb example /test/pcm.c however > > > > > (http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html) > > > > > there is no diff between the 2 sample formats. > > > > > > > > That example program uses snd_pcm_format_width() although it should > > > > have used snd_pcm_format_physical_width() when calculating memory > > > > buffer sizes. > > > > > > I think that the problem is in wrong area->step calculation in alsa-lib, > > > but I'm still investigating where the real culprit is. The > > > snd_pcm_format_width() is used only for sample filling (which is OK). > > > > I think Clemens is right. The program uses snd_pcm_format_width() > > wrongly. Also, it won't work properly with strict aliasing... > > Yes, the patch looks good. I overlooked that the area initialization is > directly in pcm.c code (I looked only to generate_sine(). I tested it and > it produces good samples. I'm getting some underruns on my notebook with > 24-bit formats (but it's probably different problem). OK, committed now. Takashi