const (
op_false = -1
op_eof = -2
op_hole = -3
op_eread = -128
op_efault = -129
op_eimpl = -130
op_einval = -131
op_enotformat = -132
op_ebadheader = -133
op_eversion = -134
op_enotaudio = -135
op_ebadpacket = -136
op_ebadlink = -137
op_enoseek = -138
op_ebadtimestamp = -139
opus_channel_count_max = 255
)
const (
chunk = 4096
)
fn create_decoder() &OpusDecoder
create_decoder creates an instance of OpusDecoder
struct OpusDecoder {
mut:
file &C.OggOpusFile = &C.OggOpusFile(0)
head &C.OpusHead = &C.OpusHead(0)
link int
}
fn (mut od OpusDecoder) open(path string) !
open will open a opusfile
fn (mut od OpusDecoder) close() !
close clears the opusfile. Must be called to clean up resources!
fn (od OpusDecoder) is_opened() bool
is_opened returns true if the opusfile is open for reading
fn (od OpusDecoder) is_stereo() bool
is_stereo returns true if the opusfile is stereo (a.k.a multichannel)
fn (od OpusDecoder) sample_rate() i64
sample_rate returns the sample rate of the opusfile
fn (od OpusDecoder) bitrate() !i64
bitrate returns the bitrate of the opusfile
fn (od OpusDecoder) channels() int
channels returns the number of channels of the opusfile
fn (od OpusDecoder) duration() !f64
duration returns the total time in seconds of the opusfile
fn (od OpusDecoder) size() i64
size returns the total size of the opusfile
fn (od OpusDecoder) seek(pos f64) !
seek changes the internal position of the stream, in seconds
fn (od OpusDecoder) read(mut buffer []i16) !i64
read reads a part of the opusfile up to the lenght of the provided buffer
fn (od OpusDecoder) read_all(mut buffer []i16) !i64
read_all reads the entire data of the opusfile