jacket/examples/test_jacket.nim

31 lines
894 B
Nim
Raw Normal View History

2022-10-09 09:43:13 +02:00
import std/logging
import jacket
var jclient: ClientTPtr
var status: cint
2022-10-09 09:43:13 +02:00
var log = newConsoleLogger(lvlInfo)
2022-10-09 09:43:13 +02:00
proc errorCb(msg: cstring) {.cdecl.} =
# Suppress verbose JACK error messges when server is not available by
# 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)
jclient = clientOpen("test_jacket", NullOption.ord, status.addr)
debug "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("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-09 09:43:13 +02:00
discard jclient.clientClose