From: Takashi Iwai Subject: Re: Understanding _snd_pcm_channel_area Struct (PCM Interface)! Date: Sat, 27 Jun 2009 09:32:53 +0200 Message-ID: References: <4A3DEAF9.80508@free.fr> <4A406AD3.2050002@gmail.com> <4A458A6B.2070305@gmail.com> 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 mx1.suse.de (cantor.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 7AF202457D for ; Sat, 27 Jun 2009 09:32:53 +0200 (CEST) In-Reply-To: <4A458A6B.2070305@gmail.com> 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: Guilherme Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Fri, 26 Jun 2009 23:56:43 -0300, Guilherme wrote: > > Takashi... > > The base_address and the step sounds pretty clear to me.... just the > offset I could not understand. > > What the difference in being .first = 0 or .first = 2??? Could you > provide please a more in depth explanation. I tried really hard find > this but there is nothing related in the documentation. > > area[0].addr = base_address; > addr[0].first = 0; > addr[0].step = 4; > addr[1].addr = base_address; > addr[1].first = 2; > addr[1].step = 4; > > P.S. being a stereo or a mono pipeline I understand... just the way the offset works that is not so clear to me. Actually, the non-interleaved formats can be represented also with a single base_address (and is so in the actual implementation). addr[0].addr = base_addr; addr[0].first = 0; addr[0].step = 2; addr[1].addr = base_addr; addr[1].first = mono_buffer_len; addr[1].step = 2; addr[2].addr = base_addr; addr[2].first = mono_buffer_len * 2; addr[2].step = 2; ... The "first" is the offset of the first sample. The address of the first sample of the channel is simply calculated as addr + first. This is because just we want to keep the base address same to all channels as much as possible especially in mmap mode. Takashi