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 _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel