decoding

package
v0.0.0-...-7296e18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package decoding is used for converting familiar file types to data usable by OpenAL.

Index

Constants

View Source
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

func Decode(filepath string) (*Decoder, error)

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

func (decoder *Decoder) ByteOffsetToDur(offset int32) time.Duration

ByteOffsetToDur will translate byte count to time duration

func (*Decoder) Decode

func (decoder *Decoder) Decode() int

Decode will read the next chunk into the buffer and return the amount of bytes read

func (*Decoder) DurToByteOffset

func (decoder *Decoder) DurToByteOffset(dur time.Duration) int32

DurToByteOffset will translate time duration to a byte count

func (*Decoder) Duration

func (decoder *Decoder) Duration() time.Duration

func (*Decoder) GetData

func (decoder *Decoder) GetData() []byte

func (*Decoder) IsFinished

func (decoder *Decoder) IsFinished() bool

func (*Decoder) Seek

func (decoder *Decoder) Seek(s int64) bool

Seek will seek in the source data by count of bytes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL