Linux Sound subsystem development
 help / color / mirror / Atom feed
From: David Olofson <audiality@swipnet.se>
To: linux-sound@vger.kernel.org
Subject: Re: [alsa-user] Re: latencytests results on a Pentium133, again EXCELLENT, 2.1ms.:-)
Date: Fri, 17 Sep 1999 17:37:32 +0000	[thread overview]
Message-ID: <marc-linux-sound-93759408726325@msgid-missing> (raw)
In-Reply-To: <marc-linux-sound-93756643831266@msgid-missing>

On Fri, 17 Sep 1999, Maarten de Boer wrote:
[...]
> > while(1)
> > {
> >     read(&buffer); // btw I'll be using alsa not oss
> >     Process(buffer);
> >     write(&buffer);
> > }
> Works fine. Make sure you do 
> (I quote Benno:)
> [blocking read/write] write 4 fragments of silence to the output, at this 
> point both audio input and audio output will start (or alternatively you 
> could trigger the start via ioctl() after the write).

You may also block on the read(), and just "preload" the DAC by writing a
suitable number of samples to it before you start the loop. This way you can
easily change the input-output latency on the fly, as you don't have to change
the number of fragments in the buffers. Just make sure there are enough
fragments for the biggest latency you may want to use.

Of course, the rules are the same; apart from the single buffer delay you get
in an empty read()/write() loop (doesn't work in real life!), you need some
extra samples of buffering to handle the scheduling jitter, and some more
samples to cover the maximum Process() execution time.

Same performance; just another way of doing it.

(I'm not sure whether there could be any strange side effects on Linux +
Mingo's patch, but it works just fine with RTL + DPI. That is, same driver
code, same semantics, but true preemptive hard real time scheduling.)


<offtopic level="slightly">

Weekend. :-) I'd really like to start playing with the RTL DPI (Driver
Programming Interface) again (measuring actual analog->analog latency with 36
bytes of buffering and some other things), but I think I should get my plug-in
API event system proposal together first... Time to ask the guys at
linux-audio-dev what happened while I was away!

And then there's RTLinux beta 15 (I think) to check out... And people are
discussing an NMT RTL + RTAI merger, or at least sharing the RTAI interrupt
abstraction layer, which would clean things up quite a bit - a Linux kernel
with a very tiny patch (that's clean, and usable for other purposes as well) can
get RTL performance by just loading a module - RTL or RTAI, or some new hard RT
kernel, if someone decides to hack a cleaner/better/<whatever> alternative.
That is, standard Linux kernels could be hard RT capable without having the RTK
built in.

So... What interesting Linux related developments have I missed?

Oh, this incredible tempo! :-)

</offtopic>


//David


 ·A·U·D·I·A·L·I·T·Y·   P r o f e s s i o n a l   L i n u x   A u d i o
-  - ------------------------------------------------------------- -  -
    ·Rock Solid                                      David Olofson:
    ·Low Latency    www.angelfire.com/or/audiality   ·Audio Hacker
    ·Plug-Ins            audiality@swipnet.se        ·Linux Advocate
    ·Open Source                                     ·Singer/Composer

      reply	other threads:[~1999-09-17 17:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-17 10:46 [alsa-user] Re: latencytests results on a Pentium133, again EXCELLENT, 2.1ms.:-) Maarten de Boer
1999-09-17 17:37 ` David Olofson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-sound-93759408726325@msgid-missing \
    --to=audiality@swipnet.se \
    --cc=linux-sound@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox