Skip to content

Commit

Permalink
Make ALSA_PLUGIN_DIR env variable available during precompilation
Browse files Browse the repository at this point in the history
  • Loading branch information
gnadt committed Apr 16, 2024
1 parent 00709e8 commit f7c24b6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/PortAudio.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
module PortAudio

using alsa_plugins_jll: alsa_plugins_jll
if Sys.islinux()
using alsa_plugins_jll
# the plugin folder will contain plugins for, critically, PulseAudio
plugin_folder = "ALSA_PLUGIN_DIR"
if plugin_folder keys(ENV) && alsa_plugins_jll.is_available()
ENV[plugin_folder] = joinpath(alsa_plugins_jll.artifact_dir, "lib", "alsa-lib")
end
end

import Base:
close,
eltype,
Expand Down Expand Up @@ -136,11 +144,6 @@ function __init__()
ENV[config_folder] =
seek_alsa_conf(("/usr/share/alsa", "/usr/local/share/alsa", "/etc/alsa"))
end
# the plugin folder will contain plugins for, critically, PulseAudio
plugin_folder = "ALSA_PLUGIN_DIR"
if plugin_folder keys(ENV) && alsa_plugins_jll.is_available()
ENV[plugin_folder] = joinpath(alsa_plugins_jll.artifact_dir, "lib", "alsa-lib")
end
end
initialize()
atexit(() -> terminate())
Expand Down Expand Up @@ -245,7 +248,7 @@ function read_or_write(a_function, buffer, use_frames = buffer.frames_per_buffer
pointer_to = buffer.pointer_to
data = buffer.data
handle_status(
if acquire_lock
if acquire_lock
# because we're calling Pa_ReadStream and Pa_WriteStream from separate threads,
# we put a lock around these calls
lock(
Expand Down Expand Up @@ -736,7 +739,7 @@ function PortAudioStream(
stream_lock = ReentrantLock(),
user_data = C_NULL,
warn_xruns = true,
writer = SampledSignalsWriter(),
writer = SampledSignalsWriter(),
)
input_channels_filled = fill_max_channels(
"input",
Expand Down

0 comments on commit f7c24b6

Please sign in to comment.