fixes error with multichannel reading
This commit is contained in:
parent
ede482ce6f
commit
2cc49cc3e0
2 changed files with 4 additions and 3 deletions
|
@ -278,7 +278,8 @@ function SampledSignals.unsafe_read!(source::PortAudioSource, buf::SampleBuf)
|
|||
wait(source.ringbuf)
|
||||
end
|
||||
# in 0.4 transpose! throws an error if the range is a UInt
|
||||
toread = Int(min(nreadable(source.ringbuf), CHUNKSIZE, total-nread))
|
||||
readable = div(nreadable(source.ringbuf), nchannels(source))
|
||||
toread = Int(min(readable, CHUNKSIZE, total-nread))
|
||||
read!(source.ringbuf, source.chunkbuf, toread*nchannels(source))
|
||||
# de-interleave the samples
|
||||
# TODO: don't directly access buf.data
|
||||
|
|
|
@ -117,8 +117,8 @@ using RingBuffers
|
|||
end
|
||||
@testset "Samplerate-converting writing" begin
|
||||
stream = PortAudioStream()
|
||||
write(stream, SinSource(eltype(stream), samplerate(stream)*0.8, [220Hz, 330Hz]), 10s)
|
||||
write(stream, SinSource(eltype(stream), samplerate(stream)*1.2, [220Hz, 330Hz]), 10s)
|
||||
write(stream, SinSource(eltype(stream), samplerate(stream)*0.5, [220Hz, 330Hz]), 3s)
|
||||
write(stream, SinSource(eltype(stream), samplerate(stream)*1.5, [220Hz, 330Hz]), 3s)
|
||||
flush(stream)
|
||||
close(stream)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue