Jaroslav Kysela wrote:
> 
> On Wed, 31 Oct 2001, Paul Davis wrote:
> 
> > >there is something wrong with either the pcm.c example or with the
> > >documentation in alsa-lib/src/pcm/pcm.c.
> > >
> > >the documentation says about snd_pcm_mmap_commit:
> > >
> > > 'To call this with offset/frames values different from that returned by
> > >  snd_pcm_mmap_begin has undefined effects and it has to be avoided.'
> >
> > IMHO. the documentation is wrong. it should say that you cannot call
> > it with a value greater than the one returned by snd_pcm_mmap_begin().
> >
> > all the commit does it to move forward the driver's notion of the "s/w
> > pointer", used for tracking xruns etc. its fine to move it less than
> > it could possibly be moved, but not OK to move it more.
> 
> The documentation is correct, but the check in the pcm.c example is really
> not necessary, because mmap_begin guarantees that the returned count of
> frames is less or equal to the requested count. I corrected the
> documentation. Using the same value as for mmap_begin is not necessary in
> the current implementation, but we can rely on the same value in the
> future, so please, follow the documentation to create "bug-free"
> and clean applications.

I have to partially disagree, nothing inhibits to do:

frames = buffer_size;
snd_pcm_mmap_begin(pcm, areas, &offset, &frames);

and then reduce the number of frames to call snd_pcm_mmap_commit with.

Perhaps it's useless, but this is how I designed this API.

-- 
Abramo Bagnara                       mailto:[EMAIL PROTECTED]

Opera Unica                          Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy

ALSA project               http://www.alsa-project.org
It sounds good!

_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to