Compare commits

..

No commits in common. "472f67ffa5ea58711adb14c6ff1a61602ea8a283" and "ad7014da09cc970282525c94481ef19d88c6a41d" have entirely different histories.

15 changed files with 257 additions and 281 deletions

View File

@ -1,19 +1,17 @@
# jacket # jacket
A [Nim] wrapper for the JACK Audio Connection Kit ([JACK]) client side [C API] A [Nim] wrapper for the [JACK] client side [C API] aka *libjack*.
aka **libjack**.
## Project status ## Project status
This software is in *beta status*. This software is in *beta status*.
The majority of JACK client API functions have been wrapped and are functional The majority of JACK client APIs have been wrapped and are functional (see
(see[examples]), but some API parts (e.g. threading) still need wrapping. [examples]), but some APIs (e.g. threading) still need wrapping. Others, like
Others, like the server control or the deprecated session API, will probably the server control or the deprecated session API, will probably not be covered
not be covered by these bindings. While this project is in beta stage, symbol by these bindings. While this project is in beta stage, symbol names may still
names may still be changed and things moved around before the first stable be changed and things moved around before the first stable release.
release.
## Installation ## Installation
@ -21,7 +19,7 @@ release.
* Clone this repository. * Clone this repository.
* Change into the `jacket` directory. * Change into the `jacket` directory.
* Run [`nimble install`] (or `nimble develop`). * Run [`nimble install`] (or `nimble develop`).
* Build the [examples] with `nimble examples`. * Run the [examples] with `nim compile --run examples/<example>.nim`.
(Some examples need `--threads:on` with Nim < 2.0). (Some examples need `--threads:on` with Nim < 2.0).
@ -29,9 +27,10 @@ release.
## Usage ## Usage
Here is a very minimal JACK client application, which just passes audio through Here is a very minimal JACK client application, which just passes audio through
from its single input port to its output port. Any error checking and handling from its single input port to its output port.
has been omitted for brevity's sake. See the files in the [examples] directory
for more robust example code. Any error checking and handling has been omitted for brevity's sake. See the
files in the [examples] directory for more robust example code.
```nim ```nim
import std/os import std/os
@ -39,11 +38,11 @@ import system/ansi_c
import jacket import jacket
var var
jackClient: ClientP
status: cint status: cint
exitSignalled = false exitSignalled: bool = false
inpPort, outPort: Port inpPort, outPort: PortP
type JackBufferP = ptr UncheckedArray[DefaultAudioSample]
type SampleBuffer = ptr UncheckedArray[DefaultAudioSample]
proc signalCb(sig: cint) {.noconv.} = proc signalCb(sig: cint) {.noconv.} =
exitSignalled = true exitSignalled = true
@ -52,30 +51,30 @@ proc shutdownCb(arg: pointer = nil) {.cdecl.} =
exitSignalled = true exitSignalled = true
proc processCb(nFrames: NFrames, arg: pointer): cint {.cdecl.} = proc processCb(nFrames: NFrames, arg: pointer): cint {.cdecl.} =
let inpbuf = cast[SampleBuffer](portGetBuffer(inpPort, nFrames)) var inpbuf = cast[JackBufferP](portGetBuffer(inpPort, nFrames))
let outbuf = cast[SampleBuffer](portGetBuffer(outPort, nFrames)) var outbuf = cast[JackBufferP](portGetBuffer(outPort, nFrames))
# copy samples from input to output buffer # copy samples from input to output buffer
for i in 0 ..< nFrames: for i in 0 ..< nFrames:
outbuf[i] = inpbuf[i] outbuf[i] = inpbuf[i]
# Create JACK Client ptr # Create JACK Client ptr
var jackClient = clientOpen("passthru", NullOption, status.addr) jackClient = clientOpen("passthru", NullOption, status.addr)
# Register audio input and output ports # Register audio input and output ports
inpPort = jackClient.portRegister("in_1", JackDefaultAudioType, PortIsInput, 0) inpPort = jackClient.portRegister("in_1", JACK_DEFAULT_AUDIO_TYPE, PortIsInput, 0)
outPort = jackClient.portRegister("out_1", JackDefaultAudioType, PortIsOutput, 0) outPort = jackClient.portRegister("out_1", JACK_DEFAULT_AUDIO_TYPE, PortIsOutput, 0)
# Set JACK callbacks # Set JACK callbacks
jackClient.onShutdown(shutdownCb) jackClient.onShutdown(shutdownCb)
jackClient.setProcessCallback(processCb, nil) discard jackClient.setProcessCallback(processCb, nil)
# Handle POSIX signals # Handle POSIX signals
c_signal(SIGINT, signalCb) c_signal(SIGINT, signalCb)
c_signal(SIGTERM, signalCb) c_signal(SIGTERM, signalCb)
# Activate JACK client ... # Activate JACK client ...
jackClient.activate() discard jackClient.activate()
while not exitSignalled: while not exitSignalled:
sleep(50) sleep(50)
jackClient.clientClose() discard jackClient.clientClose()
``` ```
@ -86,7 +85,7 @@ This software is released under the *MIT License*. See the file
Please note that the JACK client library (libjack), which this project wraps, Please note that the JACK client library (libjack), which this project wraps,
is licensed under the [LGPL-2.1]. This wrapper does not statically or is licensed under the [LGPL-2.1]. This wrapper does not statically or
dynamically link to libjack at build time, but only loads it via `dynlib` at dynamically link to libjack, but only loads it via the dynamic linker at
run-time. run-time.
Software using this wrapper is, in the opinion of its author, not considered a Software using this wrapper is, in the opinion of its author, not considered a

View File

@ -26,4 +26,4 @@ echo("DSP load: ", jclient.cpuLoad, "%")
echo("Server time: ", getTime()) echo("Server time: ", getTime())
echo("Client name: ", jclient.getClientName) echo("Client name: ", jclient.getClientName)
jclient.clientClose() discard jclient.clientClose

View File

@ -3,7 +3,7 @@ import jacket
var var
status: cint status: cint
descs: ptr UncheckedArray[DescriptionT] descs: ptr UncheckedArray[Description]
var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug) var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
@ -40,4 +40,4 @@ if numDescs != -1:
else: else:
error "Could not get properties!" error "Could not get properties!"
jclient.clientClose() discard jclient.clientClose

View File

@ -2,9 +2,9 @@ import std/[logging, os, strutils]
import signal import signal
import jacket import jacket
var jclient: Client var jclient: ClientP
var event: MidiEventT var event: MidiEvent
var midiPort: Port var midiPort: PortP
var status: cint var status: cint
var exitSignalled: bool = false var exitSignalled: bool = false
var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug) var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
@ -13,8 +13,8 @@ var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
proc cleanup() = proc cleanup() =
debug "Cleaning up..." debug "Cleaning up..."
if jclient != nil: if jclient != nil:
jclient.deactivate() discard jclient.deactivate()
jclient.clientClose() discard jclient.clientClose()
jclient = nil jclient = nil
proc errorCb(msg: cstring) {.cdecl.} = proc errorCb(msg: cstring) {.cdecl.} =
@ -30,7 +30,7 @@ proc shutdownCb(arg: pointer = nil) {.cdecl.} =
warn "JACK server has shut down." warn "JACK server has shut down."
exitSignalled = true exitSignalled = true
proc printMidiEvent(event: var MidiEventT) = proc printMidiEvent(event: var MidiEvent) =
if event.size <= 3: if event.size <= 3:
for i in 0..<event.size: for i in 0..<event.size:
stdout.write(event.buffer[i].toHex) stdout.write(event.buffer[i].toHex)
@ -74,7 +74,7 @@ proc main() =
jclient.onShutdown(shutdownCb) jclient.onShutdown(shutdownCb)
# Create output port # Create output port
midiPort = jclient.portRegister("midi_in", JackDefaultMidiType, PortIsInput, 0) midiPort = jclient.portRegister("midi_in", JACK_DEFAULT_MIDI_TYPE, PortIsInput, 0)
# Activate JACK client ... # Activate JACK client ...
if jclient.activate() == 0: if jclient.activate() == 0:

View File

@ -5,10 +5,10 @@ import signal
import jacket import jacket
var var
jclient: Client jclient: ClientP
event: MidiEventT event: MidiEvent
midiPort: Port midiPort: PortP
rb: Ringbuffer rb: RingbufferP
midiEventPrinter: Thread[void] midiEventPrinter: Thread[void]
status: cint status: cint
exitSignalled: bool = false exitSignalled: bool = false
@ -27,7 +27,7 @@ proc cleanup() =
if jclient != nil: if jclient != nil:
debug "Deactivating JACK client..." debug "Deactivating JACK client..."
jclient.deactivate() discard jclient.deactivate()
if midiEventPrinter.running: if midiEventPrinter.running:
debug "Stopping MIDI event printer thread..." debug "Stopping MIDI event printer thread..."
@ -42,7 +42,7 @@ proc cleanup() =
if jclient != nil: if jclient != nil:
debug "Closing JACK client..." debug "Closing JACK client..."
jclient.clientClose() discard jclient.clientClose()
jclient = nil jclient = nil
debug fmt"Buffer overruns: {overruns}" debug fmt"Buffer overruns: {overruns}"
@ -68,7 +68,7 @@ proc midiEventPrinterProc() {.thread.} =
while true: while true:
while not exitLoop and ringbufferReadSpace(rb) >= 4: while not exitLoop and ringbufferReadSpace(rb) >= 4:
discard ringbufferRead(rb, cast[cstring](recvBuf.addr), 4) var read = cast[int](ringbufferRead(rb, cast[cstring](recvBuf.addr), 4))
if recvBuf[0] <= 3: if recvBuf[0] <= 3:
for i in 0..<recvBuf[0].int: for i in 0..<recvBuf[0].int:
@ -138,7 +138,7 @@ proc main() =
jclient.onShutdown(shutdownCb) jclient.onShutdown(shutdownCb)
# Create output port # Create output port
midiPort = jclient.portRegister("midi_in", JackDefaultMidiType, PortIsInput, 0) midiPort = jclient.portRegister("midi_in", JACK_DEFAULT_MIDI_TYPE, PortIsInput, 0)
# Activate JACK client ... # Activate JACK client ...
if jclient.activate() == 0: if jclient.activate() == 0:

