Re: [linux-audio-dev] Exact description of PCM system for ALSA

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Exact description of PCM system for ALSA
From: joy (joy_AT_pingfm.org)
Date: Tue Jul 16 2002 - 15:30:46 EEST


On Mon, Jul 15, 2002 at 01:29:38PM -0400, Paul Davis wrote:
> >as i said above, nice work, and nice that someone does this.
> >i tried yesterday your mmap implemantation and at least get it to work
> >somehow, but im right that:
> >
> >outbuffer = (area->addr + (area->first + area->step * (offset)) / 8);
> >
> >returns only a pointer to the buffer? i have to do:
> >
> > memset(outbuffer, 0, frames_transmit);
> > memcpy(outbuffer, data, frames_transmit);
> >
> >to really wright data to the buffer. i get also some kind of fragments
> >staying in buffer if i guess one 'frames_transmit' is smaller than the
> >written before or/and if its not aligned to fragment_size, a funny
> >effect, but im currently don't know how to clean it up.
>
> forget all this and use snd_pcm_mmap_copy_areas.

thanx, i finally managed to get 'clear' sound using memcopy ->
outbuffer but the problem is if i try to transfer it in 'big' chunks my
app segfaults at outbuffer = (area->addr + (area->first + area->step *
(offset)) / 8);. not always, but randomly on some parts while playing
soundfiles. if i split it in smaller parts it works but it seems
that some samples were skipped or remainig in the buffer, causing this
fragmented sound. i dont know, maybe my memory is to slow or i have
bad memory, if this is the problem then this mechanism is a good
memory-checker ;) anyway.
how does snd_pcm_area_copy() work? are there any
sample-implementations? by a quick look through jack-alsa-driver-src
(ca. 1 week old cvs) it seems to use a similar mechanism as above.

>
> forget all that and use ... well, you know ;)
>

yes, i have also a jack-plugin in pipe and already did a kind of
'sounding' prototype but cause the app uses push&write method i
thought that i have to establish another buffer in it for safe
reading.
im now stucking on this buffer thing. i get data also only in plain
int's so this will be probably another problem.

-- 
regards

____- joy

________/\---------%%%___________----------- webcast every sunday 2000 cest at pingfm.org

pgp key at: x-hkp://wwwkeys.de.pgp.net


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Tue Jul 16 2002 - 16:00:06 EEST