jacket/examples/jacket_info.nim

30 lines
914 B
Nim
Raw Permalink Normal View History

2022-10-09 09:43:13 +02:00
import std/logging
import jacket
var status: cint
var log = newConsoleLogger(when defined(release): lvlInfo else: lvlDebug)
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-09 09:43:13 +02:00
addHandler(log)
setErrorFunction(errorCb)
var jclient = clientOpen("jacket_info", NullOption, status.addr)
debug "JACK server status: " & $status
if jclient == nil:
2022-10-09 09:43:13 +02:00
error getJackStatusErrorString(status)
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("RT enabled: ", if jclient.isRealtime > 0: "yes" else: "no")
2022-10-09 09:43:13 +02:00
echo("DSP load: ", jclient.cpuLoad, "%")
echo("Server time: ", getTime())
echo("Client name: ", jclient.getClientName)
2022-10-09 09:43:13 +02:00
discard jclient.clientClose