bumps latency for more reliable performance
This commit is contained in:
parent
f123478231
commit
d069e75a9f
1 changed files with 12 additions and 2 deletions
|
@ -67,6 +67,15 @@ mutable struct PortAudioStream{T}
|
||||||
|
|
||||||
# this inner constructor is generally called via the top-level outer
|
# this inner constructor is generally called via the top-level outer
|
||||||
# constructor below
|
# constructor below
|
||||||
|
|
||||||
|
# TODO: handle blocksize=0, that should be the default and generally works
|
||||||
|
# much better than trying to specify
|
||||||
|
# TODO: expose latency parameter
|
||||||
|
# TODO: pre-fill outbut buffer on init
|
||||||
|
# TODO: recover from xruns - currently with low latencies (e.g. 0.01) it
|
||||||
|
# will run fine for a while and then fail with the first xrun.
|
||||||
|
# TODO: figure out whether we can get deterministic latency...
|
||||||
|
# TODO: write a latency tester app
|
||||||
function PortAudioStream{T}(indev::PortAudioDevice, outdev::PortAudioDevice,
|
function PortAudioStream{T}(indev::PortAudioDevice, outdev::PortAudioDevice,
|
||||||
inchans, outchans, sr, blocksize,
|
inchans, outchans, sr, blocksize,
|
||||||
warn_xruns) where {T}
|
warn_xruns) where {T}
|
||||||
|
@ -74,10 +83,10 @@ mutable struct PortAudioStream{T}
|
||||||
outchans = outchans == -1 ? outdev.maxoutchans : outchans
|
outchans = outchans == -1 ? outdev.maxoutchans : outchans
|
||||||
inparams = (inchans == 0) ?
|
inparams = (inchans == 0) ?
|
||||||
Ptr{Pa_StreamParameters}(0) :
|
Ptr{Pa_StreamParameters}(0) :
|
||||||
Ref(Pa_StreamParameters(indev.idx, inchans, type_to_fmt[T], 0.0, C_NULL))
|
Ref(Pa_StreamParameters(indev.idx, inchans, type_to_fmt[T], 0.1, C_NULL))
|
||||||
outparams = (outchans == 0) ?
|
outparams = (outchans == 0) ?
|
||||||
Ptr{Pa_StreamParameters}(0) :
|
Ptr{Pa_StreamParameters}(0) :
|
||||||
Ref(Pa_StreamParameters(outdev.idx, outchans, type_to_fmt[T], 0.0, C_NULL))
|
Ref(Pa_StreamParameters(outdev.idx, outchans, type_to_fmt[T], 0.1, C_NULL))
|
||||||
this = new(sr, blocksize, C_NULL, warn_xruns)
|
this = new(sr, blocksize, C_NULL, warn_xruns)
|
||||||
# finalizer(close, this)
|
# finalizer(close, this)
|
||||||
this.sink = PortAudioSink{T}(outdev.name, this, outchans)
|
this.sink = PortAudioSink{T}(outdev.name, this, outchans)
|
||||||
|
@ -199,6 +208,7 @@ end
|
||||||
isopen(stream::PortAudioStream) = stream.stream != C_NULL
|
isopen(stream::PortAudioStream) = stream.stream != C_NULL
|
||||||
|
|
||||||
SampledSignals.samplerate(stream::PortAudioStream) = stream.samplerate
|
SampledSignals.samplerate(stream::PortAudioStream) = stream.samplerate
|
||||||
|
SampledSignals.blocksize(stream::PortAudioStream) = stream.blocksize
|
||||||
eltype(stream::PortAudioStream{T}) where T = T
|
eltype(stream::PortAudioStream{T}) where T = T
|
||||||
|
|
||||||
read(stream::PortAudioStream, args...) = read(stream.source, args...)
|
read(stream::PortAudioStream, args...) = read(stream.source, args...)
|
||||||
|
|
Loading…
Reference in a new issue