From 34d30935053e76561f4a96cd6a0ffaa2a02a25a2 Mon Sep 17 00:00:00 2001 From: Christopher Arndt Date: Tue, 23 May 2023 02:25:04 +0200 Subject: [PATCH] feat: wrap metadata API and add one usage example Signed-off-by: Christopher Arndt --- examples/jacket_list_all_properties.nim | 46 ++++++++++++++++++++ src/jacket.nim | 57 +++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 examples/jacket_list_all_properties.nim diff --git a/examples/jacket_list_all_properties.nim b/examples/jacket_list_all_properties.nim new file mode 100644 index 0000000..325847a --- /dev/null +++ b/examples/jacket_list_all_properties.nim @@ -0,0 +1,46 @@ +import std/[logging, strformat] +import jacket + +var + jclient: ClientP + status: cint + descs: ptr UncheckedArray[Description] + +var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug) + +proc errorCb(msg: cstring) {.cdecl.} = + # Suppress verbose JACK error messages when server is not available by + # default. Pass ``lvlAll`` when creating the logger to enable them. + debug "JACK error: " & $msg + +addHandler(log) +setErrorFunction(errorCb) +jclient = clientOpen("jacket_property", NullOption.ord, status.addr) +debug "JACK server status: " & $status + +if jclient == nil: + error getJackStatusErrorString(status) + quit 1 + +let numDescs = getAllProperties(descs) + +if numDescs != -1: + var desc: Description + + for i in 0.. 0: + for p in 0..