Crudebyte Logo
types.h File Reference

Basic common types of the JACK system. More...

#include <jack/systemdeps.h>

Go to the source code of this file.

Detailed Description

Basic common types of the JACK system.

This file covers the fundamental basic types, constants and data structures used by the entire JACK API.

Definition in file types.h.

Classes

struct  _jack_latency_range
struct  _jack_position
struct  jack_transport_info_t

Macros

#define JACK_MAX_FRAMES   (4294967295U) /* This should be UINT32_MAX, but C++ has a problem with that. */
#define JACK_LOAD_INIT_LIMIT   1024
#define JackOpenOptions   (JackSessionID | JackServerName | JackNoStartServer | JackUseExactName | JackNoBackground)
#define JackLoadOptions   (JackLoadInit | JackLoadName | JackUseExactName)
#define JACK_DEFAULT_AUDIO_TYPE   "32 bit float mono audio"
#define JACK_DEFAULT_MIDI_TYPE   "8 bit raw midi"
#define JACK_POSITION_MASK   (JackPositionBBT|JackPositionTimecode)
#define EXTENDED_TIME_INFO

Typedefs

typedef int32_t jack_shmsize_t
typedef uint32_t jack_nframes_t
typedef uint64_t jack_time_t
typedef uint64_t jack_intclient_t
typedef struct _jack_port jack_port_t
typedef struct _jack_client jack_client_t
typedef uint32_t jack_port_id_t
typedef uint32_t jack_port_type_id_t
typedef enum JackOptions jack_options_t
typedef enum JackStatus jack_status_t
typedef enum
JackLatencyCallbackMode 
jack_latency_callback_mode_t
typedef enum JackCustomChange jack_custom_change_t
typedef enum JackRegisterFlags jack_register_flags_t
typedef void(* JackLatencyCallback )(jack_latency_callback_mode_t mode, void *arg)
typedef struct _jack_latency_range jack_latency_range_t
typedef int(* JackProcessCallback )(jack_nframes_t nframes, void *arg)
typedef void *(* JackThreadCallback )(void *arg)
typedef void(* JackThreadInitCallback )(void *arg)
typedef int(* JackGraphOrderCallback )(void *arg)
typedef int(* JackXRunCallback )(void *arg)
typedef int(* JackBufferSizeCallback )(jack_nframes_t nframes, void *arg)
typedef int(* JackSampleRateCallback )(jack_nframes_t nframes, void *arg)
typedef void(* JackPortRegistrationCallback )(jack_port_id_t port, int register, void *arg)
typedef void(* JackClientRegistrationCallback )(const char *name, int register, void *arg)
typedef void(* JackPortConnectCallback )(jack_port_id_t a, jack_port_id_t b, int connect, void *arg)
typedef int(* JackPortRenameCallback )(jack_port_id_t port, const char *old_name, const char *new_name, void *arg)
typedef void(* JackFreewheelCallback )(int starting, void *arg)
typedef void(* JackShutdownCallback )(void *arg)
typedef void(* JackInfoShutdownCallback )(jack_status_t code, const char *reason, void *arg)
typedef float jack_default_audio_sample_t
typedef uint64_t jack_unique_t
typedef struct _jack_position jack_position_t
typedef int(* JackSyncCallback )(jack_transport_state_t state, jack_position_t *pos, void *arg)
typedef void(* JackTimebaseCallback )(jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos, void *arg)

Enumerations

enum  JackOptions {
  JackNullOption = 0x00, JackNoStartServer = 0x01, JackUseExactName = 0x02, JackServerName = 0x04,
  JackLoadName = 0x08, JackLoadInit = 0x10, JackSessionID = 0x20, JackNoBackground = 0x40
}
enum  JackStatus {
  JackFailure = 0x01, JackInvalidOption = 0x02, JackNameNotUnique = 0x04, JackServerStarted = 0x08,
  JackServerFailed = 0x10, JackServerError = 0x20, JackNoSuchClient = 0x40, JackLoadFailure = 0x80,
  JackInitFailure = 0x100, JackShmFailure = 0x200, JackVersionError = 0x400, JackBackendError = 0x800,
  JackClientZombie = 0x1000, JackBackgroundFailure = 0x2000, JackClientKilled = 0x4000
}
enum  JackLatencyCallbackMode { JackCaptureLatency, JackPlaybackLatency }
enum  JackCustomChange { JackCustomRemoved, JackCustomAdded, JackCustomReplaced }
enum  JackRegisterFlags { JackRegisterDefaults, JackRegisterPrompt }
enum  JackPortFlags {
  JackPortIsInput = 0x1, JackPortIsOutput = 0x2, JackPortIsPhysical = 0x4, JackPortCanMonitor = 0x8,
  JackPortIsTerminal = 0x10
}
enum  jack_transport_state_t {
  JackTransportStopped = 0, JackTransportRolling = 1, JackTransportLooping = 2, JackTransportStarting = 3,
  JackTransportNetStarting = 4
}
enum  jack_position_bits_t {
  JackPositionBBT = 0x10, JackPositionTimecode = 0x20, JackBBTFrameOffset = 0x40, JackAudioVideoRatio = 0x80,
  JackVideoFrameOffset = 0x100
}
enum  jack_transport_bits_t {
  JackTransportState = 0x1, JackTransportPosition = 0x2, JackTransportLoop = 0x4, JackTransportSMPTE = 0x8,
  JackTransportBBT = 0x10
}

