Documentation ¶
Overview ¶
Package decoding is used for converting familiar file types to data usable by OpenAL.
Index ¶
- Constants
- type Decoder
- func (decoder *Decoder) ByteOffsetToDur(offset int32) time.Duration
- func (decoder *Decoder) Decode() int
- func (decoder *Decoder) DurToByteOffset(dur time.Duration) int32
- func (decoder *Decoder) Duration() time.Duration
- func (decoder *Decoder) GetData() []byte
- func (decoder *Decoder) IsFinished() bool
- func (decoder *Decoder) Seek(s int64) bool
Constants ¶
const BUFFER_SIZE = 128 * 1024
arbitrary buffer size, could be tuned in the future
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct { Channels int16 SampleRate int32 Buffer []byte Format uint32 // contains filtered or unexported fields }
Decoder is a base implementation of a few methods to keep tryings DRY
func Decode ¶
Decode will get the file at the path provided. It will then send it to the decoder that will handle its file type by the extention on the path. Supported formats are wav, ogg, and flac. If there is an error retrieving the file or decoding it, will return that error.
func (*Decoder) ByteOffsetToDur ¶
ByteOffsetToDur will translate byte count to time duration
func (*Decoder) Decode ¶
Decode will read the next chunk into the buffer and return the amount of bytes read
func (*Decoder) DurToByteOffset ¶
DurToByteOffset will translate time duration to a byte count