2022-10-06 04:18:57 +02:00
|
|
|
# jacket.nim
|
|
|
|
|
|
|
|
|
2022-10-09 09:13:05 +02:00
|
|
|
# Possible names/install locations of libjack, according to:
|
2022-10-06 04:18:57 +02:00
|
|
|
# https://github.com/x42/weakjack/blob/master/weak_libjack.c#L108
|
|
|
|
proc getJackLibName: string =
|
|
|
|
when system.hostOS == "windows":
|
2022-10-09 09:13:05 +02:00
|
|
|
when sizeof(int) == 4:
|
|
|
|
result = "libjack.dll"
|
|
|
|
else:
|
|
|
|
result = "libjack64.dll"
|
2022-10-06 04:18:57 +02:00
|
|
|
elif system.hostOS == "macosx":
|
2022-10-09 09:13:05 +02:00
|
|
|
result = "(|/usr/local/lib/|/opt/homebrew/lib/|/opt/local/lib/)libjack.dylib"
|
2022-10-06 04:18:57 +02:00
|
|
|
else:
|
|
|
|
result = "libjack.so.0"
|
2023-05-22 18:56:10 +02:00
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
{.push dynlib: getJackLibName().}
|
2023-05-22 04:00:07 +02:00
|
|
|
|
2022-10-09 09:13:05 +02:00
|
|
|
# ------------------------------ Constants --------------------------------
|
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
const
|
|
|
|
JACK_MAX_FRAMES* = (4294967295'i64)
|
|
|
|
JACK_LOAD_INIT_LIMIT* = 1024
|
|
|
|
JACK_DEFAULT_AUDIO_TYPE* = "32 bit float mono audio"
|
|
|
|
JACK_DEFAULT_MIDI_TYPE* = "8 bit raw midi"
|
|
|
|
|
2023-05-22 19:04:25 +02:00
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
# ----------------------------- Custom Types ------------------------------
|
|
|
|
|
|
|
|
type
|
2023-05-22 19:04:25 +02:00
|
|
|
Time* = uint64
|
|
|
|
NFrames* = uint32
|
2023-05-24 09:42:09 +02:00
|
|
|
IntClient = uint64
|
2023-05-22 19:04:25 +02:00
|
|
|
Uuid* = uint64
|
|
|
|
PortId* = uint32
|
|
|
|
PortTypeId* = uint32
|
2023-05-22 05:13:31 +02:00
|
|
|
DefaultAudioSample* = cfloat
|
2022-10-06 04:18:57 +02:00
|
|
|
|
|
|
|
type
|
2023-05-22 05:13:31 +02:00
|
|
|
Client = distinct object
|
|
|
|
ClientP* = ptr Client
|
|
|
|
Port = distinct object
|
|
|
|
PortP* = ptr Port
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:09:35 +02:00
|
|
|
type
|
|
|
|
MidiData* = uint8
|
|
|
|
MidiEvent* = object
|
|
|
|
time*: NFrames
|
|
|
|
size*: csize_t
|
|
|
|
buffer*: ptr UncheckedArray[MidiData]
|
|
|
|
MidiEventP* = ptr MidiEvent
|
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
type
|
|
|
|
JackOptions* {.size: sizeof(cint) pure.} = enum
|
|
|
|
NullOption = 0x00,
|
|
|
|
NoStartServer = 0x01,
|
|
|
|
UseExactName = 0x02,
|
|
|
|
ServerName = 0x04,
|
|
|
|
LoadName = 0x08,
|
|
|
|
LoadInit = 0x10,
|
|
|
|
SessionID = 0x20
|
|
|
|
|
|
|
|
type
|
|
|
|
JackStatus* {.size: sizeof(cint).} = enum
|
2022-10-06 17:24:58 +02:00
|
|
|
Success = 0x00,
|
2022-10-06 04:18:57 +02:00
|
|
|
Failure = 0x01,
|
|
|
|
InvalidOption = 0x02,
|
|
|
|
NameNotUnique = 0x04,
|
|
|
|
ServerStarted = 0x08,
|
|
|
|
ServerFailed = 0x10,
|
|
|
|
ServerError = 0x20,
|
|
|
|
NoSuchClient = 0x40,
|
|
|
|
LoadFailure = 0x80,
|
|
|
|
InitFailure = 0x100,
|
|
|
|
ShmFailure = 0x200,
|
|
|
|
VersionError = 0x400,
|
|
|
|
BackendError = 0x800,
|
|
|
|
ClientZombie = 0x1000
|
|
|
|
|
|
|
|
type
|
2023-05-23 02:27:27 +02:00
|
|
|
PortFlags* {.size: sizeof(culong) pure.} = enum
|
2023-05-22 18:56:10 +02:00
|
|
|
PortIsInput = 0x01,
|
|
|
|
PortIsOutput = 0x02,
|
|
|
|
PortIsPhysical = 0x04,
|
|
|
|
PortCanMonitor = 0x08,
|
2022-10-06 04:18:57 +02:00
|
|
|
PortIsTerminal = 0x10
|
|
|
|
|
|
|
|
type
|
2023-05-24 09:43:50 +02:00
|
|
|
LatencyRange* = object
|
|
|
|
min*: NFrames
|
|
|
|
max*: NFrames
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
LatencyCallbackMode* {.size: sizeof(cint) pure.} = enum
|
2022-10-06 04:18:57 +02:00
|
|
|
CaptureLatency,
|
|
|
|
PlaybackLatency
|
|
|
|
|
2023-05-22 19:58:03 +02:00
|
|
|
# Transport
|
|
|
|
|
|
|
|
type
|
|
|
|
PositionBits* {.size: sizeof(cint).} = enum
|
|
|
|
PositionBBT = 0x10,
|
|
|
|
PositionTimecode = 0x20,
|
|
|
|
BBTFrameOffset = 0x40,
|
|
|
|
AudioVideoRatio = 0x80,
|
|
|
|
VideoFrameOffset = 0x100,
|
|
|
|
TickDouble = 0x200
|
|
|
|
|
|
|
|
TransportState* {.size: sizeof(cint).} = enum
|
|
|
|
TransportStopped = 0,
|
|
|
|
TransportRolling = 1,
|
|
|
|
TransportLooping = 2,
|
|
|
|
TransportStarting = 3,
|
|
|
|
TransportNetStarting = 4
|
|
|
|
|
|
|
|
type
|
|
|
|
Position* = object
|
|
|
|
unique1*: uint64
|
|
|
|
usecs*: Time
|
|
|
|
frameRate*: NFrames
|
|
|
|
frame*: NFrames
|
|
|
|
valid*: PositionBits
|
|
|
|
bar*: int32
|
|
|
|
beat*: int32
|
|
|
|
tick*: int32
|
|
|
|
barStartTick*: cdouble
|
|
|
|
beatsPerBar*: cfloat
|
|
|
|
beatType*: cfloat
|
|
|
|
ticksPerBeat*: cdouble
|
|
|
|
beatsPerMinute*: cdouble
|
|
|
|
frameTime*: cdouble
|
|
|
|
nextTime*: cdouble
|
|
|
|
bbtOffset*: NFrames
|
|
|
|
audioFramesPerVideoFrame*: cfloat
|
|
|
|
videoOffset*: NFrames
|
|
|
|
tickDouble*: cdouble
|
|
|
|
padding*: array[5, int32]
|
|
|
|
unique2*: uint64
|
|
|
|
PositionP* = ptr Position
|
|
|
|
|
|
|
|
#[ DEPRECATED
|
|
|
|
typedef enum {
|
|
|
|
JackTransportState = 0x1,
|
|
|
|
JackTransportPosition = 0x2,
|
|
|
|
JackTransportLoop = 0x4,
|
|
|
|
JackTransportSMPTE = 0x8,
|
|
|
|
JackTransportBBT = 0x10
|
|
|
|
} jack_transport_bits_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
jack_nframes_t frame_rate;
|
|
|
|
jack_time_t usecs;
|
|
|
|
jack_transport_bits_t valid;
|
|
|
|
jack_transport_state_t transport_state;
|
|
|
|
jack_nframes_t frame;
|
|
|
|
jack_nframes_t loop_start;
|
|
|
|
jack_nframes_t loop_end;
|
|
|
|
long smpte_offset
|
|
|
|
float smpte_frame_rate;
|
|
|
|
int bar;
|
|
|
|
int beat;
|
|
|
|
int tick;
|
|
|
|
double bar_start_tick;
|
|
|
|
float beats_per_bar;
|
|
|
|
float beat_type;
|
|
|
|
double ticks_per_beat;
|
|
|
|
double beats_per_minute;
|
|
|
|
} jack_transport_info_t;
|
|
|
|
]#
|
|
|
|
|
|
|
|
const
|
|
|
|
JACK_POSITION_MASK* = (PositionBBT.ord or PositionTimecode.ord)
|
|
|
|
EXTENDED_TIME_INFO* = true
|
|
|
|
JACK_TICK_DOUBLE* = true
|
|
|
|
|
2023-05-23 02:25:04 +02:00
|
|
|
# Metadata
|
|
|
|
|
|
|
|
type
|
|
|
|
Property* = object
|
|
|
|
key*: cstring
|
|
|
|
data*: cstring
|
|
|
|
`type`*: cstring
|
|
|
|
|
|
|
|
PropertyChange* {.size: sizeof(cint).} = enum
|
|
|
|
PropertyCreated,
|
|
|
|
PropertyChanged,
|
|
|
|
PropertyDeleted
|
|
|
|
|
|
|
|
Description* = object
|
|
|
|
subject*: Uuid
|
|
|
|
property_cnt*: uint32
|
|
|
|
properties*: ptr UncheckedArray[Property]
|
|
|
|
property_size*: uint32
|
|
|
|
|
|
|
|
DescriptionP* = ptr Description
|
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
# Callback function types
|
2023-05-22 19:58:03 +02:00
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
type
|
2023-05-23 02:27:27 +02:00
|
|
|
ProcessCallback* = proc (nframes: NFrames; arg: pointer): cint {.cdecl.}
|
|
|
|
ThreadCallback* = proc (arg: pointer): pointer {.cdecl.}
|
|
|
|
ThreadInitCallback* = proc (arg: pointer) {.cdecl.}
|
|
|
|
GraphOrderCallback* = proc (arg: pointer): cint {.cdecl.}
|
|
|
|
XRunCallback* = proc (arg: pointer): cint {.cdecl.}
|
|
|
|
BufferSizeCallback* = proc (nframes: NFrames; arg: pointer): cint {.cdecl.}
|
|
|
|
SampleRateCallback* = proc (nframes: NFrames; arg: pointer): cint {.cdecl.}
|
|
|
|
PortRegistrationCallback* = proc (port: PortId; flag: cint; arg: pointer) {.cdecl.}
|
|
|
|
ClientRegistrationCallback* = proc (name: cstring; flag: cint; arg: pointer) {.cdecl.}
|
|
|
|
PortConnectCallback* = proc (portA: PortId; portB: PortId; connect: cint; arg: pointer) {.cdecl.}
|
|
|
|
PortRenameCallback* = proc (port: PortId; oldName: cstring; newName: cstring; arg: pointer) {.cdecl.}
|
|
|
|
FreewheelCallback* = proc (starting: cint; arg: pointer) {.cdecl.}
|
|
|
|
ShutdownCallback* = proc (arg: pointer) {.cdecl.}
|
|
|
|
InfoShutdownCallback* = proc (code: JackStatus; reason: cstring; arg: pointer) {.cdecl.}
|
|
|
|
LatencyCallback* = proc (mode: LatencyCallbackMode; arg: pointer) {.cdecl.}
|
|
|
|
InfoCallback* = proc (msg: cstring) {.cdecl.}
|
|
|
|
ErrorCallback* = proc (msg: cstring) {.cdecl.}
|
|
|
|
|
|
|
|
SyncCallback* = proc (state: TransportState; pos: ptr Position; arg: pointer): cint {.cdecl.}
|
|
|
|
TimebaseCallback* = proc (state: TransportState; nframes: NFrames; pos: ptr Position; newPos: cint;
|
|
|
|
arg: pointer) {.cdecl.}
|
2023-05-23 02:25:04 +02:00
|
|
|
|
|
|
|
PropertyChangeCallback* = proc (subject: Uuid, key: cstring, change: PropertyChange, arg: pointer) {.cdecl.}
|
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
|
|
|
|
# ----------------------------- Version info ------------------------------
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# void jack_get_version(int *major_ptr, int *minor_ptr, int *micro_ptr, int *proto_ptr)
|
2022-10-06 04:18:57 +02:00
|
|
|
proc getVersion*(major: ptr cint; minor: ptr cint; micro: ptr cint; proto: ptr cint) {.importc: "jack_get_version".}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# const char * jack_get_version_string(void)
|
2022-10-06 04:18:57 +02:00
|
|
|
proc getVersionString*(): cstring {.importc: "jack_get_version_string".}
|
|
|
|
|
|
|
|
|
|
|
|
# --------------------------- Memory management ---------------------------
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# void jack_free(void* ptr)
|
2022-10-06 04:18:57 +02:00
|
|
|
proc free*(`ptr`: pointer) {.importc: "jack_free".}
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------- Clients --------------------------------
|
|
|
|
|
|
|
|
# jack_client_t * jack_client_open (char *client_name,
|
|
|
|
# jack_options_t options,
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_status_t *status, ...)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc clientOpen*(clientName: cstring; options: cint; status: ptr cint): ClientP {.
|
2022-10-06 04:18:57 +02:00
|
|
|
varargs, importc: "jack_client_open".}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_client_close (jack_client_t *client)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc clientClose*(client: ClientP): cint {.importc: "jack_client_close"}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_client_name_size (void)
|
2022-10-06 04:18:57 +02:00
|
|
|
proc clientNameSize*(): cint {.importc: "jack_client_name_size"}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# char * jack_get_client_name (jack_client_t *client)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc getClientName*(client: ClientP): cstring {.importc: "jack_get_client_name".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 18:56:10 +02:00
|
|
|
# char *jack_get_uuid_for_client_name (jack_client_t *client, const char *client_name)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc getUuidForClientName*(client: ClientP; clientName: cstring): cstring {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_get_uuid_for_client_name".}
|
|
|
|
|
2023-05-22 18:56:10 +02:00
|
|
|
# char *jack_get_client_name_by_uuid (jack_client_t *client, const char *client_uuid)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc getClientNameByUuid*(client: ClientP; clientUuid: cstring): cstring {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_get_client_name_by_uuid".}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_activate (jack_client_t *client)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc activate*(client: ClientP): cint {.importc: "jack_activate".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_deactivate (jack_client_t *client)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc deactivate*(client: ClientP): cint {.importc: "jack_deactivate".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_get_client_pid (const char *name)
|
2022-10-06 04:18:57 +02:00
|
|
|
proc getClientPid*(name: cstring): cint {.importc: "jack_get_client_pid".}
|
|
|
|
|
|
|
|
# FIXME: not implemented yet
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_native_thread_t jack_client_thread_id (jack_client_t *client)
|
2023-05-22 18:56:10 +02:00
|
|
|
# proc clientThreadId*(client: ClientP): NativeThread {.importc: "jack_client_thread_id".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_is_realtime (jack_client_t *client)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc isRealtime*(client: ClientP): cint {.importc: "jack_is_realtime".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_nframes_t jack_cycle_wait (jack_client_t* client)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc cycleWait*(client: ClientP): NFrames {.importc: "jack_cycle_wait".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# void jack_cycle_signal (jack_client_t* client, int status)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc cycleSignal*(client: ClientP; status: cint) {.importc: "jack_cycle_signal".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-24 09:45:06 +02:00
|
|
|
#[ DEPRECATED
|
|
|
|
jack_client_t *jack_client_new (const char *client_name)
|
|
|
|
jack_nframes_t jack_thread_wait (jack_client_t *client, int status)
|
|
|
|
]#
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-24 09:42:09 +02:00
|
|
|
# --------------------------- Internal Clients ----------------------------
|
|
|
|
|
|
|
|
# char *jack_get_internal_client_name (jack_client_t *client, jack_intclient_t intclient);
|
|
|
|
proc getInternalClientName(client: ClientP; intclient: IntClient): cstring {.
|
|
|
|
importc: "jack_get_internal_client_name".}
|
|
|
|
|
|
|
|
# jack_intclient_t jack_internal_client_handle (jack_client_t *client, const char *client_name,
|
|
|
|
# jack_status_t *status)
|
|
|
|
proc internalClientHandle(client: ClientP; clientName: cstring; status: ptr cint): IntClient {.
|
|
|
|
importc: "jack_internal_client_handle".}
|
|
|
|
|
|
|
|
# jack_intclient_t jack_internal_client_load (jack_client_t *client, const char *client_name,
|
|
|
|
# jack_options_t options, jack_status_t *status, ...)
|
|
|
|
proc internalClientLoad(client: ClientP; clientName: cstring; options: cint; status: ptr cint): IntClient {.
|
|
|
|
varargs, importc: "jack_internal_client_load".}
|
|
|
|
|
|
|
|
# jack_status_t jack_internal_client_unload (jack_client_t *client, jack_intclient_t intclient)
|
|
|
|
|
|
|
|
proc internalClientUnload(client: ClientP; intclient: IntClient): cint {.
|
|
|
|
importc: "jack_internal_client_unload".}
|
|
|
|
|
|
|
|
#[ DEPRECATED
|
|
|
|
int jack_internal_client_new (const char * client_name, const char *load_name, const char *load_init)
|
|
|
|
void jack_internal_client_close (const char *client_name)
|
|
|
|
]#
|
|
|
|
|
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
# ------------------------------- Callbacks -------------------------------
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setProcessThread*(client: ClientP; threadCallback: ThreadCallback; arg: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_process_thread".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setThreadInitCallback*(client: ClientP; threadInitCallback: ThreadInitCallback; arg: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_thread_init_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc onShutdown*(client: ClientP; shutdownCallback: ShutdownCallback; arg: pointer) {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_on_shutdown".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc onInfoShutdown*(client: ClientP; shutdownCallback: InfoShutdownCallback; arg: pointer) {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_on_info_shutdown".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setProcessCallback*(client: ClientP; processCallback: ProcessCallback; arg: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_process_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setFreewheelCallback*(client: ClientP; freewheelCallback: FreewheelCallback; arg: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_freewheel_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setBufferSizeCallback*(client: ClientP; bufsizeCallback: BufferSizeCallback; arg: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_buffer_size_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setSampleRateCallback*(client: ClientP; srateCallback: SampleRateCallback; arg: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_sample_rate_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setClientRegistrationCallback*(client: ClientP; registrationCallback: ClientRegistrationCallback;
|
2022-10-06 04:18:57 +02:00
|
|
|
arg: pointer): cint {.
|
|
|
|
importc: "jack_set_client_registration_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setPortRegistrationCallback*(client: ClientP; registrationCallback: PortRegistrationCallback;
|
2022-10-06 04:18:57 +02:00
|
|
|
arg: pointer): cint {.
|
|
|
|
importc: "jack_set_port_registration_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setPortConnectCallback*(client: ClientP; connectCallback: PortConnectCallback; arg: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_port_connect_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setPortRenameCallback*(client: ClientP; renameCallback: PortRenameCallback; arg: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_port_rename_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setGraphOrderCallback*(client: ClientP; graphCallback: GraphOrderCallback; a3: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_graph_order_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setXrunCallback*(client: ClientP; xrunCallback: XRunCallback; arg: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_xrun_callback".}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setLatencyCallback*(client: ClientP; latencyCallback: LatencyCallback; arg: pointer): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_set_latency_callback".}
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------- Server Client Control ------------------------
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_set_freewheel(jack_client_t* client, int onoff)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc setFreewheel*(client: ClientP; onoff: cint): cint {.importc: "jack_set_freewheel".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc setBufferSize*(client: ClientP; nframes: NFrames): cint {.importc: "jack_set_buffer_size".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
#jack_nframes_t jack_get_sample_rate (jack_client_t *)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc getSampleRate*(client: ClientP): NFrames {.importc: "jack_get_sample_rate".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_nframes_t jack_get_buffer_size (jack_client_t *)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc getBufferSize*(client: ClientP): NFrames {.importc: "jack_get_buffer_size".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-24 09:45:06 +02:00
|
|
|
# float jack_cpu_load (jack_client_t *client)
|
|
|
|
proc cpuLoad*(client: ClientP): cfloat {.importc: "jack_cpu_load".}
|
|
|
|
|
2023-05-22 19:02:38 +02:00
|
|
|
#[ DEPRECATED
|
|
|
|
int jack_engine_takeover_timebase (jack_client_t *)
|
|
|
|
]#
|
2022-10-06 04:18:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
# --------------------------------- Ports ---------------------------------
|
|
|
|
|
|
|
|
# jack_port_t * jack_port_register (jack_client_t *client,
|
|
|
|
# const char *port_name,
|
|
|
|
# const char *port_type,
|
|
|
|
# unsigned long flags,
|
2023-05-22 07:10:40 +02:00
|
|
|
# unsigned long buffer_size)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portRegister*(client: ClientP; portName: cstring; portType: cstring;
|
|
|
|
flags: culong; bufferSize: culong): PortP {.importc: "jack_port_register".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_unregister (jack_client_t *client, jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portUnregister*(client: ClientP; port: PortP): cint {.importc: "jack_port_unregister".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# void * jack_port_get_buffer (jack_port_t *port, jack_nframes_t)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portGetBuffer*(port: PortP; nframes: NFrames): pointer {.importc: "jack_port_get_buffer".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_uuid_t jack_port_uuid (const jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portUuid*(port: PortP): Uuid {.importc: "jack_port_uuid".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# const char * jack_port_name (const jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portName*(port: PortP): cstring {.importc: "jack_port_name".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# const char * jack_port_short_name (const jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portShortName*(port: PortP): cstring {.importc: "jack_port_short_name".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_flags (const jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portFlags*(port: PortP): cint {.importc: "jack_port_flags".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# const char * jack_port_type (const jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portType*(port: PortP): cstring {.importc: "jack_port_type".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_port_type_id_t jack_port_type_id (const jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portTypeId*(port: PortP): PortTypeId {.importc: "jack_port_type_id".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_is_mine (const jack_client_t *client, const jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portIsMine*(client: ClientP; port: PortP): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_port_is_mine".}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_connected (const jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portConnected*(port: PortP): cint {.importc: "jack_port_connected".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
|
|
|
# int jack_port_connected_to (const jack_port_t *port,
|
2023-05-22 07:10:40 +02:00
|
|
|
# const char *port_name)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portConnectedTo*(port: PortP; portName: cstring): cint {.importc: "jack_port_connected_to".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# const char ** jack_port_get_connections (const jack_port_t *port)
|
2022-10-06 04:18:57 +02:00
|
|
|
#
|
2023-05-22 18:56:10 +02:00
|
|
|
# CAVEAT: The caller is responsible for calling jack_free() on any non-NULL returned value.
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portGetConnections*(port: PortP): cstringArray {.importc: "jack_port_get_connections".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
|
|
|
# const char ** jack_port_get_all_connections (const jack_client_t *client,
|
2023-05-22 07:10:40 +02:00
|
|
|
# const jack_port_t *port)
|
2022-10-06 04:18:57 +02:00
|
|
|
#
|
2023-05-22 18:56:10 +02:00
|
|
|
# CAVEAT: The caller is responsible for calling jack_free() on any non-NULL returned value.
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portGetAllConnections*(client: ClientP; port: PortP): cstringArray {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_port_get_all_connections".}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_rename (jack_client_t* client, jack_port_t *port, const char *port_name)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portRename*(client: ClientP; port: PortP; portName: cstring): cint {.importc: "jack_port_rename".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_set_alias (jack_port_t *port, const char *alias)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portSetAlias*(port: PortP; alias: cstring): cint {.importc: "jack_port_set_alias".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_unset_alias (jack_port_t *port, const char *alias)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portUnsetAlias*(port: PortP; alias: cstring): cint {.importc: "jack_port_unset_alias".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2])
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portGetAliases*(port: PortP; aliases: array[2, cstring]): cint {.importc: "jack_port_get_aliases".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
#int jack_port_request_monitor (jack_port_t *port, int onoff)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portRequestMonitor*(port: PortP; onoff: cint): cint {.importc: "jack_port_request_monitor".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
|
|
|
# int jack_port_request_monitor_by_name (jack_client_t *client,
|
2023-05-22 07:10:40 +02:00
|
|
|
# const char *port_name, int onoff)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portRequestMonitorByName*(client: ClientP; portName: cstring; onoff: cint): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_port_request_monitor_by_name".}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_ensure_monitor (jack_port_t *port, int onoff)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portEnsureMonitor*(port: PortP; onoff: cint): cint {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_port_ensure_monitor".}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_monitoring_input (jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portMonitoringInput*(port: PortP): cint {.importc: "jack_port_monitoring_input".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-24 09:45:06 +02:00
|
|
|
#[ DEPRECATED
|
|
|
|
int jack_port_tie (jack_port_t *src, jack_port_t *dst)
|
|
|
|
int jack_port_untie (jack_port_t *port)
|
|
|
|
int jack_port_set_name (jack_port_t *port, const char *port_name)
|
|
|
|
]#
|
|
|
|
|
2023-05-22 18:56:10 +02:00
|
|
|
|
|
|
|
# ------------------------------ Port Lookup ------------------------------
|
|
|
|
|
|
|
|
# const char ** jack_get_ports (jack_client_t *client,
|
|
|
|
# const char *port_name_pattern,
|
|
|
|
# const char *type_name_pattern,
|
|
|
|
# unsigned long flags)
|
|
|
|
#
|
|
|
|
# CAVEAT: The caller is responsible for calling jack_free() on any non-NULL returned value.
|
|
|
|
proc getPorts*(client: ClientP; portNamePattern: cstring;
|
|
|
|
typeNamePattern: cstring; flags: culong): cstringArray {.importc: "jack_get_ports".}
|
|
|
|
|
|
|
|
# jack_port_t * jack_port_by_name (jack_client_t *client, const char *port_name)
|
|
|
|
proc portByName*(client: ClientP; portName: cstring): PortP {.importc: "jack_port_by_name".}
|
|
|
|
|
|
|
|
# jack_port_t * jack_port_by_id (jack_client_t *client, jack_port_id_t port_id)
|
|
|
|
proc portById*(client: ClientP; portId: PortId): PortP {.importc: "jack_port_by_id".}
|
|
|
|
|
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
# ------------------------------ Connections ------------------------------
|
|
|
|
|
|
|
|
# int jack_connect (jack_client_t *client,
|
|
|
|
# const char *source_port,
|
2023-05-22 07:10:40 +02:00
|
|
|
# const char *destination_port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc connect*(client: ClientP; srcPort: cstring; destPort: cstring): cint {.importc: "jack_connect".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
|
|
|
# int jack_disconnect (jack_client_t *client,
|
|
|
|
# const char *source_port,
|
2023-05-22 07:10:40 +02:00
|
|
|
# const char *destination_port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc disconnect*(client: ClientP; srcPort: cstring; destPort: cstring): cint {.importc: "jack_disconnect".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_disconnect (jack_client_t *client, jack_port_t *port)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portDisconnect*(client: ClientP; port: PortP): cint {.importc: "jack_port_disconnect".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_name_size(void)
|
2022-10-06 04:18:57 +02:00
|
|
|
proc portNameSize*(): cint {.importc: "jack_port_name_size".}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# int jack_port_type_size(void)
|
2022-10-06 04:18:57 +02:00
|
|
|
proc portTypeSize*(): cint {.importc: "jack_port_type_size".}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# size_t jack_port_type_get_buffer_size (jack_client_t *client, const char *port_type)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc portTypeGetBufferSize*(client: ClientP; portType: cstring): csize_t {.
|
2022-10-06 04:18:57 +02:00
|
|
|
importc: "jack_port_type_get_buffer_size".}
|
|
|
|
|
2023-05-22 18:56:10 +02:00
|
|
|
|
2023-05-22 07:09:35 +02:00
|
|
|
# --------------------------------- MIDI ----------------------------------
|
|
|
|
|
|
|
|
# jack_nframes_t jack_midi_get_event_count (void *port_buffer)
|
|
|
|
proc midiGetEventCount*(portBuffer: pointer): NFrames {.importc: "jack_midi_get_event_count".}
|
|
|
|
|
|
|
|
# int jack_midi_event_get (jack_midi_event_t *event, void *port_buffer, uint32_t event_index)
|
|
|
|
proc midiEventGet*(event: MidiEventP, portBuffer: pointer, eventIndex: uint32): cint {.
|
|
|
|
importc: "jack_midi_event_get".}
|
|
|
|
|
|
|
|
# void jack_midi_clear_buffer (void *port_buffer)
|
|
|
|
proc midiClearBuffer*(portBuffer: pointer) {.importc: "jack_midi_clear_buffer".}
|
|
|
|
|
|
|
|
# size_t jack_midi_max_event_size (void *port_buffer)
|
|
|
|
proc midiMaxEventSize*(portBuffer: pointer): csize_t {.importc: "jack_midi_max_event_size".}
|
|
|
|
|
|
|
|
# jack_midi_data_t * jack_midi_event_reserve (void *port_buffer, jack_nframes_t time, size_t data_size)
|
|
|
|
proc midiEventReserve*(portBuffer: pointer, time: NFrames, dataSize: csize_t): ptr MidiData {.
|
|
|
|
importc: "jack_midi_event_reserve".}
|
|
|
|
|
|
|
|
# int jack_midi_event_write (void *port_buffer, jack_nframes_t time, const jack_midi_data_t *data, size_t data_size)
|
|
|
|
proc midiEventWrite*(portBuffer: pointer, time: NFrames, data: ptr MidiData, dataSize: csize_t): int {.
|
|
|
|
importc: "jack_midi_event_write".}
|
|
|
|
|
|
|
|
# uint32_t jack_midi_get_lost_event_count (void *port_buffer)
|
|
|
|
proc midiGetLostEventCount*(portBuffer: pointer): uint32 {.importc: "jack_midi_get_lost_event_count".}
|
|
|
|
|
2023-05-22 18:56:10 +02:00
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
# -------------------------------- Latency --------------------------------
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# void jack_port_get_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range)
|
2023-05-24 09:43:50 +02:00
|
|
|
proc portGetLatencyRange*(port: PortP; mode: LatencyCallbackMode; range: ptr LatencyRange) {.
|
|
|
|
importc: "jack_port_get_latency_range".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-24 09:43:50 +02:00
|
|
|
# void jack_port_set_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range)
|
|
|
|
proc portSetLatencyRange*(port: PortP; mode: LatencyCallbackMode; range: ptr LatencyRange) {.
|
|
|
|
importc: "jack_port_set_latency_range".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-24 09:43:50 +02:00
|
|
|
# int jack_recompute_total_latencies (jack_client_t *)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc recomputeTotalLatencies*(client: ClientP): cint {.importc: "jack_recompute_total_latencies".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-24 09:43:50 +02:00
|
|
|
#[ DEPRECATED
|
|
|
|
jack_nframes_t jack_port_get_latency (jack_port_t *port)
|
|
|
|
jack_nframes_t jack_port_get_total_latency (jack_client_t *, jack_port_t *port)
|
|
|
|
void jack_port_set_latency (jack_port_t *port, jack_nframes_t)
|
|
|
|
int jack_recompute_total_latency (jack_client_t *, jack_port_t *port)
|
2022-10-06 04:18:57 +02:00
|
|
|
]#
|
|
|
|
|
|
|
|
|
|
|
|
# ----------------------------- Time handling -----------------------------
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc framesSinceCycleStart*(client: ClientP): NFrames {.importc: "jack_frames_since_cycle_start".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_nframes_t jack_frame_time (const jack_client_t *)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc frameTime*(client: ClientP): NFrames {.importc: "jack_frame_time".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_nframes_t jack_last_frame_time (const jack_client_t *client)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc lastFrameTime*(client: ClientP): NFrames {.importc: "jack_last_frame_time".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
|
|
|
# int jack_get_cycle_times(const jack_client_t *client,
|
2023-05-22 18:56:10 +02:00
|
|
|
# jack_nframes_t *current_frames,
|
|
|
|
# jack_time_t *current_usecs,
|
|
|
|
# jack_time_t *next_usecs,
|
|
|
|
# float *period_usecs)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc getCycleTimes*(client: ClientP; currentFrames: ptr NFrames;
|
|
|
|
currentUsecs: ptr Time; nextUsecs: ptr Time;
|
2022-10-06 04:18:57 +02:00
|
|
|
periodUsecs: ptr cfloat): cint {.importc: "jack_get_cycle_times".}
|
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc framesToTime*(client: ClientP; nframes: NFrames): Time {.importc: "jack_frames_to_time".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc timeToFrames*(client: ClientP; time: Time): NFrames {.importc: "jack_time_to_frames".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 07:10:40 +02:00
|
|
|
# jack_time_t jack_get_time(void)
|
2023-05-22 05:13:31 +02:00
|
|
|
proc getTime*(): Time {.importc: "jack_get_time".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-22 19:58:03 +02:00
|
|
|
|
|
|
|
# ------------------------------- Transport -------------------------------
|
|
|
|
|
|
|
|
# int jack_release_timebase (jack_client_t *client)
|
|
|
|
proc releaseTimebase*(client: ClientP): cint {.importc: "jack_release_timebase".}
|
|
|
|
|
|
|
|
# int jack_set_sync_callback (jack_client_t *client, JackSyncCallback sync_callback, void *arg)
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setSyncCallback*(client: ClientP; syncCallback: SyncCallback; arg: pointer): cint {.
|
2023-05-22 19:58:03 +02:00
|
|
|
importc: "jack_set_sync_callback".}
|
|
|
|
|
|
|
|
# int jack_set_sync_timeout (jack_client_t *client, jack_time_t timeout)
|
|
|
|
proc setSyncTimeout*(client: ClientP; timeout: Time): cint {.importc: "jack_set_sync_timeout".}
|
|
|
|
|
|
|
|
# int jack_set_timebase_callback (jack_client_t *client,
|
|
|
|
# int conditional,
|
|
|
|
# JackTimebaseCallback timebase_callback,
|
|
|
|
# void *arg)
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setTimebaseCallback*(client: ClientP; conditional: cint; timebaseCallback: TimebaseCallback;
|
2023-05-22 19:58:03 +02:00
|
|
|
arg: pointer): cint {.
|
|
|
|
importc: "jack_set_timebase_callback".}
|
|
|
|
|
|
|
|
# int jack_transport_locate (jack_client_t *client, jack_nframes_t frame)
|
|
|
|
proc transportLocate*(client: ClientP; frame: NFrames): cint {.importc: "jack_transport_locate".}
|
|
|
|
|
|
|
|
# jack_transport_state_t jack_transport_query (const jack_client_t *client, jack_position_t *pos)
|
|
|
|
proc transportQuery*(client: ClientP; pos: PositionP): TransportState {.importc: "jack_transport_query".}
|
|
|
|
|
|
|
|
# jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client)
|
|
|
|
proc getCurrentTransportFrame*(client: ClientP): NFrames {.importc: "jack_get_current_transport_frame".}
|
|
|
|
|
|
|
|
# int jack_transport_reposition (jack_client_t *client, const jack_position_t *pos)
|
|
|
|
proc transportReposition*(client: ClientP; pos: PositionP): cint {.importc: "jack_transport_reposition".}
|
|
|
|
|
|
|
|
# void jack_transport_start (jack_client_t *client)
|
|
|
|
proc transportStart*(client: ClientP) {.importc: "jack_transport_start".}
|
|
|
|
|
|
|
|
# void jack_transport_stop (jack_client_t *client)
|
|
|
|
proc transportStop*(client: ClientP) {.importc: "jack_transport_stop".}
|
|
|
|
|
|
|
|
#[ DEPRECATED
|
|
|
|
void jack_get_transport_info (jack_client_t *client, jack_transport_info_t *tinfo)
|
|
|
|
void jack_set_transport_info (jack_client_t *client, jack_transport_info_t *tinfo)
|
|
|
|
]#
|
|
|
|
|
2023-05-23 02:25:04 +02:00
|
|
|
# ------------------------------- Metadata --------------------------------
|
|
|
|
|
|
|
|
# int jack_set_property (jack_client_t*, jack_uuid_t subject, const char* key, const char* value, const char* type)
|
|
|
|
proc setProperty*(client: ClientP, subject: Uuid, key, value, `type`: cstring): cint {.importc: "jack_set_property".}
|
|
|
|
|
|
|
|
# int jack_get_property (jack_uuid_t subject, const char* key, char** value, char** type)
|
|
|
|
proc getProperty*(subject: Uuid, key: cstring, value, `type`: ptr cstring): cint {.importc: "jack_get_property".}
|
|
|
|
|
|
|
|
# void jack_free_description (jack_description_t* desc, int free_description_itself)
|
|
|
|
proc freeDescription*(desc: DescriptionP, freeDescriptionItself: cint) {.importc: "jack_free_description".}
|
|
|
|
|
|
|
|
# int jack_get_properties (jack_uuid_t subject, jack_description_t* desc)
|
|
|
|
proc getProperties*(subject: Uuid, desc: DescriptionP): cint {.importc: "jack_get_properties".}
|
|
|
|
|
|
|
|
# int jack_get_all_properties (jack_description_t** descs)
|
|
|
|
proc getAllProperties*(descs: var ptr UncheckedArray[Description]): cint {.importc: "jack_get_all_properties".}
|
|
|
|
|
|
|
|
# int jack_remove_property (jack_client_t* client, jack_uuid_t subject, const char* key)
|
|
|
|
proc removeProperty*(client: ClientP, subject: Uuid): cint {.importc: "jack_remove_property".}
|
|
|
|
|
|
|
|
# int jack_remove_properties (jack_client_t* client, jack_uuid_t subject)
|
|
|
|
proc removeProperties*(client: ClientP, subject: Uuid): cint {.importc: "jack_remove_properties".}
|
|
|
|
|
|
|
|
# int jack_remove_all_properties (jack_client_t* client)
|
|
|
|
proc removeAllProperties*(client: ClientP): cint {.importc: "jack_remove_all_properties".}
|
|
|
|
|
|
|
|
# int jack_set_property_change_callback (jack_client_t* client, JackPropertyChangeCallback callback, void* arg)
|
|
|
|
proc setPropertyChangeCallback*(client: ClientP, callback: PropertyChangeCallback, arg: pointer): cint {.
|
|
|
|
importc: "jack_set_property_change_callback".}
|
|
|
|
|
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
# ---------------------------- Error handling -----------------------------
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setErrorFunction*(errorCallback: ErrorCallback) {.importc: "jack_set_error_function".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
proc setInfoFunction*(infoCallback: InfoCallback) {.importc: "jack_set_info_function".}
|
2022-10-06 04:18:57 +02:00
|
|
|
|
|
|
|
{.pop.}
|
|
|
|
|
2023-05-23 02:27:27 +02:00
|
|
|
|
2022-10-09 09:13:05 +02:00
|
|
|
# --------------------------- Helper functions ----------------------------
|
|
|
|
|
2022-10-06 04:18:57 +02:00
|
|
|
proc getJackStatusErrorString*(status: cint): string =
|
|
|
|
# Get JACK error status as string.
|
2022-10-06 16:44:58 +02:00
|
|
|
if status == Success.ord:
|
2022-10-06 04:18:57 +02:00
|
|
|
return ""
|
|
|
|
|
2022-10-06 16:44:58 +02:00
|
|
|
if status == Failure.ord:
|
2022-10-06 04:18:57 +02:00
|
|
|
# Only include this generic message if no other error status is set
|
2022-10-06 16:44:58 +02:00
|
|
|
result = "Overall operation failed"
|
|
|
|
if (status and InvalidOption.ord) > 0:
|
|
|
|
result.add("\nThe operation contained an invalid and unsupported option")
|
|
|
|
if (status and NameNotUnique.ord) > 0:
|
|
|
|
result.add("\nThe desired client name was not unique")
|
|
|
|
if (status and ServerStarted.ord) > 0:
|
|
|
|
result.add("\nThe JACK server was started as a result of this operation")
|
|
|
|
if (status and ServerFailed.ord) > 0:
|
|
|
|
result.add("\nUnable to connect to the JACK server")
|
|
|
|
if (status and ServerError.ord) > 0:
|
|
|
|
result.add("\nCommunication error with the JACK server")
|
|
|
|
if (status and NoSuchClient.ord) > 0:
|
|
|
|
result.add("\nRequested client does not exist")
|
|
|
|
if (status and LoadFailure.ord) > 0:
|
|
|
|
result.add("\nUnable to load internal client")
|
|
|
|
if (status and InitFailure.ord) > 0:
|
|
|
|
result.add("\nUnable to initialize client")
|
|
|
|
if (status and ShmFailure.ord) > 0:
|
|
|
|
result.add("\nUnable to access shared memory")
|
|
|
|
if (status and VersionError.ord) > 0:
|
|
|
|
result.add("\nClient's protocol version does not match")
|
|
|
|
if (status and BackendError.ord) > 0:
|
|
|
|
result.add("\nBackend Error")
|
|
|
|
if (status and ClientZombie.ord) > 0:
|
|
|
|
result.add("\nClient is being shutdown against its will")
|