Variables

PRE_PACKED_STRUCTURE struct
_jack_latency_range 
POST_PACKED_STRUCTURE

Macro Definition Documentation

#define JACK_MAX_FRAMES   (4294967295U) /* This should be UINT32_MAX, but C++ has a problem with that. */

Maximum value that can be stored in jack_nframes_t

Definition at line 75 of file types.h.

#define JACK_LOAD_INIT_LIMIT   1024

Maximum size of load_init string passed to an internal client jack_initialize() function via jack_internal_client_load().

Definition at line 87 of file types.h.

Valid options for opening an external client.

Definition at line 170 of file types.h.

#define JackLoadOptions   (JackLoadInit | JackLoadName | JackUseExactName)

Valid options for loading an internal client.

Definition at line 173 of file types.h.

#define JACK_DEFAULT_AUDIO_TYPE   "32 bit float mono audio"

Used for the type argument of jack_port_register() for default audio ports (32 bit float mono audio data).

Definition at line 592 of file types.h.

#define JACK_DEFAULT_MIDI_TYPE   "8 bit raw midi"

Used for the type argument of jack_port_register() for default midi ports (8 bit raw standard MIDI data).

Definition at line 598 of file types.h.

#define JACK_POSITION_MASK   (JackPositionBBT|JackPositionTimecode)

all valid position bits

Definition at line 696 of file types.h.

Typedef Documentation

typedef uint32_t jack_nframes_t

Type used to represent sample frame counts.

Definition at line 70 of file types.h.

typedef uint64_t jack_time_t

Type used to represent the value of free running monotonic clock with units of microseconds.

Definition at line 81 of file types.h.

typedef uint64_t jack_intclient_t

jack_intclient_t is an opaque type representing a loaded internal client. You may only access it using the API provided in <jack/intclient.h>.

Definition at line 94 of file types.h.

typedef struct _jack_port jack_port_t

jack_port_t is an opaque type. You may only access it using the API provided.

Definition at line 100 of file types.h.

typedef struct _jack_client jack_client_t

jack_client_t is an opaque type. You may only access it using the API provided.

Definition at line 106 of file types.h.

typedef uint32_t jack_port_id_t

Ports have unique ids. A port registration callback is the only place you ever need to know their value.

Definition at line 112 of file types.h.

Options for several JACK operations, formed by OR-ing together the relevant JackOptions bits.

Definition at line 179 of file types.h.

typedef enum JackStatus jack_status_t

Status word returned from several JACK operations, formed by OR-ing together the relevant JackStatus bits.

Definition at line 279 of file types.h.

Type of Latency Callback (Capture or Playback)

Definition at line 305 of file types.h.

Type of custom data transfer

Definition at line 336 of file types.h.

Used as argument to jack_app_register() for controlling the exact way an iOS app shall be registered to the JACK system as being a JACK client app.

typedef void(* JackLatencyCallback)(jack_latency_callback_mode_t mode, void *arg)

Prototype for the client supplied function that is called by the engine when port latencies need to be recalculated

Parameters
modeplayback or capture latency
argpointer to a client supplied data
Returns
zero on success, non-zero on error

Definition at line 380 of file types.h.

typedef int(* JackProcessCallback)(jack_nframes_t nframes, void *arg)

Prototype for the client supplied function that is called by the engine anytime there is work to be done.

Precondition
nframes == jack_get_buffer_size()
nframes == pow(2,x)
Parameters
nframesnumber of frames to process
argpointer to a client supplied structure
Returns
zero on success, non-zero on error

Definition at line 412 of file types.h.

typedef void*(* JackThreadCallback)(void *arg)

