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: Tue, 30 Jun 2009 12:01:53 -0300	[thread overview]
Message-ID: <4A4A28E1.8040201@gmail.com> (raw)
In-Reply-To: <s5h3a9h940t.wl%tiwai@suse.de>

Hum...

so .. the code

if ((areas[chn].step % 16) !=0 )

is because a 16bits format's been used.

If I wanted a 32bits sample format I should change that for
if ((areas[chn].step % 32) !=0 ) ??

and the offset for the first doen's need any changes, is it?


Just a opinion about all this, I think that alsa developers should design graphs for these things, as has in gstreamer documentation. 
It is a lot easer to understand that way. 

It is because I dont understand very well yet, but as I am going to work with sound stuff especially in linux environment, Ill be very soon offering help for this!

;o) 



 

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, 30 Jun 2009 11:40:20 -0300,
> Guilherme wrote:
>   
>> Tks takashi....
>>
>> The doubt comes from this block of code:
>>
>> for (chn = 0; chn < channels; chn++) {
>>             if ((areas[chn].first % 8) != 0) {
>>                     printf("areas[%i].first == %i, abortando...\n", chn, 
>> areas[chn].first);
>>                     exit(EXIT_FAILURE);
>>             }
>>             //pega endereço e offset da area
>>             samples[chn] = /*(signed short *)*/(((unsigned char 
>> *)areas[chn].addr) + (areas[chn].first / 8));
>>            
>>          if ((areas[chn].step % 16) != 0) {
>>                 printf("areas[%i].step == %i, aborting...\n", chn, 
>> areas[chn].step);
>>                 exit(EXIT_FAILURE);
>>          }
>>            
>>                 steps[chn] = areas[chn].step / 8;
>>                 samples[chn] += offset * steps[chn];
>>         }
>>
>> first:
>>
>> areas[chn].first % 8   ( I am using chn = 1). So for the only area that 
>> I have, if I get the value of the parameter 'first' isn't divisible by 
>> 8, the program exits.
>> The  same doubt happens with "areas[chn].step % 16"  and  
>> "areas[chn].step / 8".
>>
>> This is the parameter I am using:
>>
>> static snd_pcm_format_t format = SND_PCM_FORMAT_S16;   //sample format 
>> unsigned 16 bit endian
>>
>> Perhaps with this practical example I can understand better.
>>     
>
> Oops, I wrote wrongly.  The first and step fields are not in bytes but
> bits.  That's why 8 and 16 appear there, corresponding to 1 byte and 2
> bytes.
>
>
> Takashi
>
>   

  reply	other threads:[~2009-06-30 15:00 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
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 [this message]
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=4A4A28E1.8040201@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.