On Sunday 28 July 2002 14.40, you wrote:
> Anders Torger wrote:
> >On Saturday 27 July 2002 17.18, you wrote:
> >> Anders Torger wrote:
> >> >Does anyone have any comments on this? Is repeatable exact
> >> > I/O-delay possible to achieve today with current hardware (and
> >> > ALSA)?
> >>
> >> It is the normal mode of operation for memory-mapped IO.
> >
> >Is it really? How do I trigger play exactly X samples after I
> > trigger capture? To copy samples exactly X samples into a buffer is
> > simple, the problem is to tell the sound card to synchronise the
> > playback ptr with the capture ptr, that is "start running the
> > playback ptr exactly X samples after the capture ptr started". The
> > window of X samples is then used by the software to do its magic.
>
> The way you'd do this is to link the capture and playback streams of
> the device you use with snd_pcm_link(). They will start together and
> stay in sync (unless the hardware is broken by design). Instead of
> starting playback exactly 4096 frames later, you prime the playback
> stream with 4096 silent frames before starting it. At the first
> interrupt issued, there will be 2048 frames to be read from the
> capture stream and 2048 to write to playback. You'd read the input
> signal, write another 2048 silent frames, and from the next interrupt
> on you'll always have 2048 frames of processed signal to write, and
> 2048 input frames to feed to the FIR.

Thanks. I'll try this. Not only the hardware can be broken, but also 
the driver I suppose. It seems like not all have support for 
snd_pcm_link(), for example my driver for RME96 (I have to do some 
maintenance work on that soon).

> Implementing memory-mapped IO isn't exactly what you do in a day.
> jackit.sf.net or the shortly-to-be-released library I'm working on
> will do it for you. Just replace 'interrupt' above with a 'process'
> callback and you don't have to care about the exact workings of
> mmap'd ALSA at all.

This is great, but I don't see why this particular thing would require 
memory-mapped I/O. If one makes sure to write 4096 silent frames first 
start playback/capture using snd_pcm_link(), it should work with 
snd_pcm_read/write too, shouldn't it?

/Anders Torger


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to