On Wed, 28 Nov 2001, Jaroslav Kysela wrote:

> On Tue, 27 Nov 2001, Paul Davis wrote:
>
> > enclosed below what happens when using ALSA, mmap mode and poll(2) on my
> > trident card at 44100. the value of contiguous is the value returned
> > by snd_pcm_mmap_begin() having been passed a value of 2048 as the
> > "upper limit".  the period size is 2048 frames, the buffer size is 2 *
> > period size. the figures shown are for the capture stream; both
> > capture and playback are open at the same time and are both in active use.
> >
> > needless to say, this is basically unworkable as is. any suggestions
> > as to why this happening? it happens much, much less frequently at
> > 48kHz, and almost never on the Hammerfall. i tried it on the
> > (admittedly known to be broken) tropez+ and it crashed my machine :)
> >
> > is this an application design problem, or an alsa low level driver
> > implementation problem (i.e. with the hw pointer routines?)
>
> Can you send me output from 'snd_pcm_dump()', too? It might be caused by
> a wrong sw_params settings.

I looked to this problem. The default sw_params should be ok - they set
avail_min and xfer_align to period_size. The question is, if the direct
access function - snd_pcm_mmap_begin - should take care about these
values. Also, it would be problematic to include the test for
non-continous transfers. The right loop, based on the period_size
transfers, should be like this:

        poll();
        if ((pfd->revents & POLLIN) {
                while (1) {
                        if (snd_pcm_avail_update(pcm) < period_size)
                                break;
                        count = period_size;
                        // transfer whole period (can be composed from more
                        // non-continuous parts)
                        while (avail > 0) {
                                frames = count;
                                snd_pcm_mmap_begin(pcm, areas, &offset, &frames);
                                ....
                                snd_pcm_mmap_commit(pcm, offset, frames);
                                count -= frames;
                        }
                }
        }

                                                Jaroslav

-----
Jaroslav Kysela <[EMAIL PROTECTED]>
SuSE Linux    http://www.suse.com
ALSA Project  http://www.alsa-project.org


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

Reply via email to