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)
|
wait(source.ringbuf)
|
||||||
end
|
end
|
||||||
# in 0.4 transpose! throws an error if the range is a UInt
|
# 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))
|
read!(source.ringbuf, source.chunkbuf, toread*nchannels(source))
|
||||||
# de-interleave the samples
|
# de-interleave the samples
|
||||||
# TODO: don't directly access buf.data
|
# TODO: don't directly access buf.data
|
||||||
|
|
|
@ -117,8 +117,8 @@ using RingBuffers
|
||||||
end
|
end
|
||||||
@testset "Samplerate-converting writing" begin
|
@testset "Samplerate-converting writing" begin
|
||||||
stream = PortAudioStream()
|
stream = PortAudioStream()
|
||||||
write(stream, SinSource(eltype(stream), samplerate(stream)*0.8, [220Hz, 330Hz]), 10s)
|
write(stream, SinSource(eltype(stream), samplerate(stream)*0.5, [220Hz, 330Hz]), 3s)
|
||||||
write(stream, SinSource(eltype(stream), samplerate(stream)*1.2, [220Hz, 330Hz]), 10s)
|
write(stream, SinSource(eltype(stream), samplerate(stream)*1.5, [220Hz, 330Hz]), 3s)
|
||||||
flush(stream)
|
flush(stream)
|
||||||
close(stream)
|
close(stream)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue