This commit is contained in:
Brandon Taylor 2021-06-22 23:36:56 -04:00
parent 36f85795cd
commit 0c335dc50d
2 changed files with 7 additions and 12 deletions

View file

@ -28,8 +28,8 @@ using .LibPortAudio:
Pa_GetHostApiInfo,
Pa_GetStreamReadAvailable,
Pa_GetStreamWriteAvailable,
Pa_GetVersionText,
Pa_GetVersion,
Pa_GetVersionText,
PaHostApiTypeId,
Pa_Initialize,
paInputOverflowed,
@ -749,16 +749,8 @@ end
# both reading and writing will outsource to the reading and writing demons
# so we just need to pass inputs in and take outputs out
function exchange(messanger, arguments...)
inputs = messanger.inputs
if isopen(inputs)
put!(inputs, arguments)
outputs = messanger.outputs
if isopen(outputs)
return take!(outputs)
end
end
# if either the input or output channel is closed, no frames can be read or written
0
put!(messanger.inputs, arguments)
take!(messanger.outputs)
end
function unsafe_write(sink::PortAudioSink, julia_buffer::Array, offset, frame_count)

View file

@ -30,6 +30,7 @@ using PortAudio.LibPortAudio:
Pa_GetStreamReadAvailable,
Pa_GetStreamTime,
Pa_GetStreamWriteAvailable,
Pa_GetVersionInfo,
Pa_HostApiDeviceIndexToDeviceIndex,
paHostApiNotFound,
Pa_HostApiTypeIdToHostApiIndex,
@ -48,7 +49,8 @@ using PortAudio.LibPortAudio:
Pa_StopStream,
PaStream,
PaStreamInfo,
PaStreamParameters
PaStreamParameters,
PaVersionInfo
using SampledSignals: nchannels, s, SampleBuf, samplerate, SinSource
using Test: @test, @test_logs, @test_nowarn, @testset, @test_throws
@ -68,6 +70,7 @@ using Test: @test, @test_logs, @test_nowarn, @testset, @test_throws
@testset "libortaudio without sound" begin
@test handle_status(Pa_GetHostApiCount()) >= 0
@test handle_status(Pa_GetDefaultHostApi()) >= 0
@test safe_load(Pa_GetVersionInfo(),ErrorException("no info")) isa PaVersionInfo
@test safe_load(Pa_GetLastHostErrorInfo(), ErrorException("no info")) isa
PaHostErrorInfo
@test PaErrorCode(Pa_IsFormatSupported(C_NULL, C_NULL, 0.0)) == paInvalidDevice