View File

@ -3,9 +3,10 @@ import signal
import jacket import jacket
var var
jclient: Client jclient: ClientP
midiPort: Port event: MidiEvent
midiEventChan: Channel[MidiEventT] midiPort: PortP
midiEventChan: Channel[MidiEvent]
midiEventPrinter: Thread[void] midiEventPrinter: Thread[void]
status: cint status: cint
exitSignalled: bool = false exitSignalled: bool = false
@ -18,13 +19,13 @@ proc cleanup() =
if jclient != nil: if jclient != nil:
debug "Deactivating JACK client..." debug "Deactivating JACK client..."
jclient.deactivate() discard jclient.deactivate()
if midiEventPrinter.running: if midiEventPrinter.running:
debug "Stopping MIDI event printer thread..." debug "Stopping MIDI event printer thread..."
# Receiving an invalid event causes receiving thread to wake up and # Receiving an invalid event causes receiving thread to wake up and
# break its endless loop # break its endless loop
let event = MidiEventT(size: 0) event.size = 0
midiEventChan.send(event) midiEventChan.send(event)
midiEventPrinter.joinThread() midiEventPrinter.joinThread()
@ -34,7 +35,7 @@ proc cleanup() =
if jclient != nil: if jclient != nil:
debug "Closing JACK client..." debug "Closing JACK client..."
jclient.clientClose() discard jclient.clientClose()
jclient = nil jclient = nil
debug "Bye." debug "Bye."
@ -53,8 +54,10 @@ proc shutdownCb(arg: pointer = nil) {.cdecl.} =
exitSignalled = true exitSignalled = true
proc midiEventPrinterProc() = proc midiEventPrinterProc() =
var event: MidiEvent
while true: while true:
let event = midiEventChan.recv() event = midiEventChan.recv()
if event.size == 0: if event.size == 0:
break break
@ -67,7 +70,6 @@ proc midiEventPrinterProc() =
stdout.flushFile() stdout.flushFile()
proc processCb*(nFrames: NFrames, arg: pointer): cint {.cdecl.} = proc processCb*(nFrames: NFrames, arg: pointer): cint {.cdecl.} =
var event: MidiEventT
let inbuf = portGetBuffer(midiPort, nFrames) let inbuf = portGetBuffer(midiPort, nFrames)
let count = midiGetEventCount(inbuf) let count = midiGetEventCount(inbuf)
@ -108,7 +110,7 @@ proc main() =
jclient.onShutdown(shutdownCb) jclient.onShutdown(shutdownCb)
# Create output port # Create output port
midiPort = jclient.portRegister("midi_in", JackDefaultMidiType, PortIsInput, 0) midiPort = jclient.portRegister("midi_in", JACK_DEFAULT_MIDI_TYPE, PortIsInput, 0)
# Activate JACK client ... # Activate JACK client ...
if jclient.activate() == 0: if jclient.activate() == 0:

View File

@ -10,9 +10,9 @@ import signal
import jacket import jacket
var var
jclient: Client jclient: ClientP
midiPort: Port midiPort: PortP
midiEventChan: Chan[MidiEventT] midiEventChan: Chan[MidiEvent]
midiEventPrinter: Thread[void] midiEventPrinter: Thread[void]
status: cint status: cint
exitSignalled: bool = false exitSignalled: bool = false
@ -25,20 +25,20 @@ proc cleanup() =
if jclient != nil: if jclient != nil:
debug "Deactivating JACK client..." debug "Deactivating JACK client..."
jclient.deactivate() discard jclient.deactivate()
if midiEventPrinter.running: if midiEventPrinter.running:
debug "Stopping MIDI event printer thread..." debug "Stopping MIDI event printer thread..."
# Receiving an invalid event causes receiving thread to wake up and # Receiving an invalid event causes receiving thread to wake up and
# break its endless loop # break its endless loop
let event = MidiEventT(size: 0) let event = MidiEvent(size: 0)
discard midiEventChan.trySend(event) discard midiEventChan.trySend(event)
midiEventPrinter.joinThread() midiEventPrinter.joinThread()
if jclient != nil: if jclient != nil:
debug "Closing JACK client..." debug "Closing JACK client..."
jclient.clientClose() discard jclient.clientClose()
jclient = nil jclient = nil
debug "Bye." debug "Bye."
@ -57,7 +57,7 @@ proc shutdownCb(arg: pointer = nil) {.cdecl.} =
exitSignalled = true exitSignalled = true
proc midiEventPrinterProc() = proc midiEventPrinterProc() =
var event: MidiEventT var event: MidiEvent
while true: while true:
midiEventChan.recv(event) midiEventChan.recv(event)
@ -72,7 +72,7 @@ proc midiEventPrinterProc() =
stdout.flushFile() stdout.flushFile()
proc processCb*(nFrames: NFrames, arg: pointer): cint {.cdecl.} = proc processCb*(nFrames: NFrames, arg: pointer): cint {.cdecl.} =
var event: MidiEventT var event: MidiEvent
let inbuf = portGetBuffer(midiPort, nFrames) let inbuf = portGetBuffer(midiPort, nFrames)
let count = midiGetEventCount(inbuf) let count = midiGetEventCount(inbuf)
@ -101,7 +101,7 @@ proc main() =
# Set up a thread, which receives MIDI events from process callback via a # Set up a thread, which receives MIDI events from process callback via a
# Channel and prints them without danger of blocking the process callback # Channel and prints them without danger of blocking the process callback
midiEventChan = newChan[MidiEventT]() midiEventChan = newChan[MidiEvent]()
createThread(midiEventPrinter, midiEventPrinterProc) createThread(midiEventPrinter, midiEventPrinterProc)
# Register JACK callbacks # Register JACK callbacks

View File

@ -6,10 +6,10 @@ import signal
import jacket import jacket
var var
jclient: Client jclient: ClientP
status: cint status: cint
exitSignalled: bool = false exitSignalled: bool = false
inpPort, outPort: Port inpPort, outPort: PortP
log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug) log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
type JackBufferP = ptr UncheckedArray[DefaultAudioSample] type JackBufferP = ptr UncheckedArray[DefaultAudioSample]
@ -23,8 +23,8 @@ proc errorCb(msg: cstring) {.cdecl.} =
proc cleanup(sig: cint = 0) = proc cleanup(sig: cint = 0) =
debug "Cleaning up..." debug "Cleaning up..."
if jclient != nil: if jclient != nil:
jclient.deactivate() discard jclient.deactivate()
jclient.clientClose() discard jclient.clientClose()
jclient = nil jclient = nil
proc signalCb(sig: cint) {.noconv.} = proc signalCb(sig: cint) {.noconv.} =
@ -55,8 +55,8 @@ if jclient == nil:
quit QuitFailure quit QuitFailure
# Register audio input and output ports # Register audio input and output ports
inpPort = jclient.portRegister("in_1", JackDefaultAudioType, PortIsInput, 0) inpPort = jclient.portRegister("in_1", JACK_DEFAULT_AUDIO_TYPE, PortIsInput, 0)
outPort = jclient.portRegister("out_1", JackDefaultAudioType, PortIsOutput, 0) outPort = jclient.portRegister("out_1", JACK_DEFAULT_AUDIO_TYPE, PortIsOutput, 0)
# Register JACK callbacks # Register JACK callbacks
jclient.onShutdown(shutdownCb) jclient.onShutdown(shutdownCb)

View File

@ -2,7 +2,7 @@ import std/[logging, os]
import jacket import jacket
import signal import signal
var jclient: Client var jclient: ClientP
var status: cint var status: cint
var exitSignalled: bool = false var exitSignalled: bool = false
var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug) var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
@ -10,8 +10,8 @@ var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
proc cleanup(sig: cint = 0) = proc cleanup(sig: cint = 0) =
debug "Cleaning up..." debug "Cleaning up..."
if jclient != nil: if jclient != nil:
jclient.deactivate() discard jclient.deactivate()
jclient.clientClose() discard jclient.clientClose()
jclient = nil jclient = nil
proc errorCb(msg: cstring) {.cdecl.} = proc errorCb(msg: cstring) {.cdecl.} =
@ -57,8 +57,8 @@ when defined(windows):
else: else:
setSignalProc(signalCb, SIGABRT, SIGHUP, SIGINT, SIGQUIT, SIGTERM) setSignalProc(signalCb, SIGABRT, SIGHUP, SIGINT, SIGQUIT, SIGTERM)
discard jclient.portRegister("in_1", JackDefaultAudioType, PortIsInput, 0) discard jclient.portRegister("in_1", JACK_DEFAULT_AUDIO_TYPE, PortIsInput, 0)
discard jclient.portRegister("out_1", JackDefaultAudioType, PortIsOutput, 0) discard jclient.portRegister("out_1", JACK_DEFAULT_AUDIO_TYPE, PortIsOutput, 0)
if jclient.setPortConnectCallback(portConnected) != 0: if jclient.setPortConnectCallback(portConnected) != 0:
error "Error: could not set JACK port connection callback." error "Error: could not set JACK port connection callback."

