|
|
|
@ -77,7 +77,7 @@ type
|
|
|
|
|
ClientZombie = 0x1000
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
JackPortFlags* {.size: sizeof(culong) pure.} = enum
|
|
|
|
|
PortFlags* {.size: sizeof(culong) pure.} = enum
|
|
|
|
|
PortIsInput = 0x01,
|
|
|
|
|
PortIsOutput = 0x02,
|
|
|
|
|
PortIsPhysical = 0x04,
|
|
|
|
@ -85,7 +85,7 @@ type
|
|
|
|
|
PortIsTerminal = 0x10
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
JackLatencyCallbackMode* {.size: sizeof(cint) pure.} = enum
|
|
|
|
|
LatencyCallbackMode* {.size: sizeof(cint) pure.} = enum
|
|
|
|
|
CaptureLatency,
|
|
|
|
|
PlaybackLatency
|
|
|
|
|
|
|
|
|
@ -167,30 +167,53 @@ const
|
|
|
|
|
EXTENDED_TIME_INFO* = true
|
|
|
|
|
JACK_TICK_DOUBLE* = true
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
# Callback function types
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
JackProcessCallback* = proc (nframes: NFrames; arg: pointer): cint {.cdecl.}
|
|
|
|
|
JackThreadCallback* = proc (arg: pointer): pointer {.cdecl.}
|
|
|
|
|
JackThreadInitCallback* = proc (arg: pointer) {.cdecl.}
|
|
|
|
|
JackGraphOrderCallback* = proc (arg: pointer): cint {.cdecl.}
|
|
|
|
|
JackXRunCallback* = proc (arg: pointer): cint {.cdecl.}
|
|
|
|
|
JackBufferSizeCallback* = proc (nframes: NFrames; arg: pointer): cint {.cdecl.}
|
|
|
|
|
JackSampleRateCallback* = proc (nframes: NFrames; arg: pointer): cint {.cdecl.}
|
|
|
|
|
JackPortRegistrationCallback* = proc (port: PortId; flag: cint; arg: pointer) {.cdecl.}
|
|
|
|
|
JackClientRegistrationCallback* = proc (name: cstring; flag: cint; arg: pointer) {.cdecl.}
|
|
|
|
|
JackPortConnectCallback* = proc (portA: PortId; portB: PortId; connect: cint; arg: pointer) {.cdecl.}
|
|
|
|
|
JackPortRenameCallback* = proc (port: PortId; oldName: cstring; newName: cstring; arg: pointer) {.cdecl.}
|
|
|
|
|
JackFreewheelCallback* = proc (starting: cint; arg: pointer) {.cdecl.}
|
|
|
|
|
JackShutdownCallback* = proc (arg: pointer) {.cdecl.}
|
|
|
|
|
JackInfoShutdownCallback* = proc (code: JackStatus; reason: cstring; arg: pointer) {.cdecl.}
|
|
|
|
|
JackLatencyCallback* = proc (mode: JackLatencyCallbackMode; arg: pointer) {.cdecl.}
|
|
|
|
|
JackInfoCallback* = proc (msg: cstring) {.cdecl.}
|
|
|
|
|
JackErrorCallback* = proc (msg: cstring) {.cdecl.}
|
|
|
|
|
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.}
|
|
|
|
|
|
|
|
|
|
JackSyncCallback* = proc (state: TransportState; pos: ptr Position; arg: pointer): cint {.cdecl.}
|
|
|
|
|
JackTimebaseCallback* = proc (state: TransportState; nframes: NFrames; pos: ptr Position; newPos: cint;
|
|
|
|
|
arg: pointer) {.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.}
|
|
|
|
|
|
|
|
|
|
PropertyChangeCallback* = proc (subject: Uuid, key: cstring, change: PropertyChange, arg: pointer) {.cdecl.}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ----------------------------- Version info ------------------------------
|
|
|
|
@ -273,51 +296,51 @@ proc cycleSignal*(client: ClientP; status: cint) {.importc: "jack_cycle_signal".
|
|
|
|
|
|
|
|
|
|
# ------------------------------- Callbacks -------------------------------
|
|
|
|
|
|
|
|
|
|
proc setProcessThread*(client: ClientP; threadCallback: JackThreadCallback; arg: pointer): cint {.
|
|
|
|
|
proc setProcessThread*(client: ClientP; threadCallback: ThreadCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_process_thread".}
|
|
|
|
|
|
|
|
|
|
proc setThreadInitCallback*(client: ClientP; threadInitCallback: JackThreadInitCallback; arg: pointer): cint {.
|
|
|
|
|
proc setThreadInitCallback*(client: ClientP; threadInitCallback: ThreadInitCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_thread_init_callback".}
|
|
|
|
|
|
|
|
|
|
proc onShutdown*(client: ClientP; shutdownCallback: JackShutdownCallback; arg: pointer) {.
|
|
|
|
|
proc onShutdown*(client: ClientP; shutdownCallback: ShutdownCallback; arg: pointer) {.
|
|
|
|
|
importc: "jack_on_shutdown".}
|
|
|
|
|
|
|
|
|
|
proc onInfoShutdown*(client: ClientP; shutdownCallback: JackInfoShutdownCallback; arg: pointer) {.
|
|
|
|
|
proc onInfoShutdown*(client: ClientP; shutdownCallback: InfoShutdownCallback; arg: pointer) {.
|
|
|
|
|
importc: "jack_on_info_shutdown".}
|
|
|
|
|
|
|
|
|
|
proc setProcessCallback*(client: ClientP; processCallback: JackProcessCallback; arg: pointer): cint {.
|
|
|
|
|
proc setProcessCallback*(client: ClientP; processCallback: ProcessCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_process_callback".}
|
|
|
|
|
|
|
|
|
|
proc setFreewheelCallback*(client: ClientP; freewheelCallback: JackFreewheelCallback; arg: pointer): cint {.
|
|
|
|
|
proc setFreewheelCallback*(client: ClientP; freewheelCallback: FreewheelCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_freewheel_callback".}
|
|
|
|
|
|
|
|
|
|
proc setBufferSizeCallback*(client: ClientP; bufsizeCallback: JackBufferSizeCallback; arg: pointer): cint {.
|
|
|
|
|
proc setBufferSizeCallback*(client: ClientP; bufsizeCallback: BufferSizeCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_buffer_size_callback".}
|
|
|
|
|
|
|
|
|
|
proc setSampleRateCallback*(client: ClientP; srateCallback: JackSampleRateCallback; arg: pointer): cint {.
|
|
|
|
|
proc setSampleRateCallback*(client: ClientP; srateCallback: SampleRateCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_sample_rate_callback".}
|
|
|
|
|
|
|
|
|
|
proc setClientRegistrationCallback*(client: ClientP; registrationCallback: JackClientRegistrationCallback;
|
|
|
|
|
proc setClientRegistrationCallback*(client: ClientP; registrationCallback: ClientRegistrationCallback;
|
|
|
|
|
arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_client_registration_callback".}
|
|
|
|
|
|
|
|
|
|
proc setPortRegistrationCallback*(client: ClientP; registrationCallback: JackPortRegistrationCallback;
|
|
|
|
|
proc setPortRegistrationCallback*(client: ClientP; registrationCallback: PortRegistrationCallback;
|
|
|
|
|
arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_port_registration_callback".}
|
|
|
|
|
|
|
|
|
|
proc setPortConnectCallback*(client: ClientP; connectCallback: JackPortConnectCallback; arg: pointer): cint {.
|
|
|
|
|
proc setPortConnectCallback*(client: ClientP; connectCallback: PortConnectCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_port_connect_callback".}
|
|
|
|
|
|
|
|
|
|
proc setPortRenameCallback*(client: ClientP; renameCallback: JackPortRenameCallback; arg: pointer): cint {.
|
|
|
|
|
proc setPortRenameCallback*(client: ClientP; renameCallback: PortRenameCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_port_rename_callback".}
|
|
|
|
|
|
|
|
|
|
proc setGraphOrderCallback*(client: ClientP; graphCallback: JackGraphOrderCallback; a3: pointer): cint {.
|
|
|
|
|
proc setGraphOrderCallback*(client: ClientP; graphCallback: GraphOrderCallback; a3: pointer): cint {.
|
|
|
|
|
importc: "jack_set_graph_order_callback".}
|
|
|
|
|
|
|
|
|
|
proc setXrunCallback*(client: ClientP; xrunCallback: JackXRunCallback; arg: pointer): cint {.
|
|
|
|
|
proc setXrunCallback*(client: ClientP; xrunCallback: XRunCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_xrun_callback".}
|
|
|
|
|
|
|
|
|
|
proc setLatencyCallback*(client: ClientP; latencyCallback: JackLatencyCallback; arg: pointer): cint {.
|
|
|
|
|
proc setLatencyCallback*(client: ClientP; latencyCallback: LatencyCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_latency_callback".}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -566,7 +589,7 @@ proc getTime*(): Time {.importc: "jack_get_time".}
|
|
|
|
|
proc releaseTimebase*(client: ClientP): cint {.importc: "jack_release_timebase".}
|
|
|
|
|
|
|
|
|
|
# int jack_set_sync_callback (jack_client_t *client, JackSyncCallback sync_callback, void *arg)
|
|
|
|
|
proc setSyncCallback*(client: ClientP; syncCallback: JackSyncCallback; arg: pointer): cint {.
|
|
|
|
|
proc setSyncCallback*(client: ClientP; syncCallback: SyncCallback; arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_sync_callback".}
|
|
|
|
|
|
|
|
|
|
# int jack_set_sync_timeout (jack_client_t *client, jack_time_t timeout)
|
|
|
|
@ -576,7 +599,7 @@ proc setSyncTimeout*(client: ClientP; timeout: Time): cint {.importc: "jack_set_
|
|
|
|
|
# int conditional,
|
|
|
|
|
# JackTimebaseCallback timebase_callback,
|
|
|
|
|
# void *arg)
|
|
|
|
|
proc setTimebaseCallback*(client: ClientP; conditional: cint; timebaseCallback: JackTimebaseCallback;
|
|
|
|
|
proc setTimebaseCallback*(client: ClientP; conditional: cint; timebaseCallback: TimebaseCallback;
|
|
|
|
|
arg: pointer): cint {.
|
|
|
|
|
importc: "jack_set_timebase_callback".}
|
|
|
|
|
|
|
|
|
@ -603,14 +626,46 @@ void jack_get_transport_info (jack_client_t *client, jack_transport_info_t *tinf
|
|
|
|
|
void jack_set_transport_info (jack_client_t *client, jack_transport_info_t *tinfo)
|
|
|
|
|
]#
|
|
|
|
|
|
|
|
|
|
# ------------------------------- 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".}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------- Error handling -----------------------------
|
|
|
|
|
|
|
|
|
|
proc setErrorFunction*(errorCallback: JackErrorCallback) {.importc: "jack_set_error_function".}
|
|
|
|
|
proc setErrorFunction*(errorCallback: ErrorCallback) {.importc: "jack_set_error_function".}
|
|
|
|
|
|
|
|
|
|
proc setInfoFunction*(infoCallback: JackInfoCallback) {.importc: "jack_set_info_function".}
|
|
|
|
|
proc setInfoFunction*(infoCallback: InfoCallback) {.importc: "jack_set_info_function".}
|
|
|
|
|
|
|
|
|
|
{.pop.}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --------------------------- Helper functions ----------------------------
|
|
|
|
|
|
|
|
|
|
proc getJackStatusErrorString*(status: cint): string =
|
|
|
|
|