Prototype for the client thread routine called by the engine when the client is inserted in the graph.

Parameters
argpointer to a client supplied structure

Definition at line 421 of file types.h.

typedef void(* JackThreadInitCallback)(void *arg)

Prototype for the client supplied function that is called once after the creation of the thread in which other callbacks will be made. Special thread characteristics can be set from this callback, for example. This is a highly specialized callback and most clients will not and should not use it.

Parameters
argpointer to a client supplied structure
Returns
void

Definition at line 435 of file types.h.

typedef int(* JackGraphOrderCallback)(void *arg)

Prototype for the client supplied function that is called whenever the processing graph is reordered.

Parameters
argpointer to a client supplied structure
Returns
zero on success, non-zero on error

Definition at line 445 of file types.h.

typedef int(* JackXRunCallback)(void *arg)

Prototype for the client-supplied function that is called whenever an xrun has occured.

See Also
jack_get_xrun_delayed_usecs()
Parameters
argpointer to a client supplied structure
Returns
zero on success, non-zero on error

Definition at line 457 of file types.h.

typedef int(* JackBufferSizeCallback)(jack_nframes_t nframes, void *arg)

Prototype for the bufsize_callback that is invoked whenever the JACK engine buffer size changes. Although this function is called in the JACK process thread, the normal process cycle is suspended during its operation, causing a gap in the audio flow. So, the bufsize_callback can allocate storage, touch memory not previously referenced, and perform other operations that are not realtime safe.

Parameters
nframesbuffer size
argpointer supplied by jack_set_buffer_size_callback().
Returns
zero on success, non-zero on error

Definition at line 473 of file types.h.

typedef int(* JackSampleRateCallback)(jack_nframes_t nframes, void *arg)

Prototype for the client supplied function that is called when the engine sample rate changes.

Parameters
nframesnew engine sample rate
argpointer to a client supplied structure
Returns
zero on success, non-zero on error

Definition at line 484 of file types.h.

typedef void(* JackPortRegistrationCallback)(jack_port_id_t port, int register, void *arg)

Prototype for the client supplied function that is called whenever a port is registered or unregistered.

Parameters
portthe ID of the port
argpointer to a client supplied data
registernon-zero if the port is being registered, zero if the port is being unregistered

Definition at line 495 of file types.h.

typedef void(* JackClientRegistrationCallback)(const char *name, int register, void *arg)

Prototype for the client supplied function that is called whenever a client is registered or unregistered.

Parameters
namea null-terminated string containing the client name
registernon-zero if the client is being registered, zero if the client is being unregistered
argpointer to a client supplied structure

Definition at line 506 of file types.h.

typedef void(* JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int connect, void *arg)

Prototype for the client supplied function that is called whenever a port is connected or disconnected.

Parameters
aone of two ports connected or disconnected
bone of two ports connected or disconnected
connectnon-zero if ports were connected zero if ports were disconnected
argpointer to a client supplied data

Definition at line 518 of file types.h.

typedef int(* JackPortRenameCallback)(jack_port_id_t port, const char *old_name, const char *new_name, void *arg)

Prototype for the client supplied function that is called whenever the port name has been changed.

Parameters
portthe port that has been renamed
new_namethe new name
argpointer to a client supplied structure
Returns
zero on success, non-zero on error

Definition at line 530 of file types.h.

typedef void(* JackFreewheelCallback)(int starting, void *arg)

Prototype for the client supplied function that is called whenever jackd starts or stops freewheeling.

Parameters
startingnon-zero if we start starting to freewheel, zero otherwise
argpointer to a client supplied structure

Definition at line 539 of file types.h.

typedef void(* JackShutdownCallback)(void *arg)

Prototype for the client supplied function, registered with jack_on_shutdown(), that is called whenever the JACK server is closing the JACK client. This may be due to server shutdown, overload issues, user requested closing of the client or other reasons.

Note that after server shutdown, the client pointer is not deallocated by libjack, the application is responsible to properly use jack_client_close() to release client ressources!

Warning
jack_client_close() cannot be safely used inside the shutdown callback and has to be called outside of the callback context (thread).
Parameters
argpointer to a client supplied structure
Deprecated:
It is recommended to implement JackInfoShutdownCallback() instead, which provides detailed informations about the exact reason why the client has been closed by the JACK server.

Definition at line 562 of file types.h.

typedef void(* JackInfoShutdownCallback)(jack_status_t code, const char *reason, void *arg)

