>i'm doing full-duplex mmapped io on emu8k. the good news is the streams
>stay in sync, the bad news is how the processing occurs is not optimal if
>one follows the 'schoolbook approach'.
>
>remember the alsa schoolbook:
>
>while (running)
>{
> poll();
> available = min (streams->update_available());
>
> while (available > 0)
> {
> frames = min (streams->mmap_begin (available));
> process (frames);
> streams->mmap_commit (frames);
> available -= frames;
> }
>}
>
>but with the emu8k it's better to do:
>
> ...
> while (available > threshold_frames)
> ...
you can't rely on poll() across two streams returning directly on
period boundaries. in JACK I am using:
avail = capture_avail < playback_avail ? capture_avail : playback_avail;
/* constrain the available count to the nearest (round down) number of
periods.
*/
avail = avail - (avail % driver->frames_per_cycle);
while (avail) { }
i think you consider this "rounding to period size" as part of the
schoolbook, except that some programs might not want it. we are both
working on a particular class of apps that do single-period
processing, and for us, this rounding is necessary on most h/w. most
consumer audio interfaces don't generate capture+playback interrupts
at the same time, so you will nearly always find instances of a few
frames apparently available on at least one stream.
--p
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel