feat: improve jack library path detection

This commit is contained in:
Christopher Arndt 2022-10-09 09:13:05 +02:00
parent 967c4ad161
commit 34e6171e3f
1 changed files with 10 additions and 14 deletions

View File

@ -1,27 +1,22 @@
# 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
#
# MacOS:
# * /usr/local/lib/libjack.dylib
# * /opt/homebrew/lib/libjack.dylib
# * /opt/local/lib/libjack.dylib
# Win:
# * libjack64.dll
# * libjack.dll
# Unix:
# * libjack.so.0
proc getJackLibName: string = proc getJackLibName: string =
when system.hostOS == "windows": when system.hostOS == "windows":
result = "libjack.dll" when sizeof(int) == 4:
result = "libjack.dll"
else:
result = "libjack64.dll"
elif system.hostOS == "macosx": elif system.hostOS == "macosx":
result = "libjack.dylib" result = "(|/usr/local/lib/|/opt/homebrew/lib/|/opt/local/lib/)libjack.dylib"
else: else:
result = "libjack.so.0" result = "libjack.so.0"
{.push dynlib: getJackLibName().} {.push dynlib: getJackLibName().}
# ------------------------------ Constants --------------------------------
const const
JACK_MAX_FRAMES* = (4294967295'i64) JACK_MAX_FRAMES* = (4294967295'i64)
JACK_LOAD_INIT_LIMIT* = 1024 JACK_LOAD_INIT_LIMIT* = 1024
@ -43,7 +38,6 @@ type
PortT = distinct object PortT = distinct object
PortTPtr* = ptr PortT PortTPtr* = ptr PortT
type type
JackOptions* {.size: sizeof(cint) pure.} = enum JackOptions* {.size: sizeof(cint) pure.} = enum
NullOption = 0x00, NullOption = 0x00,
@ -455,6 +449,8 @@ proc setInfoFunction*(infoCallback: JackInfoCallback) {.importc: "jack_set_info_
{.pop.} {.pop.}
# --------------------------- Helper functions ----------------------------
proc getJackStatusErrorString*(status: cint): string = proc getJackStatusErrorString*(status: cint): string =
# Get JACK error status as string. # Get JACK error status as string.
if status == Success.ord: if status == Success.ord: