module file
November 5, 2022 ยท View on GitHub
Contents
Constants
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
)
create_decoder
fn create_decoder() &OpusDecoder
create_decoder creates an instance of OpusDecoder
OpusDecoder
struct OpusDecoder {
mut:
file &C.OggOpusFile = &C.OggOpusFile(0)
head &C.OpusHead = &C.OpusHead(0)
link int
}
open
fn (mut od OpusDecoder) open(path string) !
open will open a opusfile
close
fn (mut od OpusDecoder) close() !
close clears the opusfile. Must be called to clean up resources!
is_opened
fn (od OpusDecoder) is_opened() bool
is_opened returns true if the opusfile is open for reading
is_stereo
fn (od OpusDecoder) is_stereo() bool
is_stereo returns true if the opusfile is stereo (a.k.a multichannel)
sample_rate
fn (od OpusDecoder) sample_rate() i64
sample_rate returns the sample rate of the opusfile
bitrate
fn (od OpusDecoder) bitrate() !i64
bitrate returns the bitrate of the opusfile
channels
fn (od OpusDecoder) channels() int
channels returns the number of channels of the opusfile
duration
fn (od OpusDecoder) duration() !f64
duration returns the total time in seconds of the opusfile
size
fn (od OpusDecoder) size() i64
size returns the total size of the opusfile
seek
fn (od OpusDecoder) seek(pos f64) !
seek changes the internal position of the stream, in seconds
read
fn (od OpusDecoder) read(mut buffer []i16) !i64
read reads a part of the opusfile up to the lenght of the provided buffer
read_all
fn (od OpusDecoder) read_all(mut buffer []i16) !i64
read_all reads the entire data of the opusfile