don't prefill empty output (#72)
This commit is contained in:
parent
5bdd8975a9
commit
0187b4937d
2 changed files with 9 additions and 7 deletions
|
@ -345,12 +345,14 @@ end
|
|||
Fill the playback buffer of the given sink.
|
||||
"""
|
||||
function prefill_output(sink::PortAudioSink)
|
||||
towrite = Pa_GetStreamWriteAvailable(sink.stream.stream)
|
||||
while towrite > 0
|
||||
n = min(towrite, CHUNKFRAMES)
|
||||
fill!(sink.chunkbuf, zero(eltype(sink.chunkbuf)))
|
||||
Pa_WriteStream(sink.stream.stream, sink.chunkbuf, n, false)
|
||||
towrite -= n
|
||||
if nchannels(sink) > 0
|
||||
towrite = Pa_GetStreamWriteAvailable(sink.stream.stream)
|
||||
while towrite > 0
|
||||
n = min(towrite, CHUNKFRAMES)
|
||||
fill!(sink.chunkbuf, zero(eltype(sink.chunkbuf)))
|
||||
Pa_WriteStream(sink.stream.stream, sink.chunkbuf, n, false)
|
||||
towrite -= n
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ end
|
|||
# end
|
||||
#
|
||||
# General utility function to handle the status from the Pa_* functions
|
||||
function handle_status(err::PaError, show_warnings::Bool=true)
|
||||
function handle_status(err::Integer, show_warnings::Bool=true)
|
||||
if err == PA_OUTPUT_UNDERFLOWED || err == PA_INPUT_OVERFLOWED
|
||||
if show_warnings
|
||||
msg = @locked ccall((:Pa_GetErrorText, libportaudio),
|
||||
|
|
Loading…
Reference in a new issue