[Jack-Devel] Cannot access portbuffer memory from C++

Robin Gareus robin at gareus.org
Sun Mar 13 18:58:31 CET 2016


On 03/13/2016 04:57 PM, Frank Schäfer wrote:

> My program started to produce output the moment when ``jack_activate( client );'' is called.
> Isn't this a bit waste of CPU due to the fact that the process_audio callback copies plenty of data to a port which is not used yet?

memcpy is really cheap on modern machines (SSE), besides internally jack
uses zero-copy whenever possible: jack clients get a pointer to the
actual input/output buffer(s).

The process callback always runs for a couple of reasons: in your case
the oscillator's phase should advance sample-accurately regardless if
the output is connected or not.

But more importantly, for DSP one prefers consistent CPU usage.  Ideally
the process callback will always cause exactly the same CPU load, every
cycle, for all cycles.  Otherwise there's the potential: "It works
unless I connect things -> CPU spikes -> x-runs...")

ciao,
robin




More information about the Jackaudio mailing list