Compare commits
3 commits
master
...
skip-locks
Author | SHA1 | Date | |
---|---|---|---|
|
f5d085abe0 | ||
|
c2dd137a1b | ||
|
79ceac0282 |
2 changed files with 4 additions and 19 deletions
|
@ -48,7 +48,6 @@ using .LibPortAudio:
|
|||
Pa_Initialize,
|
||||
paInputOverflowed,
|
||||
Pa_IsStreamStopped,
|
||||
paNoDevice,
|
||||
paNoFlag,
|
||||
Pa_OpenStream,
|
||||
paOutputUnderflowed,
|
||||
|
@ -196,22 +195,12 @@ function show(io::IO, device::PortAudioDevice)
|
|||
print(io, device.output_bounds.max_channels)
|
||||
end
|
||||
|
||||
function check_device_exists(device_index, device_type)
|
||||
if device_index == paNoDevice
|
||||
throw(ArgumentError("No $device_type device available"))
|
||||
end
|
||||
end
|
||||
|
||||
function get_default_input_index()
|
||||
device_index = Pa_GetDefaultInputDevice()
|
||||
check_device_exists(device_index, "input")
|
||||
device_index
|
||||
handle_status(Pa_GetDefaultInputDevice())
|
||||
end
|
||||
|
||||
function get_default_output_index()
|
||||
device_index = Pa_GetDefaultOutputDevice()
|
||||
check_device_exists(device_index, "output")
|
||||
device_index
|
||||
handle_status(Pa_GetDefaultOutputDevice())
|
||||
end
|
||||
|
||||
# we can look up devices by index or name
|
||||
|
|
|
@ -11,7 +11,6 @@ using PortAudio:
|
|||
get_output_type,
|
||||
handle_status,
|
||||
initialize,
|
||||
name,
|
||||
PortAudioException,
|
||||
PortAudio,
|
||||
PortAudioDevice,
|
||||
|
@ -19,7 +18,7 @@ using PortAudio:
|
|||
safe_load,
|
||||
seek_alsa_conf,
|
||||
terminate,
|
||||
write_buffer
|
||||
name
|
||||
using PortAudio.LibPortAudio:
|
||||
Pa_AbortStream,
|
||||
PaError,
|
||||
|
@ -110,9 +109,7 @@ using Test: @test, @test_logs, @test_nowarn, @testset, @test_throws
|
|||
initialize()
|
||||
end
|
||||
|
||||
if isempty(devices())
|
||||
@test_throws ArgumentError("No input device available") get_default_input_index()
|
||||
else
|
||||
if !isempty(devices())
|
||||
@testset "Tests with sound" begin
|
||||
# these default values are specific to local machines
|
||||
input_name = get_device(get_default_input_index()).name
|
||||
|
@ -133,7 +130,6 @@ else
|
|||
sleep(1)
|
||||
println("Testing pass-through")
|
||||
stream = PortAudioStream(input_name, output_name, 2, 2; adjust_channels = true)
|
||||
write_buffer(stream.sink_messenger.buffer, acquire_lock = false)
|
||||
sink = stream.sink
|
||||
source = stream.source
|
||||
@test sprint(show, stream) == """
|
||||
|
|
Loading…
Reference in a new issue