adds auto-detection of ALSA config dir
This commit is contained in:
parent
9eb565e487
commit
16d0bc48be
1 changed files with 26 additions and 1 deletions
|
@ -305,7 +305,32 @@ function suppress_err(dofunc::Function)
|
||||||
end
|
end
|
||||||
|
|
||||||
function __init__()
|
function __init__()
|
||||||
ENV["ALSA_CONFIG_DIR"] = "/usr/share/alsa"
|
envkey = "ALSA_CONFIG_DIR"
|
||||||
|
if envkey ∉ keys(ENV)
|
||||||
|
searchdirs = ["/usr/share/alsa",
|
||||||
|
"/usr/local/share/alsa",
|
||||||
|
"/etc/alsa"]
|
||||||
|
confdir_idx = findfirst(searchdirs) do d
|
||||||
|
isfile(joinpath(d, "alsa.conf"))
|
||||||
|
end
|
||||||
|
if confdir_idx === nothing
|
||||||
|
throw(ErrorException(
|
||||||
|
"""
|
||||||
|
Could not find ALSA config directory. Searched:
|
||||||
|
$(join(searchdirs, "\n"))
|
||||||
|
|
||||||
|
if ALSA is installed, set the "ALSA_CONFIG_DIR" environment
|
||||||
|
variable. The given directory should have a file "alsa.conf".
|
||||||
|
|
||||||
|
If it would be useful to others, please file an issue at
|
||||||
|
https://github.com/JuliaAudio/PortAudio.jl/issues
|
||||||
|
with your alsa config directory so we can add it to the search
|
||||||
|
paths.
|
||||||
|
"""))
|
||||||
|
end
|
||||||
|
confdir = searchdirs[confdir_idx]
|
||||||
|
ENV[envkey] = confdir
|
||||||
|
end
|
||||||
# initialize PortAudio on module load
|
# initialize PortAudio on module load
|
||||||
# suppress_err() do
|
# suppress_err() do
|
||||||
Pa_Initialize()
|
Pa_Initialize()
|
||||||
|
|
Loading…
Reference in a new issue