Documentation
¶
Overview ¶
Package audio plays sounds at 3D locations. The expected usage is to initialize the audio system and load sound data. Then play sounds that are close enough to the sound listener to be audible.
Package audio is provided as part of the vu (virtual universe) 3D engine.
Index ¶
- type Context
- func (c *Context) DisableAudio()
- func (c *Context) Dispose()
- func (c *Context) DropSound(sound, buff uint64)
- func (c *Context) Init() error
- func (c *Context) LoadSound(sound, buff *uint64, d *Data) error
- func (c *Context) PlaceListener(x, y, z float64)
- func (c *Context) PlaySound(sound uint64, x, y, z float64)
- func (c *Context) SetGain(gain float64)
- type Data
- type Loader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶ added in v0.20.0
type Context struct {
// contains filtered or unexported fields
}
Context is used to initialize and play audio. It works with an audioAPI to allow different audio players implementations.
func (*Context) DisableAudio ¶ added in v0.20.0
func (c *Context) DisableAudio()
DisableAudio is used to turn off the audio system when there are no supported audio drivers.
func (*Context) Dispose ¶ added in v0.20.0
func (c *Context) Dispose()
Closes and the audio layer, releasing any audio resources.
func (*Context) DropSound ¶ added in v0.20.0
DropSound disposes the audio resources allocated with LoadSound. Must be called on a valid audio context, ie: before Dispose()
func (*Context) Init ¶ added in v0.20.0
Init the audio context state. Must be called once on startup.
func (*Context) LoadSound ¶ added in v0.20.0
LoadSound copies the sound data to the sound card and returns references that can be used to play or dispose the sound.
sound : updated reference to the bound sound. buff : updated reference to the sound data buffer. d : sound data bytes and settings to be bound.
func (*Context) PlaceListener ¶ added in v0.20.0
PlaceListener control sounds by setting the x,y,z locations for the listener. While there is only ever one listener, there can be many sounds.
type Data ¶
type Data struct { Name string // Unique sound name. AudioData []byte // The raw audio data. Channels uint16 // Number of audio channels. SampleBits uint16 // 8 bits = 8, 16 bits = 16, etc. Frequency uint32 // 8000, 44100, etc. DataSize uint32 // Audio data size: total file size minus header size. }
Data is a shared audio resource that is used to load sound data onto a sound card.