2022-10-09 09:43:13 +02:00
|
|
|
import std/logging
|
2022-10-06 04:18:57 +02:00
|
|
|
import jacket
|
|
|
|
|
2023-05-22 05:13:31 +02:00
|
|
|
var jclient: ClientP
|
2022-10-06 04:18:57 +02:00
|
|
|
var status: cint
|
2022-10-09 21:59:40 +02:00
|
|
|
var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2022-10-09 09:43:13 +02:00
|
|
|
proc errorCb(msg: cstring) {.cdecl.} =
|
2023-05-22 04:00:07 +02:00
|
|
|
# Suppress verbose JACK error messages when server is not available by
|
2022-10-09 09:43:13 +02:00
|
|
|
# default. Pass ``lvlAll`` when creating the logger to enable them.
|
|
|
|
debug "JACK error: " & $msg
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2022-10-09 09:43:13 +02:00
|
|
|
addHandler(log)
|
|
|
|
setErrorFunction(errorCb)
|
2022-10-10 20:35:00 +02:00
|
|
|
jclient = clientOpen("jacket_info", NullOption.ord, status.addr)
|
|
|
|
debug "JACK server status: " & $status
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2022-10-06 16:28:25 +02:00
|
|
|
if jclient == nil:
|
2022-10-09 09:43:13 +02:00
|
|
|
error getJackStatusErrorString(status)
|
2022-10-06 04:18:57 +02:00
|
|
|
quit 1
|
|
|
|
|
2022-10-09 09:43:13 +02:00
|
|
|
echo("JACK version: ", getVersionString())
|
|
|
|
echo("Sample rate: ", jclient.getSampleRate)
|
|
|
|
echo("Buffer size: ", jclient.getBufferSize)
|
|
|
|
echo("DSP load: ", jclient.cpuLoad, "%")
|
|
|
|
echo("Server time: ", getTime())
|
|
|
|
echo("Client name: ", jclient.getClientName)
|
|
|
|
echo("RT enabled: ", if jclient.isRealtime > 0: "yes" else: "no")
|
2022-10-06 04:18:57 +02:00
|
|
|
|
2022-10-09 09:43:13 +02:00
|
|
|
discard jclient.clientClose
|