fix, add test
This commit is contained in:
parent
380f8811de
commit
3f762f8ad2
2 changed files with 19 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
||||||
module PortAudio
|
module PortAudio
|
||||||
|
|
||||||
using libportaudio_jll: libportaudio_jll
|
using libportaudio_jll: libportaudio
|
||||||
using SampledSignals
|
using SampledSignals
|
||||||
using Suppressor: @capture_err
|
using Suppressor: @capture_err
|
||||||
|
|
||||||
|
@ -15,6 +15,15 @@ export PortAudioStream
|
||||||
|
|
||||||
include("libportaudio.jl")
|
include("libportaudio.jl")
|
||||||
|
|
||||||
|
macro stderr_as_debug(expression)
|
||||||
|
quote
|
||||||
|
local result
|
||||||
|
debug_message = @capture_err result = $(esc(expression))
|
||||||
|
@debug "$debug_message"
|
||||||
|
result
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# This size is in frames
|
# This size is in frames
|
||||||
|
|
||||||
# data is passed to and from portaudio in chunks with this many frames, because
|
# data is passed to and from portaudio in chunks with this many frames, because
|
||||||
|
@ -367,14 +376,6 @@ function discard_input(source::PortAudioSource)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
macro stderr_as_debug(expression)
|
|
||||||
quote
|
|
||||||
debug_message = @capture_err result = $(esc(expression))
|
|
||||||
@debug debug_message
|
|
||||||
result
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function __init__()
|
function __init__()
|
||||||
if Sys.islinux()
|
if Sys.islinux()
|
||||||
envkey = "ALSA_CONFIG_DIR"
|
envkey = "ALSA_CONFIG_DIR"
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
#!/usr/bin/env julia
|
#!/usr/bin/env julia
|
||||||
|
|
||||||
|
using Logging: Debug
|
||||||
using PortAudio
|
using PortAudio
|
||||||
using PortAudio: Pa_GetDefaultInputDevice, Pa_GetDefaultOutputDevice, Pa_GetDeviceInfo, Pa_GetHostApiInfo, PortAudioDevice
|
using PortAudio: Pa_GetDefaultInputDevice, Pa_GetDefaultOutputDevice, Pa_GetDeviceInfo, Pa_GetHostApiInfo, PortAudioDevice, @stderr_as_debug
|
||||||
using Test
|
using Test
|
||||||
using SampledSignals
|
using SampledSignals
|
||||||
|
|
||||||
|
@testset "Debug messages" begin
|
||||||
|
@test_logs (:debug, "hi") min_level = Debug @test_nowarn @stderr_as_debug begin
|
||||||
|
print(stderr, "hi")
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@testset "PortAudio Tests" begin
|
@testset "PortAudio Tests" begin
|
||||||
@testset "Reports version" begin
|
@testset "Reports version" begin
|
||||||
io = IOBuffer()
|
io = IOBuffer()
|
||||||
|
|
Loading…
Reference in a new issue