All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guilherme <grlongo.ireland@gmail.com>
To: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: Re: Understanding _snd_pcm_channel_area Struct (PCM Interface)!
Date: Fri, 26 Jun 2009 23:56:43 -0300	[thread overview]
Message-ID: <4A458A6B.2070305@gmail.com> (raw)
In-Reply-To: <s5hljnjb3so.wl%tiwai@suse.de>

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.

Thanks in advanced!


Tks!

-------------------

Guilherme Longo
Dept. Eng. da Computação
Unaerp

Linux User - #484927

*Before Asking
http://www.istf.com.br/?page=perguntas

!- I'd rather die on my feet than live on my knees -!



Takashi Iwai wrote:
> At Tue, 23 Jun 2009 02:40:35 -0300,
> Guilherme wrote:
>   
>> Hi all.
>>
>> I am a bit confused on what I get with this function.
>> I finished my first project but I did not understand what exactly the
>>
>> _snd_pcm_channel_area at
>>
>>  http://www.alsa-project.org/alsa-doc/alsa-lib/struct__snd__pcm__channel__area.html
>>
>> does.
>>
>> There are 3 fields in the documentation.
>>
>> addr, first and step.
>>
>> It seems that addr is the memory address of the channel samples... so 
>> far so good. The "step" is the distance between 2 sample (but I am not 
>> sure) and the least, "first", I could not figure out what does it means.
>>     
>
> This information is needed to understand how the multi-channel samples
> are assigned in a stream.  The first is the offset of the channel
> position to the given addr.  The step is the bytes to the next sample
> of that channel.
>
> For example, suppose you have a 2-channel stereo interleaved stream
> with 16bit samples.  Then you'll have an array of snd_pcm_channel_area
> with two elements, for left and right channels, containing like
>
> 	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;
>
> Both channels share the same base address but have the different
> "first" offset bytes.  The step size is 4 = #chanel * sample-size.
>
> For a non-interleaved stereo stream, it'll look like
>
> 	addr[0].addr = base_addr_0;
> 	addr[0].first = 0;
> 	addr[0].step = 2;
> 	addr[1].addr = base_addr_1;
> 	addr[1].first = 0;
> 	addr[1].step = 2;
>
> Thus it looks like two mono streams with 16bit samples.
>
>
> HTH,
>
> Takashi
>
>   

  reply	other threads:[~2009-06-27  2:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4A3DEAF9.80508@free.fr>
2009-06-23  5:40 ` Understanding _snd_pcm_channel_area Struct (PCM Interface)! Guilherme
2009-06-23 11:14   ` Takashi Iwai
2009-06-27  2:56     ` Guilherme [this message]
2009-06-27  7:32       ` Takashi Iwai
     [not found]         ` <4A4A23D4.4090505@gmail.com>
2009-06-30 14:42           ` Takashi Iwai
2009-06-30 15:01             ` Guilherme
2009-06-30 15:13               ` Takashi Iwai

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=4A458A6B.2070305@gmail.com \
    --to=grlongo.ireland@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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 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.