[LAD] xrun callback

Raphaël BOLLEN raphael.bollen at mobistar.be
Wed Sep 3 14:04:10 UTC 2014


Hello,

I'm trying to use jack_set_xrun_callback to be notified in my application of eventual xrun.

in the documentation of the function I see a note: that 'this function cannot be called while the 
client is activated'.

Does it mean that my client must call jack_set_xrun_callback before being activated or that the 
callback cannot be called while client is activated? If it's the later than should I use another 
client that will stay not activated as parameter jack_client_t

It says return 0 on success. Does it mean the callback must succeed doing something or can it just 
increase some counter and return 0. What would be the consequences of a non-zero error code? Would 
jack stop?

Currently I'm registering the callback and then activate and use the client. I'm not sure if I get 
an xrun that does crash my application of if something wrong in the application makes it crash and 
trigger an xrun... Chicken and egg problem.


Is there another way?

Thanks

--
Raphaël.


for reference: from jack.h

  /**
  * Tell the JACK server to call @a xrun_callback whenever there is a
  * xrun, passing @a arg as a parameter.
  *
  * All "notification events" are received in a seperated non RT thread,
  * the code in the supplied function does not need to be
  * suitable for real-time execution.
  *
  * NOTE: this function cannot be called while the client is activated
  * (after jack_activate has been called.)
  *
  * @return 0 on success, otherwise a non-zero error code
  */
int jack_set_xrun_callback (jack_client_t *client,
                             JackXRunCallback xrun_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT;


More information about the Linux-audio-dev mailing list