Jack2: Transport and Timebase control

Jack2 1.9.21

Functions
Transport and Timebase control

## Functions
int | jack_release_timebase (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT
int | jack_set_sync_callback (jack_client_t *client, JackSyncCallback sync_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT
int | jack_set_sync_timeout (jack_client_t *client, jack_time_t timeout) JACK_OPTIONAL_WEAK_EXPORT
int | jack_set_timebase_callback (jack_client_t *client, int conditional, JackTimebaseCallback timebase_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT
int | jack_transport_locate (jack_client_t *client, jack_nframes_t frame) JACK_OPTIONAL_WEAK_EXPORT
jack_transport_state_t | jack_transport_query (const jack_client_t *client, jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT
jack_nframes_t | jack_get_current_transport_frame (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT
int | jack_transport_reposition (jack_client_t *client, const jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT
void | jack_transport_start (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT
void | jack_transport_stop (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT
void | jack_get_transport_info (jack_client_t *client, jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT
void | jack_set_transport_info (jack_client_t *client, jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT

## Detailed Description

## Function Documentation

## ◆ jack_release_timebase()

int jack_release_timebase | ( | jack_client_t * | client | ) |

Called by the timebase master to release itself from that responsibility.

If the timebase master releases the timebase or leaves the JACK graph for any reason, the JACK engine takes over at the start of the next process cycle. The transport state does not change. If rolling, it continues to play, with frame numbers as the only available position information.

See also
  jack_set_timebase_callback

Parameters

  client | the JACK client structure.

Returns
  0 on success, otherwise a non-zero error code.

## ◆ jack_set_sync_callback()

int jack_set_sync_callback | ( | jack_client_t * | client,
|  | JackSyncCallback | sync_callback,
|  | void * | arg
| ) |  |

Register (or unregister) as a slow-sync client, one that cannot respond immediately to transport position changes.

The sync_callback will be invoked at the first available opportunity after its registration is complete. If the client is currently active this will be the following process cycle, otherwise it will be the first cycle after calling jack_activate(). After that, it runs according to the ::JackSyncCallback rules. Clients that don't set a sync_callback are assumed to be ready immediately any time the transport wants to start.

Parameters

  client | the JACK client structure.
  sync_callback | is a realtime function that returns TRUE when the client is ready. Setting sync_callback to NULL declares that this client no longer requires slow-sync processing.
  arg | an argument for the sync_callback function.

Returns
  0 on success, otherwise a non-zero error code.

## ◆ jack_set_sync_timeout()

int jack_set_sync_timeout | ( | jack_client_t * | client,
|  | jack_time_t | timeout
| ) |  |

Set the timeout value for slow-sync clients.

This timeout prevents unresponsive slow-sync clients from completely halting the transport mechanism. The default is two seconds. When the timeout expires, the transport starts rolling, even if some slow-sync clients are still unready. The sync_callbacks of these clients continue being invoked, giving them a chance to catch up.

See also
  jack_set_sync_callback

Parameters

  client | the JACK client structure.
  timeout | is delay (in microseconds) before the timeout expires.

Returns
  0 on success, otherwise a non-zero error code.

## ◆ jack_set_timebase_callback()

int jack_set_timebase_callback | ( | jack_client_t * | client,
|  | int | conditional,
|  | JackTimebaseCallback | timebase_callback,
|  | void * | arg
| ) |  |

Register as timebase master for the JACK subsystem.

The timebase master registers a callback that updates extended position information such as beats or timecode whenever necessary. Without this extended information, there is no need for this function.

There is never more than one master at a time. When a new client takes over, the former timebase_callback is no longer called. Taking over the timebase may be done conditionally, so it fails if there was a master already.

Parameters

  client | the JACK client structure.
  conditional | non-zero for a conditional request.
  timebase_callback | is a realtime function that returns position information.
  arg | an argument for the timebase_callback function.

Returns
  - 0 on success;
  - EBUSY if a conditional request fails because there was already a timebase master;
  - other non-zero error code.

## ◆ jack_transport_locate()

int jack_transport_locate | ( | jack_client_t * | client,
|  | jack_nframes_t | frame
| ) |  |

Reposition the transport to a new frame number.

May be called at any time by any client. The new position takes effect in two process cycles. If there are slow-sync clients and the transport is already rolling, it will enter the ::JackTransportStarting state and begin invoking their sync_callbacks until ready. This function is realtime-safe.

See also
  jack_transport_reposition, jack_set_sync_callback

Parameters

  client | the JACK client structure.
  frame | frame number of new transport position.

Returns
  0 if valid request, non-zero otherwise.

## ◆ jack_transport_query()

jack_transport_state_t jack_transport_query | ( | const jack_client_t * | client,
|  | jack_position_t * | pos
| ) |  |

Query the current transport state and position.

This function is realtime-safe, and can be called from any thread. If called from the process thread, pos corresponds to the first frame of the current cycle and the state returned is valid for the entire cycle.

Parameters

  client | the JACK client structure.
  pos | pointer to structure for returning current transport position; pos->valid will show which fields contain valid data. If pos is NULL, do not return position information.

Returns
  Current transport state.

## ◆ jack_get_current_transport_frame()

jack_nframes_t jack_get_current_transport_frame | ( | const jack_client_t * | client | ) |

Return an estimate of the current transport frame, including any time elapsed since the last transport positional update.

Parameters

  client | the JACK client structure

## ◆ jack_transport_reposition()

int jack_transport_reposition | ( | jack_client_t * | client,
|  | const jack_position_t * | pos
| ) |  |

Request a new transport position.

May be called at any time by any client. The new position takes effect in two process cycles. If there are slow-sync clients and the transport is already rolling, it will enter the ::JackTransportStarting state and begin invoking their sync_callbacks until ready. This function is realtime-safe.

See also
  jack_transport_locate, jack_set_sync_callback

Parameters

  client | the JACK client structure.
  pos | requested new transport position.

Returns
  0 if valid request, EINVAL if position structure rejected.

## ◆ jack_transport_start()

void jack_transport_start | ( | jack_client_t * | client | ) |

Start the JACK transport rolling.

Any client can make this request at any time. It takes effect no sooner than the next process cycle, perhaps later if there are slow-sync clients. This function is realtime-safe.

See also
  jack_set_sync_callback

Parameters

  client | the JACK client structure.

## ◆ jack_transport_stop()

void jack_transport_stop | ( | jack_client_t * | client | ) |

Stop the JACK transport.

Any client can make this request at any time. It takes effect on the next process cycle. This function is realtime-safe.

Parameters

  client | the JACK client structure.

## ◆ jack_get_transport_info()

void jack_get_transport_info | ( | jack_client_t * | client,
|  | jack_transport_info_t * | tinfo
| ) |  |

Gets the current transport info structure (deprecated).

Parameters

  client | the JACK client structure.
  tinfo | current transport info structure. The "valid" field describes which fields contain valid data.

Deprecated:
  This is for compatibility with the earlier transport interface. Use jack_transport_query(), instead.

Precondition
  Must be called from the process thread.

## ◆ jack_set_transport_info()

void jack_set_transport_info | ( | jack_client_t * | client,
|  | jack_transport_info_t * | tinfo
| ) |  |

Set the transport info structure (deprecated).

Deprecated:
  This function still exists for compatibility with the earlier transport interface, but it does nothing. Instead, define a ::JackTimebaseCallback.