[LAD] accepted use of sync callback

Paul Davis paul at linuxaudiosystems.com
Sat Mar 26 15:18:20 UTC 2011

On Sat, Mar 26, 2011 at 11:08 AM, Lieven Moors <lievenmoors at gmail.com> wrote:
> Hi everybody,
> I have a question.
> I'm trying to figure out how to deal with transport locate changes
> in my arpeggiator "flarps". I am generating MIDI events only when
> necessary, so I'm not able to rewind the state of the program.
> I only keep track of Note-off messages, because they can be sent
> out in the future, to allow overlapping notes. All the MIDI notes
> are calculated relative to each other. So I keep track of time
> internally.
> So I only need to know the first frame of the period,
> when somebody does a jack_transport_locate, and I need to know
> when this happens so I can initialize the program state.
> My question is, if it would be acceptable to use the sync callback
> to do this, because strictly speaking, my client wouldn't be a
> slow sync client.

its entirely appropriate.

> Is there a more preferable way to do this, or should I do major
> redesign, and use the time jack provides with each period directly.

if you can do this in a way that still more or less meets the realtime

	T = F(nframes) + C

(that is, time per process cycle is a linear function of the nframes
value, plus a constant)

then simply doing it in every process call is fine. if not, then use
the sync callback.

More information about the Linux-audio-dev mailing list