adds ability to open device by name
This commit is contained in:
parent
738c4cff4b
commit
e51c980f24
1 changed files with 16 additions and 0 deletions
|
@ -75,6 +75,14 @@ function PortAudioSink(device::PortAudioDevice, eltype=Float32, sr=48000Hz, chan
|
||||||
PortAudioSink(eltype, stream, sr, channels, bufsize)
|
PortAudioSink(eltype, stream, sr, channels, bufsize)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function PortAudioSink(devname::AbstractString, args...)
|
||||||
|
for d in devices()
|
||||||
|
if d.name == devname
|
||||||
|
return PortAudioSink(d, args...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function PortAudioSource(eltype=Float32, sr=48000Hz, channels=2, bufsize=DEFAULT_BUFSIZE)
|
function PortAudioSource(eltype=Float32, sr=48000Hz, channels=2, bufsize=DEFAULT_BUFSIZE)
|
||||||
stream = Pa_OpenDefaultStream(channels, 0, type_to_fmt[eltype], float(sr), bufsize)
|
stream = Pa_OpenDefaultStream(channels, 0, type_to_fmt[eltype], float(sr), bufsize)
|
||||||
PortAudioSource(eltype, stream, sr, channels, bufsize)
|
PortAudioSource(eltype, stream, sr, channels, bufsize)
|
||||||
|
@ -86,6 +94,14 @@ function PortAudioSource(device::PortAudioDevice, eltype=Float32, sr=48000Hz, ch
|
||||||
PortAudioSource(eltype, stream, sr, channels, bufsize)
|
PortAudioSource(eltype, stream, sr, channels, bufsize)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function PortAudioSource(devname::AbstractString, args...)
|
||||||
|
for d in devices()
|
||||||
|
if d.name == devname
|
||||||
|
return PortAudioSource(d, args...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# most of these methods are the same for Sources and Sinks, so define them on
|
# most of these methods are the same for Sources and Sinks, so define them on
|
||||||
# the union
|
# the union
|
||||||
|
|
Loading…
Reference in a new issue