Re: [linux-audio-dev] Audio engine stuff

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Audio engine stuff
From: Benno Senoner (sbenno_AT_gardena.net)
Date: ke helmi  16 2000 - 18:28:29 EST


On Wed, 16 Feb 2000, Jake Donham wrote:
> "Benno" == Benno Senoner <sbenno_AT_gardena.net> jots:
>
> Benno> streams the data to a lock-free ringbuffer ( Paul, lockfree
> Benno> is cool, isn't it ? :-) )
>
> What is a lock-free ringbuffer?
>
> Jake

It's actually an impementation of a circular buffer where there is one single
writer and one single reader.

----------------------|
     | |
   reader writer

the writer alway tries to keep the buffer as full as possible,
(by computing the free space in the buffer)
while the reader just reads the data at constant rate.

Typical example: an audio thread which reads the data from the
ringbuffer and feeds DAC continuously, without interruptions,
while the other thread (the disk thread) tries to keep the buffer as
full as possible.
If the disk thread is able to refill the buffer completely, it will just
sleep for a while in order to avoid the burn CPU cycles
while waiting for the samples being freed.

lock-free : you read and maniplulate the buffer pointers ( write pointer, read
pointer) in a way that you do not need any spinlocks.
Why do we want to avoid spinlocks ?
Because the audio thread runs with realtime constraints , and spinlocks
could block thus ruining latencies.
This kind of buffering approach is very useful (can you say essential ?)
to implement high performance apps like heavy duty harddisk recorders,
realtime audio streaming from disk ( disk based sampler like gigasampler)
etc.

hope this helps

Benno.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:23:27 EST