Handbook
Glossary
vorbis-stream
Ogg Vorbis audio streaming
Next:
read-vorbis-stream ( filename buffer-size -- vorbis-stream )
Vocabulary
audio
.
vorbis
Class description
Objects of this class maintain the stream and decoder state for the Ogg Vorbis decoder.
vorbis-stream
implements the
Audio generator protocol
, so it can be used as the generator for a
streaming-audio-clip
. Use
<vorbis-stream>
or
read-vorbis-stream
to construct a Vorbis stream.
Definition
USING:
byte-arrays
classes.struct
destructors
math
ogg
ogg.vorbis
specialized-arrays.instances.alien.c-types.uchar
;
IN:
audio.vorbis
TUPLE:
vorbis-stream
<
disposable
stream
{
buffer
byte-array
initial:
B{
}
}
{
packet
ogg-packet
initial:
S{
ogg-packet
{
packet
f
}
{
bytes 0
}
{
b_o_s 0
}
{
e_o_s 0
}
{
granulepos 0
}
{
packetno 0
}
}
}
{
sync-state
ogg-sync-state
initial:
S{
ogg-sync-state
{
data
f
}
{
storage 0
}
{
fill 0
}
{
returned 0
}
{
unsynced 0
}
{
headerbytes 0
}
{
bodybytes 0
}
}
}
{
page
ogg-page
initial:
S{
ogg-page
{
header
f
}
{
header_len 0
}
{
body
f
}
{
body_len 0
}
}
}
{
stream-state
ogg-stream-state
initial:
S{
ogg-stream-state
{
body_data
f
}
{
body_storage 0
}
{
body_fill 0
}
{
body_returned 0
}
{
lacing_vals
f
}
{
granule_vals
f
}
{
lacing_storage 0
}
{
lacing_fill 0
}
{
lacing_packet 0
}
{
lacing_returned 0
}
{
header
uchar-array{
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
~183 more~
}
}
{
header_fill 0
}
{
e_o_s 0
}
{
b_o_s 0
}
{
serialno 0
}
{
pageno 0
}
{
packetno 0
}
{
granulepos 0
}
}
}
{
info
vorbis-info
initial:
S{
vorbis-info
{
version 0
}
{
channels 0
}
{
rate 0
}
{
bitrate_upper 0
}
{
bitrate_nominal 0
}
{
bitrate_lower 0
}
{
bitrate_window 0
}
{
codec_setup
f
}
}
}
{
dsp-state
vorbis-dsp-state
initial:
S{
vorbis-dsp-state
{
analysisp 0
}
{
vi
f
}
{
pcm
f
}
{
pcmret
f
}
{
pcm_storage 0
}
{
pcm_current 0
}
{
pcm_returned 0
}
{
preextrapolate 0
}
{
eofflag 0
}
{
lW 0
}
{
W 0
}
{
nW 0
}
{
centerW 0
}
{
granulepos 0
}
{
sequence 0
}
{
glue_bits 0
}
{
time_bits 0
}
{
floor_bits 0
}
{
res_bits 0
}
{
backend_state
f
}
}
}
{
block
vorbis-block
initial:
S{
vorbis-block
{
pcm
f
}
{
opb
S{
oggpack-buffer
{
endbyte 0
}
{
endbit 0
}
{
buffer
f
}
{
ptr
f
}
{
storage 0
}
}
}
{
lW 0
}
{
W 0
}
{
nW 0
}
{
pcmend 0
}
{
mode 0
}
{
eofflag 0
}
{
granulepos 0
}
{
sequence 0
}
{
vd
f
}
{
localstore
f
}
{
localtop 0
}
{
localalloc 0
}
{
totaluse 0
}
{
reap
f
}
{
glue_bits 0
}
{
time_bits 0
}
{
floor_bits 0
}
{
res_bits 0
}
{
internal
f
}
}
}
{
comment
vorbis-comment
initial:
S{
vorbis-comment
{
usercomments
f
}
{
comment_lengths
f
}
{
comments 0
}
{
vendor
f
}
}
}
{
temp-state
ogg-stream-state
initial:
S{
ogg-stream-state
{
body_data
f
}
{
body_storage 0
}
{
body_fill 0
}
{
body_returned 0
}
{
lacing_vals
f
}
{
granule_vals
f
}
{
lacing_storage 0
}
{
lacing_fill 0
}
{
lacing_packet 0
}
{
lacing_returned 0
}
{
header
uchar-array{
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
~183 more~
}
}
{
header_fill 0
}
{
e_o_s 0
}
{
b_o_s 0
}
{
serialno 0
}
{
pageno 0
}
{
packetno 0
}
{
granulepos 0
}
}
}
{
#vorbis-headers
integer
initial:
0
}
;
Methods
USING:
accessors
audio.vorbis
combinators
destructors
kernel
libc
ogg.vorbis
;
M:
vorbis-stream
dispose*
{
[
temp-state>>
[
free
]
when*
]
[
comment>>
[
[
vorbis_comment_clear
]
[
free
]
bi
]
when*
]
[
block>>
[
free
]
when*
]
[
dsp-state>>
[
free
]
when*
]
[
info>>
[
[
vorbis_info_clear
]
[
free
]
bi
]
when*
]
[
stream-state>>
[
free
]
when*
]
[
page>>
[
free
]
when*
]
[
sync-state>>
[
free
]
when*
]
[
packet>>
[
free
]
when*
]
[
stream>>
[
dispose
]
when*
]
}
cleave
;
USING:
accessors
audio.engine
audio.vorbis
audio.vorbis.private
kernel
;
M:
vorbis-stream
generate-audio
[
buffer>>
]
[
0
decode-audio
]
bi
;
USING:
accessors
audio.engine
audio.vorbis
kernel
;
M:
vorbis-stream
generator-audio-format
[
info>>
channels>>
]
[
drop
16
]
[
info>>
rate>>
]
tri
;