Documentation ¶
Overview ¶
Package audio contains sub packages for binding to external audio libraries and implements a spatial audio player.
Index ¶
- type AudioFile
- func (af *AudioFile) Close() error
- func (af *AudioFile) CurrentTime() float64
- func (af *AudioFile) Info() AudioInfo
- func (af *AudioFile) Looping() bool
- func (af *AudioFile) Read(pdata unsafe.Pointer, nbytes int) (int, error)
- func (af *AudioFile) Seek(pos uint) error
- func (af *AudioFile) SetLooping(looping bool)
- type AudioInfo
- type Listener
- func (l *Listener) Gain() float32
- func (l *Listener) Render(_ *gls.GLS)
- func (l *Listener) SetGain(gain float32)
- func (l *Listener) SetVelocity(vx, vy, vz float32)
- func (l *Listener) SetVelocityVec(v *math32.Vector3)
- func (l *Listener) Velocity() (float32, float32, float32)
- func (l *Listener) VelocityVec() math32.Vector3
- type Player
- func (p *Player) CurrentTime() float64
- func (p *Player) Dispose()
- func (p *Player) Gain() float32
- func (p *Player) InnerCone() float32
- func (p *Player) Looping() bool
- func (p *Player) MaxGain() float32
- func (p *Player) MinGain() float32
- func (p *Player) OuterCone() float32
- func (p *Player) Pause()
- func (p *Player) Pitch() float32
- func (p *Player) Play() error
- func (p *Player) Render(_ *gls.GLS)
- func (p *Player) SetGain(gain float32)
- func (p *Player) SetInnerCone(inner float32)
- func (p *Player) SetLooping(looping bool)
- func (p *Player) SetMaxGain(gain float32)
- func (p *Player) SetMinGain(gain float32)
- func (p *Player) SetOuterCone(outer float32)
- func (p *Player) SetPitch(pitch float32)
- func (p *Player) SetRolloffFactor(rfactor float32)
- func (p *Player) SetVelocity(vx, vy, vz float32)
- func (p Player) SetVelocityVec(v *math32.Vector3)
- func (p *Player) State() int
- func (p *Player) Stop()
- func (p *Player) TotalTime() float64
- func (p *Player) Velocity() (float32, float32, float32)
- func (p *Player) VelocityVec() math32.Vector3
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudioFile ¶
type AudioFile struct {
// contains filtered or unexported fields
}
AudioFile represents an audio file
func NewAudioFile ¶
NewAudioFile creates and returns a pointer to a new audio file object and an error
func (*AudioFile) CurrentTime ¶
CurrentTime returns the current time in seconds for the current file read position
func (*AudioFile) SetLooping ¶
SetLooping sets the looping state of this audio file
type AudioInfo ¶
type AudioInfo struct { Format int // OpenAl Format Channels int // Number of channels SampleRate int // Sample rate in hz BitsSample int // Number of bits per sample (8 or 16) DataSize int // Total data size in bytes BytesSec int // Bytes per second TotalTime float64 // Total time in seconds }
AudioInfo represents the information associated to an audio file
type Listener ¶
Listener is an audio listener positioned in space.
func (*Listener) Render ¶
Render is called by the renderer at each frame. Updates the position and orientation of the listener.
func (*Listener) SetVelocity ¶
SetVelocity sets the velocity of the listener with x, y, z components.
func (*Listener) SetVelocityVec ¶
SetVelocityVec sets the velocity of the listener with a vector.
func (*Listener) VelocityVec ¶
VelocityVec returns the velocity of the listener as a vector.
type Player ¶
Player is a 3D (spatial) audio file player It embeds a core.Node so it can be inserted as a child in any other 3D object.
func NewPlayer ¶
NewPlayer creates and returns a pointer to a new audio player object which will play the audio encoded in the specified file. Currently it supports wave and Ogg Vorbis formats.
func (*Player) CurrentTime ¶
CurrentTime returns the current time in seconds spent in the stream
func (*Player) Render ¶
Render satisfies the INode interface. It is called by renderer at every frame and is used to update the audio source position and direction
func (*Player) SetInnerCone ¶
SetInnerCone sets the inner cone angle in degrees
func (*Player) SetLooping ¶
SetLooping sets the looping state of this player
func (*Player) SetMaxGain ¶
SetMaxGain sets the maximum gain (volume) of this player
func (*Player) SetMinGain ¶
SetMinGain sets the minimum gain (volume) of this player
func (*Player) SetOuterCone ¶
SetOuterCone sets the outer cone angle in degrees
func (*Player) SetRolloffFactor ¶
SetRolloffFactor sets this player rolloff factor user to calculate the gain attenuation by distance
func (*Player) SetVelocity ¶
SetVelocity sets the velocity of this player It is used to calculate Doppler effects
func (Player) SetVelocityVec ¶
SetVelocityVec sets the velocity of this player from the specified vector It is used to calculate Doppler effects
func (*Player) VelocityVec ¶
VelocityVec returns this player velocity vector
Directories ¶
Path | Synopsis |
---|---|
Package al implements the Go bindings of a subset of the functions of the OpenAL C library.
|
Package al implements the Go bindings of a subset of the functions of the OpenAL C library. |
Package oggvorbis decodes audio from ogg/vorbis files.
|
Package oggvorbis decodes audio from ogg/vorbis files. |
Package vorbis implements a vorbis decoder.
|
Package vorbis implements a vorbis decoder. |