View File

@ -2,7 +2,7 @@ import std/[logging, os]
import signal import signal
import jacket import jacket
var jclient: Client var jclient: ClientP
var status: cint var status: cint
var exitSignalled: bool = false var exitSignalled: bool = false
var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug) var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
@ -10,7 +10,7 @@ var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
proc cleanup(sig: cint = 0) = proc cleanup(sig: cint = 0) =
debug "Cleaning up..." debug "Cleaning up..."
if jclient != nil: if jclient != nil:
jclient.clientClose() discard jclient.clientClose()
jclient = nil jclient = nil
proc errorCb(msg: cstring) {.cdecl.} = proc errorCb(msg: cstring) {.cdecl.} =
@ -40,8 +40,8 @@ when defined(windows):
else: else:
setSignalProc(signalCb, SIGABRT, SIGHUP, SIGINT, SIGQUIT, SIGTERM) setSignalProc(signalCb, SIGABRT, SIGHUP, SIGINT, SIGQUIT, SIGTERM)
discard jclient.portRegister("in_1", JackDefaultAudioType, PortIsInput, 0) discard jclient.portRegister("in_1", JACK_DEFAULT_AUDIO_TYPE, PortIsInput, 0)
discard jclient.portRegister("out_1", JackDefaultAudioType, PortIsOutput, 0) discard jclient.portRegister("out_1", JACK_DEFAULT_AUDIO_TYPE, PortIsOutput, 0)
jclient.onShutdown(shutdownCb) jclient.onShutdown(shutdownCb)

View File

@ -9,35 +9,35 @@ proc main() =
let size = 32 let size = 32
var read, written: int var read, written: int
var data = [0x64.byte, 0x65, 0x61, 0x64, 0x62, 0x65, 0x65, 0x66] var data = [0x64.uint8, 0x65, 0x61, 0x64, 0x62, 0x65, 0x65, 0x66]
var recvBuf: array[8, byte] var recvBuf: array[8, uint8]
let rb = ringbufferCreate(size.csize_t) let rb = ringbufferCreate(size.csize_t)
debug fmt"Created ringbuffer of {size} bytes size." debug fmt"Created ringbuffer of {size} bytes size."
doAssert ringbufferReadSpace(rb) == 0 doAssert ringbufferReadSpace(rb) == 0
written = ringbufferWrite(rb, cast[cstring](data.addr), 4).int written = cast[int](ringbufferWrite(rb, cast[cstring](data.addr), 4))
doAssert written == 4 doAssert written == 4
debug fmt"Written {written} bytes to ringbuffer." debug fmt"Written {written} bytes to ringbuffer."
doAssert ringbufferReadSpace(rb) == 4 doAssert ringbufferReadSpace(rb) == 4
written = ringbufferWrite(rb, cast[cstring](data[4].addr), 4).int written = cast[int](ringbufferWrite(rb, cast[cstring](data[4].addr), 4))
doAssert written == 4 doAssert written == 4
debug fmt"Written {written} bytes to ringbuffer." debug fmt"Written {written} bytes to ringbuffer."
doAssert ringbufferReadSpace(rb) == 8 doAssert ringbufferReadSpace(rb) == 8
read = ringbufferRead(rb, cast[cstring](recvBuf.addr), 4).int read = cast[int](ringbufferRead(rb, cast[cstring](recvBuf.addr), 4))
doAssert read == 4 doAssert read == 4
debug fmt"Read {read} bytes from ringbuffer. Receive buffer: {recvBuf}" debug fmt"Read {read} bytes from ringbuffer into receive buffer: {recvBuf}"
doAssert ringbufferReadSpace(rb) == 4 doAssert ringbufferReadSpace(rb) == 4
read = ringbufferRead(rb, cast[cstring](recvBuf[4].addr), 4).int read = cast[int](ringbufferRead(rb, cast[cstring](recvBuf[4].addr), 4))
doAssert read == 4 doAssert read == 4
debug fmt"Read {read} bytes from ringbuffer. Receive buffer: {recvBuf}" debug fmt"Read {read} bytes from ringbuffer into receive buffer: {recvBuf}"
doAssert ringbufferReadSpace(rb) == 0 doAssert ringbufferReadSpace(rb) == 0

View File

@ -2,8 +2,8 @@ import std/[logging, math, os]
import signal import signal
import jacket import jacket
var jclient: Client var jclient: ClientP
var outPort: Port var outPort: PortP
var status: cint var status: cint
var exitSignalled: bool = false var exitSignalled: bool = false
var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug) var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
@ -44,8 +44,8 @@ proc tick(osc: SineOscP): float =
proc cleanup() = proc cleanup() =
debug "Cleaning up..." debug "Cleaning up..."
if jclient != nil: if jclient != nil:
jclient.deactivate() discard jclient.deactivate()
jclient.clientClose() discard jclient.clientClose()
jclient = nil jclient = nil
proc errorCb(msg: cstring) {.cdecl.} = proc errorCb(msg: cstring) {.cdecl.} =
@ -101,7 +101,7 @@ if jclient.setProcessCallback(processCb, osc.addr) != 0:
jclient.onShutdown(shutdownCb) jclient.onShutdown(shutdownCb)
# Create output port # Create output port
outPort = jclient.portRegister("out_1", JackDefaultAudioType, PortIsOutput, 0) outPort = jclient.portRegister("out_1", JACK_DEFAULT_AUDIO_TYPE, PortIsOutput, 0)
# Activate JACK client ... # Activate JACK client ...
if jclient.activate() == 0: if jclient.activate() == 0:

View File

@ -2,9 +2,9 @@ import std/[logging, strformat]
import jacket import jacket
var var
jclient: Client jclient: ClientP
status: cint status: cint
pos: PositionT pos: Position
transportState: TransportState transportState: TransportState
var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug) var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
@ -51,4 +51,4 @@ of TransportStarting:
else: else:
echo "Unknown JACK transport state." echo "Unknown JACK transport state."
jclient.clientClose() discard jclient.clientClose

View File

@ -1,8 +1,8 @@
# Package # Package
version = "0.2.0" version = "0.1.0"
author = "Christopher Arndt" author = "Christopher Arndt"
description = "A Nim wrapper for the JACK Audio Connection Kit client-side C API aka libjack" description = "A Nim wrapper for the JACK client-side C API aka libjack"
license = "MIT" license = "MIT"
srcDir = "src" srcDir = "src"
@ -10,28 +10,3 @@ srcDir = "src"
# Dependencies # Dependencies
requires "nim >= 1.6.0" requires "nim >= 1.6.0"
let examples = @[
"info",
"list_all_properties",
"midi_print",
"midi_print_ringbuffer",
"midi_print_thread",
"midi_print_threading",
"passthru",
"port_connect_cb",
"port_register",
"ringbuffer",
"sine",
"transport_query",
]
task examples, "Build examples (release)":
for example in examples:
echo "Building example 'jacket_" & example & "'..."
selfExec("compile -d:release -d:strip examples/jacket_" & example & ".nim")
task examples_debug, "Build examples (debug)":
for example in examples:
echo "Building example 'jacket_" & example & "' (debug)..."
selfExec("compile examples/jacket_" & example & ".nim")

View File

