diff --git a/.gitignore b/.gitignore index d86d68c..d7bc517 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ *.swp -*.so *.o deps/deps.jl *.wav diff --git a/LICENSE b/LICENSE index 0f797a9..04c37c2 100644 --- a/LICENSE +++ b/LICENSE @@ -19,3 +19,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +suppressor.jl includes code from the Suppressor.jl package, licensed under the +MIT "Expat" License: + +Copyright (c) 2016: Ismael Venegas Castelló. diff --git a/REQUIRE b/REQUIRE index 297f03f..3a091fe 100644 --- a/REQUIRE +++ b/REQUIRE @@ -2,6 +2,5 @@ julia 0.6- BinDeps SampledSignals 0.3.0 RingBuffers 1.0.0 -Suppressor @osx Homebrew @windows WinRPM diff --git a/deps/src/Makefile b/deps/src/Makefile index 160c4bd..7c87b0a 100644 --- a/deps/src/Makefile +++ b/deps/src/Makefile @@ -17,7 +17,7 @@ endif # file extensions and platform-specific libs ifeq ($(OS), WINNT) LIBS += - LDFLAGS += -L../../../RingBuffers/deps/usr/lib -lpa_ringbuffer + LDFLAGS += -shared -L../../../RingBuffers/deps/usr/lib -lpa_ringbuffer INC += SHACMD = sha256sum SHLIB_EXT = dll @@ -32,7 +32,7 @@ else ifeq ($(OS), Darwin) else LIBS += INC += - LDFLAGS += -L../../../RingBuffers/deps/usr/lib -lpa_ringbuffer + LDFLAGS += -shared SHLIB_EXT = so SHACMD = sha256sum endif diff --git a/deps/usr/lib/pa_shim.so b/deps/usr/lib/pa_shim.so new file mode 100755 index 0000000..228a44d Binary files /dev/null and b/deps/usr/lib/pa_shim.so differ diff --git a/src/PortAudio.jl b/src/PortAudio.jl index 46d3daf..61841e6 100644 --- a/src/PortAudio.jl +++ b/src/PortAudio.jl @@ -4,7 +4,7 @@ module PortAudio using SampledSignals using RingBuffers -using Suppressor +#using Suppressor using Base: AsyncCondition @@ -14,6 +14,7 @@ import Base: read, read!, write, flush # Get binary dependencies loaded from BinDeps include("../deps/deps.jl") +include("suppressor.jl") include("pa_shim.jl") include("libportaudio.jl") diff --git a/src/pa_shim.jl b/src/pa_shim.jl index 040b896..acd81fa 100644 --- a/src/pa_shim.jl +++ b/src/pa_shim.jl @@ -1,8 +1,7 @@ -const libpa_shim = Libdl.find_library( - ["pa_shim"], - [joinpath(dirname(@__FILE__), "..", "deps", "usr", "lib")]) - function init_pa_shim() + global const libpa_shim = Libdl.find_library( + ["pa_shim"], + [joinpath(dirname(@__FILE__), "..", "deps", "usr", "lib")]) shim_dlib = Libdl.dlopen(libpa_shim) # pointer to the shim's process callback global const shim_processcb_c = Libdl.dlsym(shim_dlib, :pa_shim_processcb) diff --git a/src/suppressor.jl b/src/suppressor.jl new file mode 100644 index 0000000..ab297bc --- /dev/null +++ b/src/suppressor.jl @@ -0,0 +1,20 @@ +# while waiting for this PR to get merged: https://github.com/Ismael-VC/Suppressor.jl/pull/12 +# we'll just include the relevant code here + +macro suppress_err(block) + quote + if ccall(:jl_generating_output, Cint, ()) == 0 + ORIGINAL_STDERR = STDERR + err_rd, err_wr = redirect_stderr() + err_reader = @async readstring(err_rd) + end + + value = $(esc(block)) + + if ccall(:jl_generating_output, Cint, ()) == 0 + redirect_stderr(ORIGINAL_STDERR) + close(err_wr) + end + value + end +end diff --git a/test/runtests.jl b/test/runtests.jl index 5cade49..f6df19d 100755 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -201,8 +201,7 @@ end PortAudio.versioninfo(io) result = split(String(take!((io))), "\n") # make sure this is the same version I tested with - @test startswith(result[1], "PortAudio V19-devel") - @test result[2] == "Version: 1899" + @test startswith(result[1], "PortAudio V19") @test result[3] == "Shim Source Hash: 4ea2a8526b" end