Prototype for the client supplied function, registered with jack_on_info_shutdown(), that is called whenever the JACK server is closing the JACK client. This may be due to server shutdown, overload issues, user requested closing of the client or other reasons.

Note that after server shutdown, the client pointer is not deallocated by libjack, the application is responsible to properly use jack_client_close() to release client ressources. This function provides essentially the same purpose as JackShutdownCallback(), but instead of the latter, also provides detailed informations about the exact reason, why the client has been closed by the JACK server.

Warning
jack_client_close() cannot be safely used inside the shutdown callback and has to be called outside of the callback context (thread).
Parameters
codea status word, formed by OR-ing together the relevant JackStatus bits.
reasona string describing the shutdown reason (backend failure, server crash... etc...)
argpointer to a client supplied structure

Definition at line 586 of file types.h.

For convenience, use this typedef if you want to be able to change between float and double. You may want to typedef sample_t to jack_default_audio_sample_t in your application.

Definition at line 605 of file types.h.

typedef uint64_t jack_unique_t

Unique ID (opaque)

Definition at line 680 of file types.h.

typedef int(* JackSyncCallback)(jack_transport_state_t state, jack_position_t *pos, void *arg)

Prototype for the sync_callback defined by slow-sync clients. When the client is active, this callback is invoked just before process() in the same thread. This occurs once after registration, then subsequently whenever some client requests a new position, or the transport enters the JackTransportStarting state. This realtime function must not wait.

The transport state will be:

Parameters
statecurrent transport state.
posnew transport position.
argthe argument supplied by jack_set_sync_callback().
Returns
TRUE (non-zero) when ready to roll.

Definition at line 791 of file types.h.

typedef void(* JackTimebaseCallback)(jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos, void *arg)

Prototype for the timebase_callback used to provide extended position information. Its output affects all of the following process cycle. This realtime function must not wait.

This function is called immediately after process() in the same thread whenever the transport is rolling, or when any client has requested a new position in the previous cycle. The first cycle after jack_set_timebase_callback() is also treated as a new position, or the first cycle after jack_activate() if the client had been inactive.

The timebase master may not use its pos argument to set pos->frame. To change position, use jack_transport_reposition() or jack_transport_locate(). These functions are realtime-safe, the timebase_callback can call them directly.

Parameters
statecurrent transport state.
nframesnumber of frames in current period.
posaddress of the position structure for the next cycle; pos->frame will be its frame number. If new_pos is FALSE, this structure contains extended position information from the current cycle. If TRUE, it contains whatever was set by the requester. The timebase_callback's task is to update the extended information here.
new_posTRUE (non-zero) for a newly requested pos, or for the first cycle after the timebase_callback is defined.
argthe argument supplied by jack_set_timebase_callback().

Definition at line 825 of file types.h.

Enumeration Type Documentation

jack_options_t bits

Enumerator:
JackNullOption 

Null value to use when no option bits are needed.

JackNoStartServer 

Do not automatically start the JACK server when it is not already running. This option is always selected if $JACK_NO_START_SERVER is defined in the calling process environment.

JackUseExactName 

Use the exact client name requested. Otherwise, JACK automatically generates a unique one, if needed.

JackServerName 

Open with optional (char *) server_name parameter.

JackLoadName 

Load internal client from optional (char *) load_name. Otherwise use the client_name.

JackLoadInit 

Pass optional (char *) load_init string to the jack_initialize() entry point of an internal client.

JackSessionID 

Pass a SessionID Token this allows the sessionmanager to identify the client again.

JackNoBackground 

No background mode on iOS. (by default, background mode allows the application to continue handling audio in background)

Definition at line 119 of file types.h.

enum JackStatus

jack_status_t bits

Enumerator:
JackFailure 

Overall operation failed. This bit is always set in case there was some kind of error.

JackInvalidOption 

The operation contained an invalid or unsupported option.

JackNameNotUnique 

The desired client name was not unique. With the JackUseExactName option this situation is fatal. Otherwise, the name was modified by appending a dash and a two-digit number in the range "-01" to "-99". The jack_get_client_name() function will return the exact string that was used. If the specified client_name plus these extra characters would be too long, the open fails instead.

JackServerStarted 

The JACK server was started as a result of this operation. Otherwise, it was running already. In either case the caller is now connected to jackd, so there is no race condition. When the server shuts down, the client will find out.

JackServerFailed 

Unable to connect to the JACK server.

JackServerError 

Communication error with the JACK server.

JackNoSuchClient 

Requested client does not exist.

JackLoadFailure 

Unable to load internal client

JackInitFailure 

Unable to initialize client

JackShmFailure 