@ -1,5 +1,6 @@
# jacket.nim # jacket.nim
# Possible names/install locations of libjack, according to: # Possible names/install locations of libjack, according to:
# https://github.com/x42/weakjack/blob/master/weak_libjack.c#L108 # https://github.com/x42/weakjack/blob/master/weak_libjack.c#L108
proc getJackLibName: string = proc getJackLibName: string =
@ -18,10 +19,11 @@ proc getJackLibName: string =
# ------------------------------ Constants -------------------------------- # ------------------------------ Constants --------------------------------
const const
JackMaxFrames* = (4294967295'i64) JACK_MAX_FRAMES* = (4294967295'i64)
JackLoadInitLimit* = 1024 JACK_LOAD_INIT_LIMIT* = 1024
JackDefaultAudioType* = "32 bit float mono audio" JACK_DEFAULT_AUDIO_TYPE* = "32 bit float mono audio"
JackDefaultMidiType* = "8 bit raw midi" JACK_DEFAULT_MIDI_TYPE* = "8 bit raw midi"
# ----------------------------- Custom Types ------------------------------ # ----------------------------- Custom Types ------------------------------
@ -35,18 +37,18 @@ type
DefaultAudioSample* = cfloat DefaultAudioSample* = cfloat
type type
ClientT = distinct object Client = distinct object
Client* = ptr ClientT ClientP* = ptr Client
PortT = distinct object Port = distinct object
Port* = ptr PortT PortP* = ptr Port
type type
MidiData* = uint8 MidiData* = uint8
MidiEventT* = object MidiEvent* = object
time*: NFrames time*: NFrames
size*: csize_t size*: csize_t
buffer*: ptr UncheckedArray[MidiData] buffer*: ptr UncheckedArray[MidiData]
MidiEvent* = ptr MidiEventT MidiEventP* = ptr MidiEvent
type type
JackOptions* {.size: sizeof(cint) pure.} = enum JackOptions* {.size: sizeof(cint) pure.} = enum
@ -111,7 +113,7 @@ type
TransportNetStarting = 4 TransportNetStarting = 4
type type
PositionT* = object Position* = object
unique1*: uint64 unique1*: uint64
usecs*: Time usecs*: Time
frameRate*: NFrames frameRate*: NFrames
@ -133,7 +135,7 @@ type
tickDouble*: cdouble tickDouble*: cdouble
padding*: array[5, int32] padding*: array[5, int32]
unique2*: uint64 unique2*: uint64
Position* = ptr PositionT PositionP* = ptr Position
#[ DEPRECATED #[ DEPRECATED
typedef enum { typedef enum {
@ -166,20 +168,20 @@ typedef struct {
]# ]#
const const
JackPositionMask* = (PositionBBT.ord or PositionTimecode.ord) JACK_POSITION_MASK* = (PositionBBT.ord or PositionTimecode.ord)
ExtendedTimeInfo* = true EXTENDED_TIME_INFO* = true
JackTickDouble* = true JACK_TICK_DOUBLE* = true
# Ringbuffer # Ringbuffer
type type
RingbufferDataT* = object RingbufferData* = object
buf*: ptr char buf*: ptr char
len*: csize_t len*: csize_t
RingbufferData* = ptr RingbufferDataT RingbufferDataP* = ptr RingbufferData
RingbufferT = distinct object Ringbuffer = distinct object
Ringbuffer* = ptr RingbufferT RingbufferP* = ptr Ringbuffer
# Metadata # Metadata
@ -194,13 +196,13 @@ type
PropertyChanged, PropertyChanged,
PropertyDeleted PropertyDeleted
DescriptionT* = object Description* = object
subject*: Uuid subject*: Uuid
property_cnt*: uint32 property_cnt*: uint32
properties*: ptr UncheckedArray[Property] properties*: ptr UncheckedArray[Property]
property_size*: uint32 property_size*: uint32
Description* = ptr DescriptionT DescriptionP* = ptr Description
# Callback function types # Callback function types
@ -256,47 +258,47 @@ proc free*(`ptr`: pointer) {.importc: "jack_free".}
# jack_client_t * jack_client_open (char *client_name, # jack_client_t * jack_client_open (char *client_name,
# jack_options_t options, # jack_options_t options,
# jack_status_t *status, ...) # jack_status_t *status, ...)
proc clientOpen*(clientName: cstring; options: cint; status: ptr cint): Client {. proc clientOpen*(clientName: cstring; options: cint; status: ptr cint): ClientP {.
varargs, importc: "jack_client_open".} varargs, importc: "jack_client_open".}
# int jack_client_close (jack_client_t *client) # int jack_client_close (jack_client_t *client)
proc clientClose*(client: Client): cint {.importc: "jack_client_close", discardable.} proc clientClose*(client: ClientP): cint {.importc: "jack_client_close"}
# int jack_client_name_size (void) # int jack_client_name_size (void)
proc clientNameSize*(): cint {.importc: "jack_client_name_size"} proc clientNameSize*(): cint {.importc: "jack_client_name_size"}
# char * jack_get_client_name (jack_client_t *client) # char * jack_get_client_name (jack_client_t *client)
proc getClientName*(client: Client): cstring {.importc: "jack_get_client_name".} proc getClientName*(client: ClientP): cstring {.importc: "jack_get_client_name".}
# char *jack_get_uuid_for_client_name (jack_client_t *client, const char *client_name) # char *jack_get_uuid_for_client_name (jack_client_t *client, const char *client_name)
proc getUuidForClientName*(client: Client; clientName: cstring): cstring {. proc getUuidForClientName*(client: ClientP; clientName: cstring): cstring {.
importc: "jack_get_uuid_for_client_name".} importc: "jack_get_uuid_for_client_name".}
# char *jack_get_client_name_by_uuid (jack_client_t *client, const char *client_uuid) # char *jack_get_client_name_by_uuid (jack_client_t *client, const char *client_uuid)
proc getClientNameByUuid*(client: Client; clientUuid: cstring): cstring {. proc getClientNameByUuid*(client: ClientP; clientUuid: cstring): cstring {.
importc: "jack_get_client_name_by_uuid".} importc: "jack_get_client_name_by_uuid".}
# int jack_activate (jack_client_t *client) # int jack_activate (jack_client_t *client)
proc activate*(client: Client): cint {.importc: "jack_activate", discardable.} proc activate*(client: ClientP): cint {.importc: "jack_activate".}
# int jack_deactivate (jack_client_t *client) # int jack_deactivate (jack_client_t *client)
proc deactivate*(client: Client): cint {.importc: "jack_deactivate", discardable.} proc deactivate*(client: ClientP): cint {.importc: "jack_deactivate".}
# int jack_get_client_pid (const char *name) # int jack_get_client_pid (const char *name)
proc getClientPid*(name: cstring): cint {.importc: "jack_get_client_pid".} proc getClientPid*(name: cstring): cint {.importc: "jack_get_client_pid".}
# FIXME: not implemented yet # FIXME: not implemented yet
# jack_native_thread_t jack_client_thread_id (jack_client_t *client) # jack_native_thread_t jack_client_thread_id (jack_client_t *client)
# proc clientThreadId*(client: Client): NativeThread {.importc: "jack_client_thread_id".} # proc clientThreadId*(client: ClientP): NativeThread {.importc: "jack_client_thread_id".}
# int jack_is_realtime (jack_client_t *client) # int jack_is_realtime (jack_client_t *client)
proc isRealtime*(client: Client): cint {.importc: "jack_is_realtime".} proc isRealtime*(client: ClientP): cint {.importc: "jack_is_realtime".}
# jack_nframes_t jack_cycle_wait (jack_client_t* client) # jack_nframes_t jack_cycle_wait (jack_client_t* client)
proc cycleWait*(client: Client): NFrames {.importc: "jack_cycle_wait".} proc cycleWait*(client: ClientP): NFrames {.importc: "jack_cycle_wait".}
# void jack_cycle_signal (jack_client_t* client, int status) # void jack_cycle_signal (jack_client_t* client, int status)
proc cycleSignal*(client: Client; status: cint) {.importc: "jack_cycle_signal".} proc cycleSignal*(client: ClientP; status: cint) {.importc: "jack_cycle_signal".}
#[ DEPRECATED #[ DEPRECATED
jack_client_t *jack_client_new (const char *client_name) jack_client_t *jack_client_new (const char *client_name)
@ -306,23 +308,23 @@ jack_nframes_t jack_thread_wait (jack_client_t *client, int status)
# --------------------------- Internal Clients ---------------------------- # --------------------------- Internal Clients ----------------------------
# char *jack_get_internal_client_name (jack_client_t *client, jack_intclient_t intclient); # char *jack_get_internal_client_name (jack_client_t *client, jack_intclient_t intclient);
proc getInternalClientName*(client: Client; intclient: IntClient): cstring {. proc getInternalClientName*(client: ClientP; intclient: IntClient): cstring {.
importc: "jack_get_internal_client_name".} importc: "jack_get_internal_client_name".}
# jack_intclient_t jack_internal_client_handle (jack_client_t *client, const char *client_name, # jack_intclient_t jack_internal_client_handle (jack_client_t *client, const char *client_name,
# jack_status_t *status) # jack_status_t *status)
proc internalClientHandle*(client: Client; clientName: cstring; status: ptr cint): IntClient {. proc internalClientHandle*(client: ClientP; clientName: cstring; status: ptr cint): IntClient {.
importc: "jack_internal_client_handle".} importc: "jack_internal_client_handle".}
# jack_intclient_t jack_internal_client_load (jack_client_t *client, const char *client_name, # jack_intclient_t jack_internal_client_load (jack_client_t *client, const char *client_name,
# jack_options_t options, jack_status_t *status, ...) # jack_options_t options, jack_status_t *status, ...)
proc internalClientLoad*(client: Client; clientName: cstring; options: cint; status: ptr cint): IntClient {. proc internalClientLoad*(client: ClientP; clientName: cstring; options: cint; status: ptr cint): IntClient {.
varargs, importc: "jack_internal_client_load".} varargs, importc: "jack_internal_client_load".}
# jack_status_t jack_internal_client_unload (jack_client_t *client, jack_intclient_t intclient) # jack_status_t jack_internal_client_unload (jack_client_t *client, jack_intclient_t intclient)
proc internalClientUnload*(client: Client; intclient: IntClient): cint {. proc internalClientUnload*(client: ClientP; intclient: IntClient): cint {.
importc: "jack_internal_client_unload", discardable.} importc: "jack_internal_client_unload".}
#[ DEPRECATED #[ DEPRECATED
int jack_internal_client_new (const char * client_name, const char *load_name, const char *load_init) int jack_internal_client_new (const char * client_name, const char *load_name, const char *load_init)
@ -332,70 +334,70 @@ void jack_internal_client_close (const char *client_name)
# ------------------------------- Callbacks ------------------------------- # ------------------------------- Callbacks -------------------------------
proc onShutdown*(client: Client; shutdownCallback: ShutdownCallback; arg: pointer = nil) {. proc setProcessThread*(client: ClientP; threadCallback: ThreadCallback; arg: pointer = nil): cint {.
importc: "jack_set_process_thread".}
proc setThreadInitCallback*(client: ClientP; threadInitCallback: ThreadInitCallback; arg: pointer = nil): cint {.
importc: "jack_set_thread_init_callback".}
proc onShutdown*(client: ClientP; shutdownCallback: ShutdownCallback; arg: pointer = nil) {.
importc: "jack_on_shutdown".} importc: "jack_on_shutdown".}
proc onInfoShutdown*(client: Client; shutdownCallback: InfoShutdownCallback; arg: pointer = nil) {. proc onInfoShutdown*(client: ClientP; shutdownCallback: InfoShutdownCallback; arg: pointer = nil) {.
importc: "jack_on_info_shutdown".} importc: "jack_on_info_shutdown".}
proc setProcessThread*(client: Client; threadCallback: ThreadCallback; arg: pointer = nil): cint {. proc setProcessCallback*(client: ClientP; processCallback: ProcessCallback; arg: pointer = nil): cint {.
importc: "jack_set_process_thread", discardable.} importc: "jack_set_process_callback".}
proc setThreadInitCallback*(client: Client; threadInitCallback: ThreadInitCallback; arg: pointer = nil): cint {. proc setFreewheelCallback*(client: ClientP; freewheelCallback: FreewheelCallback; arg: pointer = nil): cint {.
importc: "jack_set_thread_init_callback", discardable.} importc: "jack_set_freewheel_callback".}
proc setProcessCallback*(client: Client; processCallback: ProcessCallback; arg: pointer = nil): cint {. proc setBufferSizeCallback*(client: ClientP; bufsizeCallback: BufferSizeCallback; arg: pointer = nil): cint {.
importc: "jack_set_process_callback", discardable.} importc: "jack_set_buffer_size_callback".}
proc setFreewheelCallback*(client: Client; freewheelCallback: FreewheelCallback; arg: pointer = nil): cint {. proc setSampleRateCallback*(client: ClientP; srateCallback: SampleRateCallback; arg: pointer = nil): cint {.
importc: "jack_set_freewheel_callback", discardable.} importc: "jack_set_sample_rate_callback".}
proc setBufferSizeCallback*(client: Client; bufsizeCallback: BufferSizeCallback; arg: pointer = nil): cint {. proc setClientRegistrationCallback*(client: ClientP; registrationCallback: ClientRegistrationCallback;
importc: "jack_set_buffer_size_callback", discardable.}
proc setSampleRateCallback*(client: Client; srateCallback: SampleRateCallback; arg: pointer = nil): cint {.
importc: "jack_set_sample_rate_callback", discardable.}
proc setClientRegistrationCallback*(client: Client; registrationCallback: ClientRegistrationCallback;
arg: pointer = nil): cint {. arg: pointer = nil): cint {.
importc: "jack_set_client_registration_callback", discardable.} importc: "jack_set_client_registration_callback".}
proc setPortRegistrationCallback*(client: Client; registrationCallback: PortRegistrationCallback; proc setPortRegistrationCallback*(client: ClientP; registrationCallback: PortRegistrationCallback;
arg: pointer = nil): cint {. arg: pointer = nil): cint {.
importc: "jack_set_port_registration_callback", discardable.} importc: "jack_set_port_registration_callback".}
proc setPortConnectCallback*(client: Client; connectCallback: PortConnectCallback; arg: pointer = nil): cint {. proc setPortConnectCallback*(client: ClientP; connectCallback: PortConnectCallback; arg: pointer = nil): cint {.
importc: "jack_set_port_connect_callback", discardable.} importc: "jack_set_port_connect_callback".}
proc setPortRenameCallback*(client: Client; renameCallback: PortRenameCallback; arg: pointer = nil): cint {. proc setPortRenameCallback*(client: ClientP; renameCallback: PortRenameCallback; arg: pointer = nil): cint {.
importc: "jack_set_port_rename_callback", discardable.} importc: "jack_set_port_rename_callback".}
proc setGraphOrderCallback*(client: Client; graphCallback: GraphOrderCallback; arg: pointer = nil): cint {. proc setGraphOrderCallback*(client: ClientP; graphCallback: GraphOrderCallback; a3: pointer): cint {.
importc: "jack_set_graph_order_callback", discardable.} importc: "jack_set_graph_order_callback".}
proc setXrunCallback*(client: Client; xrunCallback: XRunCallback; arg: pointer = nil): cint {. proc setXrunCallback*(client: ClientP; xrunCallback: XRunCallback; arg: pointer = nil): cint {.
importc: "jack_set_xrun_callback", discardable.} importc: "jack_set_xrun_callback".}
proc setLatencyCallback*(client: Client; latencyCallback: LatencyCallback; arg: pointer = nil): cint {. proc setLatencyCallback*(client: ClientP; latencyCallback: LatencyCallback; arg: pointer = nil): cint {.
importc: "jack_set_latency_callback", discardable.} importc: "jack_set_latency_callback".}
# -------------------------- Server Client Control ------------------------ # -------------------------- Server Client Control ------------------------
# int jack_set_freewheel(jack_client_t* client, int onoff) # int jack_set_freewheel(jack_client_t* client, int onoff)
proc setFreewheel*(client: Client; onoff: cint): cint {.importc: "jack_set_freewheel", discardable.} proc setFreewheel*(client: ClientP; onoff: cint): cint {.importc: "jack_set_freewheel".}
# int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes) # int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes)
proc setBufferSize*(client: Client; nframes: NFrames): cint {.importc: "jack_set_buffer_size", discardable.} proc setBufferSize*(client: ClientP; nframes: NFrames): cint {.importc: "jack_set_buffer_size".}
#jack_nframes_t jack_get_sample_rate (jack_client_t *) #jack_nframes_t jack_get_sample_rate (jack_client_t *)
proc getSampleRate*(client: Client): NFrames {.importc: "jack_get_sample_rate"} proc getSampleRate*(client: ClientP): NFrames {.importc: "jack_get_sample_rate".}
# jack_nframes_t jack_get_buffer_size (jack_client_t *) # jack_nframes_t jack_get_buffer_size (jack_client_t *)
proc getBufferSize*(client: Client): NFrames {.importc: "jack_get_buffer_size".} proc getBufferSize*(client: ClientP): NFrames {.importc: "jack_get_buffer_size".}
# float jack_cpu_load (jack_client_t *client) # float jack_cpu_load (jack_client_t *client)
proc cpuLoad*(client: Client): cfloat {.importc: "jack_cpu_load".} proc cpuLoad*(client: ClientP): cfloat {.importc: "jack_cpu_load".}
#[ DEPRECATED #[ DEPRECATED
int jack_engine_takeover_timebase (jack_client_t *) int jack_engine_takeover_timebase (jack_client_t *)
@ -409,82 +411,82 @@ int jack_engine_takeover_timebase (jack_client_t *)
# const char *port_type, # const char *port_type,
# unsigned long flags, # unsigned long flags,
# unsigned long buffer_size) # unsigned long buffer_size)
proc portRegister*(client: Client; portName: cstring; portType: cstring; proc portRegister*(client: ClientP; portName: cstring; portType: cstring;
flags: culong; bufferSize: culong): Port {.importc: "jack_port_register".} flags: culong; bufferSize: culong): PortP {.importc: "jack_port_register".}
# int jack_port_unregister (jack_client_t *client, jack_port_t *port) # int jack_port_unregister (jack_client_t *client, jack_port_t *port)
proc portUnregister*(client: Client; port: Port): cint {.importc: "jack_port_unregister", discardable.} proc portUnregister*(client: ClientP; port: PortP): cint {.importc: "jack_port_unregister".}
# void * jack_port_get_buffer (jack_port_t *port, jack_nframes_t) # void * jack_port_get_buffer (jack_port_t *port, jack_nframes_t)
proc portGetBuffer*(port: Port; nframes: NFrames): pointer {.importc: "jack_port_get_buffer".} proc portGetBuffer*(port: PortP; nframes: NFrames): pointer {.importc: "jack_port_get_buffer".}
# jack_uuid_t jack_port_uuid (const jack_port_t *port) # jack_uuid_t jack_port_uuid (const jack_port_t *port)
proc portUuid*(port: Port): Uuid {.importc: "jack_port_uuid".} proc portUuid*(port: PortP): Uuid {.importc: "jack_port_uuid".}
# const char * jack_port_name (const jack_port_t *port) # const char * jack_port_name (const jack_port_t *port)
proc portName*(port: Port): cstring {.importc: "jack_port_name".} proc portName*(port: PortP): cstring {.importc: "jack_port_name".}
# const char * jack_port_short_name (const jack_port_t *port) # const char * jack_port_short_name (const jack_port_t *port)
proc portShortName*(port: Port): cstring {.importc: "jack_port_short_name".} proc portShortName*(port: PortP): cstring {.importc: "jack_port_short_name".}
# int jack_port_flags (const jack_port_t *port) # int jack_port_flags (const jack_port_t *port)
proc portFlags*(port: Port): cint {.importc: "jack_port_flags".} proc portFlags*(port: PortP): cint {.importc: "jack_port_flags".}
# const char * jack_port_type (const jack_port_t *port) # const char * jack_port_type (const jack_port_t *port)
proc portType*(port: Port): cstring {.importc: "jack_port_type".} proc portType*(port: PortP): cstring {.importc: "jack_port_type".}
# jack_port_type_id_t jack_port_type_id (const jack_port_t *port) # jack_port_type_id_t jack_port_type_id (const jack_port_t *port)
proc portTypeId*(port: Port): PortTypeId {.importc: "jack_port_type_id".} proc portTypeId*(port: PortP): PortTypeId {.importc: "jack_port_type_id".}
# int jack_port_is_mine (const jack_client_t *client, const jack_port_t *port) # int jack_port_is_mine (const jack_client_t *client, const jack_port_t *port)
proc portIsMine*(client: Client; port: Port): cint {. proc portIsMine*(client: ClientP; port: PortP): cint {.
importc: "jack_port_is_mine".} importc: "jack_port_is_mine".}
# int jack_port_connected (const jack_port_t *port) # int jack_port_connected (const jack_port_t *port)
proc portConnected*(port: Port): cint {.importc: "jack_port_connected".} proc portConnected*(port: PortP): cint {.importc: "jack_port_connected".}
# int jack_port_connected_to (const jack_port_t *port, # int jack_port_connected_to (const jack_port_t *port,
# const char *port_name) # const char *port_name)
proc portConnectedTo*(port: Port; portName: cstring): cint {.importc: "jack_port_connected_to".} proc portConnectedTo*(port: PortP; portName: cstring): cint {.importc: "jack_port_connected_to".}
# const char ** jack_port_get_connections (const jack_port_t *port) # const char ** jack_port_get_connections (const jack_port_t *port)
# #
# CAVEAT: The caller is responsible for calling jack_free() on any non-NULL returned value. # CAVEAT: The caller is responsible for calling jack_free() on any non-NULL returned value.
proc portGetConnections*(port: Port): cstringArray {.importc: "jack_port_get_connections".} proc portGetConnections*(port: PortP): cstringArray {.importc: "jack_port_get_connections".}
# const char ** jack_port_get_all_connections (const jack_client_t *client, # const char ** jack_port_get_all_connections (const jack_client_t *client,
# const jack_port_t *port) # const jack_port_t *port)
# #
# CAVEAT: The caller is responsible for calling jack_free() on any non-NULL returned value. # CAVEAT: The caller is responsible for calling jack_free() on any non-NULL returned value.
proc portGetAllConnections*(client: Client; port: Port): cstringArray {. proc portGetAllConnections*(client: ClientP; port: PortP): cstringArray {.
importc: "jack_port_get_all_connections".} importc: "jack_port_get_all_connections".}
# int jack_port_rename (jack_client_t* client, jack_port_t *port, const char *port_name) # int jack_port_rename (jack_client_t* client, jack_port_t *port, const char *port_name)
proc portRename*(client: Client; port: Port; portName: cstring): cint {.importc: "jack_port_rename", discardable.} proc portRename*(client: ClientP; port: PortP; portName: cstring): cint {.importc: "jack_port_rename".}
# int jack_port_set_alias (jack_port_t *port, const char *alias) # int jack_port_set_alias (jack_port_t *port, const char *alias)
proc portSetAlias*(port: Port; alias: cstring): cint {.importc: "jack_port_set_alias", discardable.} proc portSetAlias*(port: PortP; alias: cstring): cint {.importc: "jack_port_set_alias".}
# int jack_port_unset_alias (jack_port_t *port, const char *alias) # int jack_port_unset_alias (jack_port_t *port, const char *alias)
proc portUnsetAlias*(port: Port; alias: cstring): cint {.importc: "jack_port_unset_alias", discardable.} proc portUnsetAlias*(port: PortP; alias: cstring): cint {.importc: "jack_port_unset_alias".}
# int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]) # int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2])
proc portGetAliases*(port: Port; aliases: array[2, cstring]): cint {.importc: "jack_port_get_aliases".} proc portGetAliases*(port: PortP; aliases: array[2, cstring]): cint {.importc: "jack_port_get_aliases".}
#int jack_port_request_monitor (jack_port_t *port, int onoff) #int jack_port_request_monitor (jack_port_t *port, int onoff)
proc portRequestMonitor*(port: Port; onoff: cint): cint {.importc: "jack_port_request_monitor", discardable.} proc portRequestMonitor*(port: PortP; onoff: cint): cint {.importc: "jack_port_request_monitor".}
# int jack_port_request_monitor_by_name (jack_client_t *client, # int jack_port_request_monitor_by_name (jack_client_t *client,
# const char *port_name, int onoff) # const char *port_name, int onoff)
proc portRequestMonitorByName*(client: Client; portName: cstring; onoff: cint): cint {. proc portRequestMonitorByName*(client: ClientP; portName: cstring; onoff: cint): cint {.
importc: "jack_port_request_monitor_by_name", discardable.} importc: "jack_port_request_monitor_by_name".}
# int jack_port_ensure_monitor (jack_port_t *port, int onoff) # int jack_port_ensure_monitor (jack_port_t *port, int onoff)
proc portEnsureMonitor*(port: Port; onoff: cint): cint {. proc portEnsureMonitor*(port: PortP; onoff: cint): cint {.
importc: "jack_port_ensure_monitor", discardable.} importc: "jack_port_ensure_monitor".}
# int jack_port_monitoring_input (jack_port_t *port) # int jack_port_monitoring_input (jack_port_t *port)
proc portMonitoringInput*(port: Port): cint {.importc: "jack_port_monitoring_input".} proc portMonitoringInput*(port: PortP): cint {.importc: "jack_port_monitoring_input".}
#[ DEPRECATED #[ DEPRECATED
int jack_port_tie (jack_port_t *src, jack_port_t *dst) int jack_port_tie (jack_port_t *src, jack_port_t *dst)
@ -501,14 +503,14 @@ int jack_port_set_name (jack_port_t *port, const char *port_name)
# unsigned long flags) # unsigned long flags)
# #
# CAVEAT: The caller is responsible for calling jack_free() on any non-NULL returned value. # CAVEAT: The caller is responsible for calling jack_free() on any non-NULL returned value.
proc getPorts*(client: Client; portNamePattern: cstring; proc getPorts*(client: ClientP; portNamePattern: cstring;
typeNamePattern: cstring; flags: culong): cstringArray {.importc: "jack_get_ports".} typeNamePattern: cstring; flags: culong): cstringArray {.importc: "jack_get_ports".}
# jack_port_t * jack_port_by_name (jack_client_t *client, const char *port_name) # jack_port_t * jack_port_by_name (jack_client_t *client, const char *port_name)
proc portByName*(client: Client; portName: cstring): Port {.importc: "jack_port_by_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) # jack_port_t * jack_port_by_id (jack_client_t *client, jack_port_id_t port_id)
proc portById*(client: Client; portId: PortId): Port {.importc: "jack_port_by_id".} proc portById*(client: ClientP; portId: PortId): PortP {.importc: "jack_port_by_id".}
# ------------------------------ Connections ------------------------------ # ------------------------------ Connections ------------------------------
@ -516,15 +518,15 @@ proc portById*(client: Client; portId: PortId): Port {.importc: "jack_port_by_id
# int jack_connect (jack_client_t *client, # int jack_connect (jack_client_t *client,
# const char *source_port, # const char *source_port,
# const char *destination_port) # const char *destination_port)
proc connect*(client: Client; srcPort: cstring; destPort: cstring): cint {.importc: "jack_connect", discardable.} proc connect*(client: ClientP; srcPort: cstring; destPort: cstring): cint {.importc: "jack_connect".}
# int jack_disconnect (jack_client_t *client, # int jack_disconnect (jack_client_t *client,
# const char *source_port, # const char *source_port,
# const char *destination_port) # const char *destination_port)
proc disconnect*(client: Client; srcPort: cstring; destPort: cstring): cint {.importc: "jack_disconnect", discardable.} proc disconnect*(client: ClientP; srcPort: cstring; destPort: cstring): cint {.importc: "jack_disconnect".}
# int jack_port_disconnect (jack_client_t *client, jack_port_t *port) # int jack_port_disconnect (jack_client_t *client, jack_port_t *port)
proc portDisconnect*(client: Client; port: Port): cint {.importc: "jack_port_disconnect", discardable.} proc portDisconnect*(client: ClientP; port: PortP): cint {.importc: "jack_port_disconnect".}
# int jack_port_name_size(void) # int jack_port_name_size(void)
proc portNameSize*(): cint {.importc: "jack_port_name_size".} proc portNameSize*(): cint {.importc: "jack_port_name_size".}
@ -533,7 +535,7 @@ proc portNameSize*(): cint {.importc: "jack_port_name_size".}
proc portTypeSize*(): cint {.importc: "jack_port_type_size".} proc portTypeSize*(): cint {.importc: "jack_port_type_size".}
# size_t jack_port_type_get_buffer_size (jack_client_t *client, const char *port_type) # size_t jack_port_type_get_buffer_size (jack_client_t *client, const char *port_type)
proc portTypeGetBufferSize*(client: Client; portType: cstring): csize_t {. proc portTypeGetBufferSize*(client: ClientP; portType: cstring): csize_t {.
importc: "jack_port_type_get_buffer_size".} importc: "jack_port_type_get_buffer_size".}
@ -543,7 +545,7 @@ proc portTypeGetBufferSize*(client: Client; portType: cstring): csize_t {.
proc midiGetEventCount*(portBuffer: pointer): NFrames {.importc: "jack_midi_get_event_count".} 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) # int jack_midi_event_get (jack_midi_event_t *event, void *port_buffer, uint32_t event_index)
proc midiEventGet*(event: MidiEvent, portBuffer: pointer, eventIndex: uint32): cint {. proc midiEventGet*(event: MidiEventP, portBuffer: pointer, eventIndex: uint32): cint {.
importc: "jack_midi_event_get".} importc: "jack_midi_event_get".}
# void jack_midi_clear_buffer (void *port_buffer) # void jack_midi_clear_buffer (void *port_buffer)
@ -557,8 +559,8 @@ proc midiEventReserve*(portBuffer: pointer, time: NFrames, dataSize: csize_t): p
importc: "jack_midi_event_reserve".} 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) # 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): cint {. proc midiEventWrite*(portBuffer: pointer, time: NFrames, data: ptr MidiData, dataSize: csize_t): int {.
importc: "jack_midi_event_write", discardable.} importc: "jack_midi_event_write".}
# uint32_t jack_midi_get_lost_event_count (void *port_buffer) # uint32_t jack_midi_get_lost_event_count (void *port_buffer)
proc midiGetLostEventCount*(portBuffer: pointer): uint32 {.importc: "jack_midi_get_lost_event_count".} proc midiGetLostEventCount*(portBuffer: pointer): uint32 {.importc: "jack_midi_get_lost_event_count".}
@ -567,15 +569,15 @@ proc midiGetLostEventCount*(portBuffer: pointer): uint32 {.importc: "jack_midi_g
# -------------------------------- Latency -------------------------------- # -------------------------------- Latency --------------------------------
# void jack_port_get_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) # void jack_port_get_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range)
proc portGetLatencyRange*(port: Port; mode: LatencyCallbackMode; range: ptr LatencyRange) {. proc portGetLatencyRange*(port: PortP; mode: LatencyCallbackMode; range: ptr LatencyRange) {.
importc: "jack_port_get_latency_range".} importc: "jack_port_get_latency_range".}
# void jack_port_set_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) # void jack_port_set_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range)
proc portSetLatencyRange*(port: Port; mode: LatencyCallbackMode; range: ptr LatencyRange) {. proc portSetLatencyRange*(port: PortP; mode: LatencyCallbackMode; range: ptr LatencyRange) {.
importc: "jack_port_set_latency_range".} importc: "jack_port_set_latency_range".}
# int jack_recompute_total_latencies (jack_client_t *) # int jack_recompute_total_latencies (jack_client_t *)
proc recomputeTotalLatencies*(client: Client): cint {.importc: "jack_recompute_total_latencies", discardable.} proc recomputeTotalLatencies*(client: ClientP): cint {.importc: "jack_recompute_total_latencies".}
#[ DEPRECATED #[ DEPRECATED
jack_nframes_t jack_port_get_latency (jack_port_t *port) jack_nframes_t jack_port_get_latency (jack_port_t *port)
@ -588,28 +590,28 @@ int jack_recompute_total_latency (jack_client_t *, jack_port_t *port)
# ----------------------------- Time handling ----------------------------- # ----------------------------- Time handling -----------------------------
# jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *) # jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *)
proc framesSinceCycleStart*(client: Client): NFrames {.importc: "jack_frames_since_cycle_start".} proc framesSinceCycleStart*(client: ClientP): NFrames {.importc: "jack_frames_since_cycle_start".}
# jack_nframes_t jack_frame_time (const jack_client_t *) # jack_nframes_t jack_frame_time (const jack_client_t *)
proc frameTime*(client: Client): NFrames {.importc: "jack_frame_time".} proc frameTime*(client: ClientP): NFrames {.importc: "jack_frame_time".}
# jack_nframes_t jack_last_frame_time (const jack_client_t *client) # jack_nframes_t jack_last_frame_time (const jack_client_t *client)
proc lastFrameTime*(client: Client): NFrames {.importc: "jack_last_frame_time".} proc lastFrameTime*(client: ClientP): NFrames {.importc: "jack_last_frame_time".}
# int jack_get_cycle_times(const jack_client_t *client, # int jack_get_cycle_times(const jack_client_t *client,
# jack_nframes_t *current_frames, # jack_nframes_t *current_frames,
# jack_time_t *current_usecs, # jack_time_t *current_usecs,
# jack_time_t *next_usecs, # jack_time_t *next_usecs,
# float *period_usecs) # float *period_usecs)
proc getCycleTimes*(client: Client; currentFrames: ptr NFrames; proc getCycleTimes*(client: ClientP; currentFrames: ptr NFrames;
currentUsecs: ptr Time; nextUsecs: ptr Time; currentUsecs: ptr Time; nextUsecs: ptr Time;
periodUsecs: ptr cfloat): cint {.importc: "jack_get_cycle_times".} periodUsecs: ptr cfloat): cint {.importc: "jack_get_cycle_times".}
# jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t) # jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t)
proc framesToTime*(client: Client; nframes: NFrames): Time {.importc: "jack_frames_to_time".} proc framesToTime*(client: ClientP; nframes: NFrames): Time {.importc: "jack_frames_to_time".}
# jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t) # jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t)
proc timeToFrames*(client: Client; time: Time): NFrames {.importc: "jack_time_to_frames".} proc timeToFrames*(client: ClientP; time: Time): NFrames {.importc: "jack_time_to_frames".}
# jack_time_t jack_get_time(void) # jack_time_t jack_get_time(void)
proc getTime*(): Time {.importc: "jack_get_time".} proc getTime*(): Time {.importc: "jack_get_time".}
@ -618,40 +620,40 @@ proc getTime*(): Time {.importc: "jack_get_time".}
# ------------------------------- Transport ------------------------------- # ------------------------------- Transport -------------------------------
# int jack_release_timebase (jack_client_t *client) # int jack_release_timebase (jack_client_t *client)
proc releaseTimebase*(client: Client): cint {.importc: "jack_release_timebase", discardable.} proc releaseTimebase*(client: ClientP): cint {.importc: "jack_release_timebase".}
# int jack_set_sync_callback (jack_client_t *client, JackSyncCallback sync_callback, void *arg) # int jack_set_sync_callback (jack_client_t *client, JackSyncCallback sync_callback, void *arg)
proc setSyncCallback*(client: Client; syncCallback: SyncCallback; arg: pointer = nil): cint {. proc setSyncCallback*(client: ClientP; syncCallback: SyncCallback; arg: pointer = nil): cint {.
importc: "jack_set_sync_callback", discardable.} importc: "jack_set_sync_callback".}
# int jack_set_sync_timeout (jack_client_t *client, jack_time_t timeout) # int jack_set_sync_timeout (jack_client_t *client, jack_time_t timeout)
proc setSyncTimeout*(client: Client; timeout: Time): cint {.importc: "jack_set_sync_timeout", discardable.} proc setSyncTimeout*(client: ClientP; timeout: Time): cint {.importc: "jack_set_sync_timeout".}
# int jack_set_timebase_callback (jack_client_t *client, # int jack_set_timebase_callback (jack_client_t *client,
# int conditional, # int conditional,
# JackTimebaseCallback timebase_callback, # JackTimebaseCallback timebase_callback,
# void *arg) # void *arg)
proc setTimebaseCallback*(client: Client; conditional: cint; timebaseCallback: TimebaseCallback; proc setTimebaseCallback*(client: ClientP; conditional: cint; timebaseCallback: TimebaseCallback;
arg: pointer = nil): cint {. arg: pointer = nil): cint {.
importc: "jack_set_timebase_callback", discardable.} importc: "jack_set_timebase_callback".}
# int jack_transport_locate (jack_client_t *client, jack_nframes_t frame) # int jack_transport_locate (jack_client_t *client, jack_nframes_t frame)
proc transportLocate*(client: Client; frame: NFrames): cint {.importc: "jack_transport_locate", discardable.} 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) # jack_transport_state_t jack_transport_query (const jack_client_t *client, jack_position_t *pos)
proc transportQuery*(client: Client; pos: Position): TransportState {.importc: "jack_transport_query".} proc transportQuery*(client: ClientP; pos: PositionP): TransportState {.importc: "jack_transport_query".}
# jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client) # jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client)
proc getCurrentTransportFrame*(client: Client): NFrames {.importc: "jack_get_current_transport_frame".} proc getCurrentTransportFrame*(client: ClientP): NFrames {.importc: "jack_get_current_transport_frame".}
# int jack_transport_reposition (jack_client_t *client, const jack_position_t *pos) # int jack_transport_reposition (jack_client_t *client, const jack_position_t *pos)
proc transportReposition*(client: Client; pos: Position): cint {.importc: "jack_transport_reposition".} proc transportReposition*(client: ClientP; pos: PositionP): cint {.importc: "jack_transport_reposition".}
# void jack_transport_start (jack_client_t *client) # void jack_transport_start (jack_client_t *client)
proc transportStart*(client: Client) {.importc: "jack_transport_start".} proc transportStart*(client: ClientP) {.importc: "jack_transport_start".}
# void jack_transport_stop (jack_client_t *client) # void jack_transport_stop (jack_client_t *client)
proc transportStop*(client: Client) {.importc: "jack_transport_stop".} proc transportStop*(client: ClientP) {.importc: "jack_transport_stop".}
#[ DEPRECATED #[ DEPRECATED
void jack_get_transport_info (jack_client_t *client, jack_transport_info_t *tinfo) void jack_get_transport_info (jack_client_t *client, jack_transport_info_t *tinfo)
@ -661,81 +663,79 @@ void jack_set_transport_info (jack_client_t *client, jack_transport_info_t *tinf
# ----------------------------- Ringbuffers ------------------------------- # ----------------------------- Ringbuffers -------------------------------
# jack_ringbuffer_t *jack_ringbuffer_create (size_t sz) # jack_ringbuffer_t *jack_ringbuffer_create (size_t sz)
proc ringbufferCreate*(sz: csize_t): Ringbuffer {.importc: "jack_ringbuffer_create".} proc ringbufferCreate*(sz: csize_t): RingbufferP {.importc: "jack_ringbuffer_create".}
# void jack_ringbuffer_free (jack_ringbuffer_t *rb) # void jack_ringbuffer_free (jack_ringbuffer_t *rb)
proc ringbufferFree*(rb: Ringbuffer) {.importc: "jack_ringbuffer_free".} proc ringbufferFree*(rb: RingbufferP) {.importc: "jack_ringbuffer_free".}
# void jack_ringbuffer_get_read_vector (const jack_ringbuffer_t *rb, jack_ringbuffer_data_t *vec) # void jack_ringbuffer_get_read_vector (const jack_ringbuffer_t *rb, jack_ringbuffer_data_t *vec)
proc ringbufferGetReadVector*(rb: Ringbuffer, vec: var RingbufferData) {.importc: "jack_ringbuffer_get_read_vector".} proc ringbufferGetReadVector*(rb: RingbufferP, vec: var RingbufferDataP) {.importc: "jack_ringbuffer_get_read_vector".}
# void jack_ringbuffer_get_write_vector (const jack_ringbuffer_t *rb, jack_ringbuffer_data_t *vec) # void jack_ringbuffer_get_write_vector (const jack_ringbuffer_t *rb, jack_ringbuffer_data_t *vec)
proc ringbufferGetWriteVector*(rb: Ringbuffer, vec: var RingbufferData) {.importc: "jack_ringbuffer_get_write_vector".} proc ringbufferGetWriteVector*(rb: RingbufferP, vec: var RingbufferDataP) {.importc: "jack_ringbuffer_get_write_vector".}
# size_t jack_ringbuffer_read (jack_ringbuffer_t *rb, char *dest, size_t cnt) # size_t jack_ringbuffer_read (jack_ringbuffer_t *rb, char *dest, size_t cnt)
proc ringbufferRead*(rb: Ringbuffer, dest: cstring, cnt: csize_t): csize_t {.importc: "jack_ringbuffer_read".} proc ringbufferRead*(rb: RingbufferP, dest: cstring, cnt: csize_t): csize_t {.importc: "jack_ringbuffer_read".}
# size_t jack_ringbuffer_peek (jack_ringbuffer_t *rb, char *dest, size_t cnt) # size_t jack_ringbuffer_peek (jack_ringbuffer_t *rb, char *dest, size_t cnt)
proc ringbufferPeek*(rb: Ringbuffer, dest: cstring, cnt: csize_t): csize_t {.importc: "jack_ringbuffer_peek".} proc ringbufferPeek*(rb: RingbufferP, dest: cstring, cnt: csize_t): csize_t {.importc: "jack_ringbuffer_peek".}
# void jack_ringbuffer_read_advance (jack_ringbuffer_t *rb, size_t cnt) # void jack_ringbuffer_read_advance (jack_ringbuffer_t *rb, size_t cnt)
proc ringbufferReadAdvance*(rb: Ringbuffer, cnt: csize_t) {.importc: "jack_ringbuffer_read_advance".} proc ringbufferReadAdvance*(rb: RingbufferP, cnt: csize_t) {.importc: "jack_ringbuffer_read_advance".}
# size_t jack_ringbuffer_read_space (const jack_ringbuffer_t *rb) # size_t jack_ringbuffer_read_space (const jack_ringbuffer_t *rb)
proc ringbufferReadSpace*(rb: Ringbuffer): csize_t {.importc: "jack_ringbuffer_read_space".} proc ringbufferReadSpace*(rb: RingbufferP): csize_t {.importc: "jack_ringbuffer_read_space".}
# int jack_ringbuffer_mlock (jack_ringbuffer_t *rb) # int jack_ringbuffer_mlock (jack_ringbuffer_t *rb)
proc ringbufferMlock*(rb: Ringbuffer): cint {.importc: "jack_ringbuffer_mlock", discardable.} proc ringbufferMlock*(rb: RingbufferP): int {.importc: "jack_ringbuffer_mlock".}
# void jack_ringbuffer_reset (jack_ringbuffer_t *rb) # void jack_ringbuffer_reset (jack_ringbuffer_t *rb)
proc ringbufferReset*(rb: Ringbuffer) {.importc: "jack_ringbuffer_reset".} proc ringbufferReset*(rb: RingbufferP) {.importc: "jack_ringbuffer_reset".}
# size_t jack_ringbuffer_write (jack_ringbuffer_t *rb, const char *src, size_t cnt) # size_t jack_ringbuffer_write (jack_ringbuffer_t *rb, const char *src, size_t cnt)
proc ringbufferWrite*(rb: Ringbuffer, src: cstring, cnt: csize_t): csize_t {.importc: "jack_ringbuffer_write".} proc ringbufferWrite*(rb: RingbufferP, src: cstring, cnt: csize_t): csize_t {.importc: "jack_ringbuffer_write".}
# void jack_ringbuffer_write_advance (jack_ringbuffer_t *rb, size_t cnt) # void jack_ringbuffer_write_advance (jack_ringbuffer_t *rb, size_t cnt)
proc ringbufferWriteAdvance*(rb: Ringbuffer, cnt: csize_t) {.importc: "jack_ringbuffer_write_advance".} proc ringbufferWriteAdvance*(rb: RingbufferP, cnt: csize_t) {.importc: "jack_ringbuffer_write_advance".}
# size_t jack_ringbuffer_write_space (const jack_ringbuffer_t *rb) # size_t jack_ringbuffer_write_space (const jack_ringbuffer_t *rb)
proc ringbufferWriteSpace*(rb: Ringbuffer): csize_t {.importc: "jack_ringbuffer_write_space".} proc ringbufferWriteSpace*(rb: RingbufferP): csize_t {.importc: "jack_ringbuffer_write_space".}
# ------------------------------- Metadata -------------------------------- # ------------------------------- Metadata --------------------------------
# int jack_set_property (jack_client_t*, jack_uuid_t subject, const char* key, const char* value, const char* type) # int jack_set_property (jack_client_t*, jack_uuid_t subject, const char* key, const char* value, const char* type)
proc setProperty*(client: Client, subject: Uuid, key, value, `type`: cstring): cint {.importc: "jack_set_property", discardable.} 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) # 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", discardable.} 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) # void jack_free_description (jack_description_t* desc, int free_description_itself)
proc freeDescription*(desc: Description, freeDescriptionItself: cint) {.importc: "jack_free_description".} proc freeDescription*(desc: DescriptionP, freeDescriptionItself: cint) {.importc: "jack_free_description".}
# int jack_get_properties (jack_uuid_t subject, jack_description_t* desc) # int jack_get_properties (jack_uuid_t subject, jack_description_t* desc)
proc getProperties*(subject: Uuid, desc: Description): cint {.importc: "jack_get_properties", discardable.} proc getProperties*(subject: Uuid, desc: DescriptionP): cint {.importc: "jack_get_properties".}
# int jack_get_all_properties (jack_description_t** descs) # int jack_get_all_properties (jack_description_t** descs)
proc getAllProperties*(descs: var ptr UncheckedArray[DescriptionT]): cint {.importc: "jack_get_all_properties", discardable.} 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) # int jack_remove_property (jack_client_t* client, jack_uuid_t subject, const char* key)
proc removeProperty*(client: Client, subject: Uuid): cint {.importc: "jack_remove_property", discardable.} proc removeProperty*(client: ClientP, subject: Uuid): cint {.importc: "jack_remove_property".}
# int jack_remove_properties (jack_client_t* client, jack_uuid_t subject) # int jack_remove_properties (jack_client_t* client, jack_uuid_t subject)
proc removeProperties*(client: Client, subject: Uuid): cint {.importc: "jack_remove_properties", discardable.} proc removeProperties*(client: ClientP, subject: Uuid): cint {.importc: "jack_remove_properties".}
# int jack_remove_all_properties (jack_client_t* client) # int jack_remove_all_properties (jack_client_t* client)
proc removeAllProperties*(client: Client): cint {.importc: "jack_remove_all_properties", discardable.} proc removeAllProperties*(client: ClientP): cint {.importc: "jack_remove_all_properties".}
# int jack_set_property_change_callback (jack_client_t* client, JackPropertyChangeCallback callback, void* arg) # int jack_set_property_change_callback (jack_client_t* client, JackPropertyChangeCallback callback, void* arg)
proc setPropertyChangeCallback*(client: Client, callback: PropertyChangeCallback, arg: pointer = nil): cint {. proc setPropertyChangeCallback*(client: ClientP, callback: PropertyChangeCallback, arg: pointer = nil): cint {.
importc: "jack_set_property_change_callback", discardable.} importc: "jack_set_property_change_callback".}
# ---------------------------- Error handling ----------------------------- # ---------------------------- Error handling -----------------------------
# void jack_set_error_function (void(*)(const char *) func)
proc setErrorFunction*(errorCallback: ErrorCallback) {.importc: "jack_set_error_function".} proc setErrorFunction*(errorCallback: ErrorCallback) {.importc: "jack_set_error_function".}
# void jack_set_info_function (void(*)(const char *) func)
proc setInfoFunction*(infoCallback: InfoCallback) {.importc: "jack_set_info_function".} proc setInfoFunction*(infoCallback: InfoCallback) {.importc: "jack_set_info_function".}
{.pop.} {.pop.}