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