Unable to access shared memory

JackVersionError 

Client's protocol version does not match

JackBackendError 

Backend error

JackClientZombie 

Client zombified failure. This error flag is used when a client was closed by the server because the client (or overall JACK clients) consumed too much CPU time. JACK reacts in this way to prevent the overall system to turn unresponsive.

JackBackgroundFailure 

Background mode on iOS failure

JackClientKilled 

Client closed by user request from server on iOS.

Definition at line 184 of file types.h.

jack_latency_callback_mode_t

Enumerator:
JackCaptureLatency 

Latency Callback for Capture Latency. Input Ports have their latency value setup. In the Callback the client needs to set the latency of the output ports

JackPlaybackLatency 

Latency Callback for Playback Latency. Output Ports have their latency value setup. In the Callback the client needs to set the latency of the input ports

Definition at line 284 of file types.h.

Used in conjunction with the "custom" API. Defines the type of change that happened with the associated custom data.

jack_custom_change_t

Enumerator:
JackCustomRemoved 

Custom data has been removed.

JackCustomAdded 

Custom data was added.

JackCustomReplaced 

Already existing custom data replaced by new data.

Definition at line 314 of file types.h.

Used as argument to jack_app_register() for controlling the exact way an iOS app shall be registered to the JACK system as being a JACK client app.

Enumerator:
JackRegisterDefaults 

Use default behavior to register JACK client app to the JACK system.

If the app yet needs to be registered and if the JACK server is not running at that point, the JACK server app will be launched automatically for a short moment and immediately stopped afterwards.

JackRegisterPrompt 

If this flag is passed to jack_app_register(), the app is not yet registered to the JACK system and JACK server is not yet running at this point, a popup dialog will be shown to the user, asking the user whether the app should be registered now. If the user accepts, JACK server will be launched, the screen switches to the JACK control app for a moment, app informations be written persistenly to disc, then returns to the client app and exits the JACK server app full automatically.

Even though the registration procedure is completely automated, requiring no user actions at all, this flag was introduced since some people might get a confused impression if an app launches another app, quits it right after and turns back the original app without letting the user know why this was happening.

Definition at line 342 of file types.h.

A port has a set of flags that are formed by AND-ing together the desired values from the list below. The flags "JackPortIsInput" and "JackPortIsOutput" are mutually exclusive and it is an error to use them both.

Enumerator:
JackPortIsInput 

if JackPortIsInput is set, then the port can receive data.

JackPortIsOutput 

if JackPortIsOutput is set, then data can be read from the port.

JackPortIsPhysical 

if JackPortIsPhysical is set, then the port corresponds to some kind of physical I/O connector.

JackPortCanMonitor 

if JackPortCanMonitor is set, then a call to jack_port_request_monitor() makes sense.

Precisely what this means is dependent on the client. A typical result of it being called with TRUE as the second argument is that data that would be available from an output port (with JackPortIsPhysical set) is sent to a physical output connector as well, so that it can be heard/seen/whatever.

Clients that do not control physical interfaces should never create ports with this bit set.

JackPortIsTerminal 

JackPortIsTerminal means:

for an input port: the data received by the port will not be passed on or made available at any other port

for an output port: the data available at the port does not originate from any other port

Audio synthesizers, I/O hardware interface clients, HDR systems are examples of clients that would set this flag for their ports.

Definition at line 613 of file types.h.

Transport states.

Enumerator:
JackTransportStopped 

Transport halted

JackTransportRolling 

Transport playing

JackTransportLooping 

For OLD_TRANSPORT, now ignored

JackTransportStarting 

Waiting for sync ready

JackTransportNetStarting 

Waiting for sync ready on the network

Definition at line 669 of file types.h.

Optional struct jack_position_t fields.

Enumerator:
JackPositionBBT 

Bar, Beat, Tick

JackPositionTimecode 

External timecode

JackBBTFrameOffset 

Frame offset of BBT information

JackAudioVideoRatio 

audio frames per video frame

JackVideoFrameOffset 

frame offset of first video frame

Definition at line 685 of file types.h.

Optional struct jack_transport_info_t fields.

See Also
jack_position_bits_t.
Enumerator:
JackTransportState 

Transport state

JackTransportPosition 

Frame number

JackTransportLoop 

Loop boundaries (ignored)

JackTransportSMPTE 

SMPTE (ignored)

JackTransportBBT 

Bar, Beat, Tick

Definition at line 841 of file types.h.

DE • EN
Copyright © MMXIII Crudebyte. All rights reserved.

twitter