Re: [ecasound] Double-buffering and audio

From: Kai Vehmanen <kvehmanen@email-addr-hidden>
Date: Mon May 14 2012 - 02:24:19 EEST


On Sat, 12 May 2012, S. Massy wrote:

> When double-buffering is enabled, if one issues stop and start, there is an
> audible "gap" in the audio, i.e some samples are never played back. Is
> that a bug or a feature?

with JACK+transport enabled, you may miss some samples at start as JACK
doesn't wait for clients. This shouldn't happen though if ecasound is the
transport master (sending the start/stop commands).

Without JACK (or transport disabled), there should be no missed samples.
If position is changed, the disk i/o buffers are refilled with the new
position. Without position change, buffers should not be touched so
position should not change.

> Which leads me to ask... When I issue getpos,
> what does the number reflect? Is it more or less what I'm hearing, give
> or take a jack period or an internal buffer, or is it where the read
> pointer is at in the audio files? Does double-buffeering affect this?

That's the main engine position. E.g. at next engine iteration (or next
JACK process() callback), samples [getpos,getpos+buffersize] will be
processed. The output latency depends on the output device latency alone
(e.g. JACK or ALSA buffering), and a typical (low) value would be one jack
period (depends on how you are running jackd).

The double-buffering does not affect getpos and should be totally
transparent. On code level, the buffering is implemented as a wrapper
class that can proxy any file-type audio object. To the engine, it doesn't
really see any differences, but under the hood, the samples are first read
to big memory buffers, and when engine calls read_buffer(), it never needs
to wait for disk i/o.

But like any abstractrion layer, it is usually, to some degree, also a new
layer of bugs, so in practise not 100% transparent. :P

Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
Ecasound-list mailing list
Received on Mon May 14 04:15:03 2012

This archive was generated by hypermail 2.1.8 : Mon May 14 2012 - 04:15:03 EEST