write-pcm-to-buffer ( vorbis-stream offset pcm len -- offset' )


Vocabulary
audio.vorbis.private

Inputs
vorbis-streaman object
offsetan object
pcman object
lenan object


Outputs
offset'an object


Definition


:: write-pcm-to-buffer
( vorbis-stream offset pcm len -- offset' )
vorbis-stream buffer>> :> buffer buffer length -1 shift
:> buffer-length offset -1 shift
:> sample-offset buffer buffer-length short <c-direct-array>
sample-offset short-vector boa
:> short-buffer vorbis-stream info>> channels>> :> #channels
buffer-length sample-offset - #channels /i
:> max-len len max-len min
:> len' pcm #channels void* <c-direct-array>
:> channel*s len' <iota> [| sample |
#channels <iota> [| channel |
channel channel*s nth len float <c-direct-array>
sample swap nth float>short-sample short-buffer push
] each
] each vorbis-stream dsp-state>> len' vorbis_synthesis_read
drop short-buffer length 1 shift ; inline