work with vector buffers (#109)

* work with vector buffers

* no redundant tests
This commit is contained in:
bramtayl 2022-03-09 17:24:25 -05:00 committed by GitHub
parent 9c701415c0
commit 78a0a9918d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -18,8 +18,6 @@ jobs:
matrix:
version:
- '1.3'
- '1.4'
- '1.5'
- '1'
- 'nightly'
os:

View file

@ -1005,6 +1005,9 @@ function exchange(messenger, arguments...)
take!(messenger.output_channel)
end
as_matrix(matrix::Matrix) = matrix
as_matrix(vector::Vector) = reshape(vector, length(vector), 1)
# these will only work with sampledsignals scribes
function unsafe_write(
sink::PortAudioSink{<:Messenger{<:Any, <:SampledSignalsWriter}},
@ -1012,7 +1015,7 @@ function unsafe_write(
already,
frame_count,
)
exchange(sink.stream.sink_messanger, julia_buffer, already, frame_count)
exchange(sink.stream.sink_messanger, as_matrix(julia_buffer), already, frame_count)
end
function unsafe_read!(
@ -1021,7 +1024,7 @@ function unsafe_read!(
already,
frame_count,
)
exchange(source.stream.source_messanger, julia_buffer, already, frame_count)
exchange(source.stream.source_messanger, as_matrix(julia_buffer), already, frame_count)
end
end # module PortAudio