Make things work on Julia v1, use BB for some deps
Removed Compat Switched to BB repo for libportaudio Re-enabled a now-passing pa_shim test
This commit is contained in:
parent
577d7adfef
commit
1f1f721fec
8 changed files with 64 additions and 37 deletions
12
Project.toml
Normal file
12
Project.toml
Normal file
|
@ -0,0 +1,12 @@
|
|||
name = "PortAudio"
|
||||
uuid = "80ea8bcb-4634-5cb3-8ee8-a132660d1d2d"
|
||||
repo = "https://github.com/JuliaAudio/PortAudio.jl.git"
|
||||
version = "1.1.0"
|
||||
|
||||
[deps]
|
||||
BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
|
||||
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
|
||||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
||||
RingBuffers = "f6d8bcc6-4e01-5431-93c4-9d6004abab90"
|
||||
SampledSignals = "bd7594eb-a658-542f-9e75-4c4d8908c167"
|
||||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
2
deps/.gitignore
vendored
Normal file
2
deps/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
build.log
|
||||
deps.jl
|
51
deps/build.jl
vendored
51
deps/build.jl
vendored
|
@ -1,27 +1,40 @@
|
|||
using BinDeps
|
||||
using Compat
|
||||
using Compat.Sys: isapple, iswindows
|
||||
using BinaryProvider # requires BinaryProvider 0.3.0 or later
|
||||
|
||||
@BinDeps.setup
|
||||
# Parse some basic command-line arguments
|
||||
const verbose = "--verbose" in ARGS
|
||||
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
|
||||
products = [
|
||||
LibraryProduct(prefix, ["libportaudio"], :libportaudio),
|
||||
]
|
||||
|
||||
ENV["JULIA_ROOT"] = abspath(Compat.Sys.BINDIR, "../../")
|
||||
# Download binaries from hosted location
|
||||
bin_prefix = "https://github.com/jpsamaroo/PortAudioBuilder/releases/download/v19.6.0"
|
||||
|
||||
# include alias for WinRPM library
|
||||
libportaudio = library_dependency("libportaudio", aliases=["libportaudio-2"])
|
||||
# Listing of files generated by BinaryBuilder:
|
||||
download_info = Dict(
|
||||
Windows(:i686) => ("$bin_prefix/libportaudio.v19.6.0.i686-w64-mingw32.tar.gz", "520efc322259b4eb05d41ba8d22f3b744a611b4b1c4ad651fbdd9160f793b4f1"),
|
||||
Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/libportaudio.v19.6.0.powerpc64le-linux-gnu.tar.gz", "de994973556bd27ac96a02be4ca1f809650de5b4e714492e02bce414cae6f34b"),
|
||||
MacOS(:x86_64) => ("$bin_prefix/libportaudio.v19.6.0.x86_64-apple-darwin14.tar.gz", "406961f35083944e5503dd6a51385c18dfac7969aaa2593e37c1907e353032b7"),
|
||||
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/libportaudio.v19.6.0.x86_64-linux-gnu.tar.gz", "bfb31ffd54fa48802f9af31ecbbae07506baaee52880e6d458a192ea0d6d6a21"),
|
||||
Windows(:x86_64) => ("$bin_prefix/libportaudio.v19.6.0.x86_64-w64-mingw32.tar.gz", "ebd73c312836a1370137335faaa45dee484a50adb183790fa488e7799ebe2299"),
|
||||
)
|
||||
|
||||
# TODO: add other providers with correct names
|
||||
provides(AptGet, "libportaudio2", libportaudio)
|
||||
provides(Pacman, "portaudio", libportaudio)
|
||||
|
||||
|
||||
@static if isapple()
|
||||
using Homebrew
|
||||
provides(Homebrew.HB, "portaudio", libportaudio)
|
||||
# Install unsatisfied or updated dependencies:
|
||||
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
|
||||
dl_info = choose_download(download_info, platform_key_abi())
|
||||
if dl_info === nothing && unsatisfied
|
||||
# If we don't have a compatible .tar.gz to download, complain.
|
||||
# Alternatively, you could attempt to install from a separate provider,
|
||||
# build from source or something even more ambitious here.
|
||||
error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!")
|
||||
end
|
||||
|
||||
@static if iswindows()
|
||||
using WinRPM
|
||||
provides(WinRPM.RPM, "libportaudio2", libportaudio, os = :Windows)
|
||||
# If we have a download, and we are unsatisfied (or the version we're
|
||||
# trying to install is not itself installed) then load it up!
|
||||
if unsatisfied || !isinstalled(dl_info...; prefix=prefix)
|
||||
# Download and install binaries
|
||||
install(dl_info...; prefix=prefix, force=true, verbose=verbose)
|
||||
end
|
||||
|
||||
@BinDeps.install Dict(:libportaudio => :libportaudio, )
|
||||
# Write out a deps.jl file that will contain mappings for our products
|
||||
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose)
|
||||
|
|
|
@ -4,16 +4,21 @@ module PortAudio
|
|||
|
||||
using SampledSignals
|
||||
using RingBuffers
|
||||
#=
|
||||
using Compat
|
||||
using Compat: undef, fetch, @compat
|
||||
using Compat.LinearAlgebra: transpose!
|
||||
using Compat: stdout
|
||||
using Compat.Sys: iswindows
|
||||
=#
|
||||
|
||||
import Base: eltype, show
|
||||
import Base: close, isopen
|
||||
import Base: read, read!, write, flush
|
||||
|
||||
import LinearAlgebra
|
||||
import LinearAlgebra: transpose!
|
||||
|
||||
export PortAudioStream
|
||||
|
||||
|
||||
|
@ -98,7 +103,7 @@ mutable struct PortAudioStream{T}
|
|||
Ptr{Pa_StreamParameters}(0) :
|
||||
Ref(Pa_StreamParameters(outdev.idx, outchans, type_to_fmt[T], 0.0, C_NULL))
|
||||
this = new(sr, blocksize, C_NULL, warn_xruns)
|
||||
@compat finalizer(close, this)
|
||||
finalizer(close, this)
|
||||
this.sink = PortAudioSink{T}(outdev.name, this, outchans, blocksize*2)
|
||||
this.source = PortAudioSource{T}(indev.name, this, inchans, blocksize*2)
|
||||
this.errbuf = RingBuffer{pa_shim_errmsg_t}(1, ERR_BUFSIZE)
|
||||
|
@ -424,7 +429,7 @@ function set_global_callbacks()
|
|||
end
|
||||
|
||||
function suppress_err(dofunc::Function)
|
||||
nullfile = @static iswindows() ? "nul" : "/dev/null"
|
||||
nullfile = @static Sys.iswindows() ? "nul" : "/dev/null"
|
||||
open(nullfile, "w") do io
|
||||
redirect_stdout(dofunc, io)
|
||||
end
|
||||
|
|
|
@ -2,15 +2,15 @@ function find_pa_shim()
|
|||
libdir = joinpath(@__DIR__, "..", "deps", "usr", "lib")
|
||||
libsuffix = ""
|
||||
basename = "pa_shim"
|
||||
@static if Compat.Sys.islinux() && Sys.ARCH == :x86_64
|
||||
@static if Sys.islinux() && Sys.ARCH == :x86_64
|
||||
libsuffix = "x86_64-linux-gnu"
|
||||
elseif Compat.Sys.islinux() && Sys.ARCH == :i686
|
||||
elseif Sys.islinux() && Sys.ARCH == :i686
|
||||
libsuffix = "i686-linux-gnu"
|
||||
elseif Compat.Sys.isapple() && Sys.ARCH == :x86_64
|
||||
elseif Sys.isapple() && Sys.ARCH == :x86_64
|
||||
libsuffix = "x86_64-apple-darwin14"
|
||||
elseif Compat.Sys.iswindows() && Sys.ARCH == :x86_64
|
||||
elseif Sys.iswindows() && Sys.ARCH == :x86_64
|
||||
libsuffix = "x86_64-w64-mingw32"
|
||||
elseif Compat.Sys.iswindows() && Sys.ARCH == :i686
|
||||
elseif Sys.iswindows() && Sys.ARCH == :i686
|
||||
libsuffix = "i686-w64-mingw32"
|
||||
elseif !any(
|
||||
(sfx) -> isfile(joinpath(libdir, "$basename.$sfx")),
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
Compat
|
||||
SampledSignals
|
||||
RingBuffers
|
|
@ -1,11 +1,9 @@
|
|||
#!/usr/bin/env julia
|
||||
|
||||
using Compat
|
||||
using Compat.Test
|
||||
import Compat: Cvoid
|
||||
using PortAudio
|
||||
using SampledSignals
|
||||
using RingBuffers
|
||||
using Test
|
||||
|
||||
# pull in some extra stuff we need to test the callback directly
|
||||
using PortAudio: notifyhandle, notifycb_c, shim_processcb_c
|
||||
|
@ -204,7 +202,7 @@ end
|
|||
end
|
||||
|
||||
@testset "using correct shim version" begin
|
||||
@test_broken PortAudio.shimhash() == "87021557a9f999545828eb11e4ebad2cd278b734dd91a8bd3faf05c89912cf80"
|
||||
@test PortAudio.shimhash() == "87021557a9f999545828eb11e4ebad2cd278b734dd91a8bd3faf05c89912cf80"
|
||||
end
|
||||
|
||||
@testset "Basic callback functionality" begin
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
include("runtests.jl")
|
||||
|
||||
# these default values are specific to my machines
|
||||
if Compat.Sys.iswindows()
|
||||
if Sys.iswindows()
|
||||
default_indev = "Microphone Array (Realtek High "
|
||||
default_outdev = "Speaker/Headphone (Realtek High"
|
||||
elseif Compat.Sys.isapple()
|
||||
elseif Sys.isapple()
|
||||
default_indev = "Built-in Microphone"
|
||||
default_outdev = "Built-in Output"
|
||||
elseif Compat.Sys.islinux()
|
||||
elseif Sys.islinux()
|
||||
default_indev = "default"
|
||||
default_outdev = "default"
|
||||
end
|
||||
|
@ -50,7 +50,7 @@ end
|
|||
write(stream, buf)
|
||||
io = IOBuffer()
|
||||
show(io, stream)
|
||||
@test Compat.occursin("""
|
||||
@test occursin("""
|
||||
PortAudioStream{Float32}
|
||||
Samplerate: 44100.0Hz
|
||||
Buffer Size: 4096 frames
|
||||
|
|
Loading…
Reference in a new issue