mobile: golang.org/x/mobile/exp/audio/al Index | Files

package al

import "golang.org/x/mobile/exp/audio/al"

Package al provides OpenAL Soft bindings for Go.

Calls are not safe for concurrent use.

More information about OpenAL Soft is available at http://www.openal.org/documentation/openal-1.1-specification.pdf.

In order to use this package on Linux desktop distros, you will need OpenAL library as an external dependency. On Ubuntu 14.04 'Trusty', you may have to install this library by running the command below.

sudo apt-get install libopenal-dev

When compiled for Android, this package uses OpenAL Soft. Please add its license file to the open source notices of your application. OpenAL Soft's license file could be found at http://repo.or.cz/w/openal-soft.git/blob/HEAD:/COPYING.

Index

Package Files

al.go al_notandroid.go alc.go alc_notandroid.go const.go

Constants

const (
    InvalidName      = 0xA001
    InvalidEnum      = 0xA002
    InvalidValue     = 0xA003
    InvalidOperation = 0xA004
    OutOfMemory      = 0xA005
)

Error returns one of these error codes.

const (
    InverseDistance         = 0xD001
    InverseDistanceClamped  = 0xD002
    LinearDistance          = 0xD003
    LinearDistanceClamped   = 0xD004
    ExponentDistance        = 0xD005
    ExponentDistanceClamped = 0xD006
)

Distance models.

const (
    Initial = 0x1011
    Playing = 0x1012
    Paused  = 0x1013
    Stopped = 0x1014
)

A source could be in the state of initial, playing, paused or stopped.

const (
    FormatMono8    = 0x1100
    FormatMono16   = 0x1101
    FormatStereo8  = 0x1102
    FormatStereo16 = 0x1103
)

Audio formats. Buffer.BufferData accepts one of these formats as the data format.

const CapabilityDistanceModel = Capability(0x200)

CapabilityDistanceModel represents the capability of specifying a different distance model for each source.

func CloseDevice Uses

func CloseDevice()

CloseDevice closes the device and frees related resources. Calls to CloseDevice are safe for concurrent use.

func DeleteBuffers Uses

func DeleteBuffers(buffer ...Buffer)

DeleteBuffers deletes the buffers.

func DeleteSources Uses

func DeleteSources(source ...Source)

DeleteSources deletes the sources.

func DeviceError Uses

func DeviceError() int32

DeviceError returns the last known error from the current device.

func Disable Uses

func Disable(c Capability)

Disable disables a capability.

func DistanceModel Uses

func DistanceModel() int32

DistanceModel returns the distance model.

func DopplerFactor Uses

func DopplerFactor() float32

DopplerFactor returns the doppler factor.

func DopplerVelocity Uses

func DopplerVelocity() float32

DopplerVelocity returns the doppler velocity.

func Enable Uses

func Enable(c Capability)

Enable enables a capability.

func Enabled Uses

func Enabled(c Capability) bool

Enabled returns true if the specified capability is enabled.

func Error Uses

func Error() int32

Error returns the most recently generated error.

func Extensions Uses

func Extensions() string

Extensions returns the enabled extensions.

func GenBuffers Uses

func GenBuffers(n int) []Buffer

GenBuffers generates n new buffers. The generated buffers should be deleted once they are no longer in use.

func GenSources Uses

func GenSources(n int) []Source

GenSources generates n new sources. These sources should be deleted once they are not in use.

func GetListenerf Uses

func GetListenerf(param int) float32

GetListenerf returns the float32 value of the listener parameter.

func GetListenerfv Uses

func GetListenerfv(param int, v []float32)

GetListenerfv returns the float32 vector value of the listener parameter.

func GetString Uses

func GetString(param int) string

GetString returns the string value of the given parameter.

func Getb Uses

func Getb(param int) bool

Getb returns the bool value of the given parameter.

func Getbv Uses

func Getbv(param int, v []bool)

Getbv returns the bool vector value of the given parameter.

func Getf Uses

func Getf(param int) float32

Getf returns the float32 value of the given parameter.

func Getfv Uses

func Getfv(param int, v []float32)

Getfv returns the float32 vector value of the given parameter.

func Geti Uses

func Geti(param int) int32

Geti returns the int32 value of the given parameter.

func Getiv Uses

func Getiv(param int, v []int32)

Getiv returns the int32 vector value of the given parameter.

func ListenerGain Uses

func ListenerGain() float32

ListenerGain returns the total gain applied to the final mix.

func OpenDevice Uses

func OpenDevice() error

OpenDevice opens the default audio device. Calls to OpenDevice are safe for concurrent use.

func PauseSources Uses

func PauseSources(source ...Source)

PauseSources pauses the sources.

func PlaySources Uses

func PlaySources(source ...Source)

PlaySources plays the sources.

func Renderer Uses

func Renderer() string

Renderer returns the renderer information.

func RewindSources Uses

func RewindSources(source ...Source)

RewindSources rewinds the sources to their beginning positions.

func SetDistanceModel Uses

func SetDistanceModel(v int32)

SetDistanceModel sets the distance model.

func SetDopplerFactor Uses

func SetDopplerFactor(v float32)

SetDopplerFactor sets the doppler factor.

func SetDopplerVelocity Uses

func SetDopplerVelocity(v float32)

SetDopplerVelocity sets the doppler velocity.

func SetListenerGain Uses

func SetListenerGain(v float32)

SetListenerGain sets the total gain that will be applied to the final mix.

func SetListenerOrientation Uses

func SetListenerOrientation(v Orientation)

SetListenerOrientation sets the orientation of the listener.

func SetListenerPosition Uses

func SetListenerPosition(v Vector)

SetListenerPosition sets the position of the listener.

func SetListenerVelocity Uses

func SetListenerVelocity(v Vector)

SetListenerVelocity sets the velocity of the listener.

func SetListenerf Uses

func SetListenerf(param int, v float32)

GetListenerf sets the float32 value for the listener parameter.

func SetListenerfv Uses

func SetListenerfv(param int, v []float32)

GetListenerf sets the float32 vector value of the listener parameter.

func SetSpeedOfSound Uses

func SetSpeedOfSound(v float32)

SetSpeedOfSound sets the speed of sound, its unit should be meters per second (m/s).

func SpeedOfSound Uses

func SpeedOfSound() float32

SpeedOfSound is the speed of sound in meters per second (m/s).

func StopSources Uses

func StopSources(source ...Source)

StopSources stops the sources.

func Vendor Uses

func Vendor() string

Vendor returns the vendor.

func Version Uses

func Version() string

Version returns the version string.

type Buffer Uses

type Buffer uint32

A buffer represents a chunk of PCM audio data that could be buffered to an audio source. A single buffer could be shared between multiple sources.

func (Buffer) Bits Uses

func (b Buffer) Bits() int32

Bits return the number of bits used to represent a sample.

func (Buffer) BufferData Uses

func (b Buffer) BufferData(format uint32, data []byte, freq int32)

BufferData buffers PCM data to the current buffer.

func (Buffer) Channels Uses

func (b Buffer) Channels() int32

Channels return the number of the audio channels.

func (Buffer) Frequency Uses

func (b Buffer) Frequency() int32

Frequency returns the frequency of the buffer data in Hertz (Hz).

func (Buffer) Geti Uses

func (b Buffer) Geti(param int) int32

Geti returns the int32 value of the given parameter.

func (Buffer) Size Uses

func (b Buffer) Size() int32

Size returns the size of the data.

func (Buffer) Valid Uses

func (b Buffer) Valid() bool

Valid returns true if the buffer exists and is valid.

type Capability Uses

type Capability int32

Capability represents OpenAL extension capabilities.

type Orientation Uses

type Orientation struct {
    // Forward vector is the direction that the object is looking at.
    Forward Vector
    // Up vector represents the rotation of the object.
    Up  Vector
}

Orientation represents the angular position of an object in a right-handed Cartesian coordinate system. A cross product between the forward and up vector returns a vector that points to the right.

func ListenerOrientation Uses

func ListenerOrientation() Orientation

ListenerOrientation returns the orientation of the listener.

type Source Uses

type Source uint32

Source represents an individual sound source in 3D-space. They take PCM data, apply modifications and then submit them to be mixed according to their spatial location.

func (Source) BuffersProcessed Uses

func (s Source) BuffersProcessed() int32

BuffersProcessed returns the number of the processed buffers.

func (Source) BuffersQueued Uses

func (s Source) BuffersQueued() int32

BuffersQueued returns the number of the queued buffers.

func (Source) Gain Uses

func (s Source) Gain() float32

Gain returns the source gain.

func (Source) Getf Uses

func (s Source) Getf(param int) float32

Getf returns the float32 value of the given parameter.

func (Source) Getfv Uses

func (s Source) Getfv(param int, v []float32)

Getfv returns the float32 vector value of the given parameter.

func (Source) Geti Uses

func (s Source) Geti(param int) int32

Geti returns the int32 value of the given parameter.

func (Source) MaxGain Uses

func (s Source) MaxGain() float32

MaxGain returns the source's maximum gain setting.

func (Source) MinGain Uses

func (s Source) MinGain() float32

MinGain returns the source's minimum gain setting.

func (Source) OffsetByte Uses

func (s Source) OffsetByte() int32

OffsetByte returns the byte offset of the current playback position.

func (Source) OffsetSample Uses

func (s Source) OffsetSample() int32

OffsetSample returns the sample offset of the current playback position.

func (Source) OffsetSeconds Uses

func (s Source) OffsetSeconds() int32

OffsetSeconds returns the current playback position of the source in seconds.

func (Source) Orientation Uses

func (s Source) Orientation() Orientation

Orientation returns the orientation of the source.

func (Source) Position Uses

func (s Source) Position() Vector

Position returns the position of the source.

func (Source) QueueBuffers Uses

func (s Source) QueueBuffers(buffer ...Buffer)

QueueBuffers adds the buffers to the buffer queue.

func (Source) SetGain Uses

func (s Source) SetGain(v float32)

SetGain sets the source gain.

func (Source) SetMaxGain Uses

func (s Source) SetMaxGain(v float32)

SetMaxGain sets the source's maximum gain setting.

func (Source) SetMinGain Uses

func (s Source) SetMinGain(v float32)

SetMinGain sets the source's minimum gain setting.

func (Source) SetOrientation Uses

func (s Source) SetOrientation(o Orientation)

SetOrientation sets the orientation of the source.

func (Source) SetPosition Uses

func (s Source) SetPosition(v Vector)

SetPosition sets the position of the source.

func (Source) SetVelocity Uses

func (s Source) SetVelocity(v Vector)

SetVelocity sets the source's velocity.

func (Source) Setf Uses

func (s Source) Setf(param int, v float32)

Setf sets a float32 value for the given parameter.

func (Source) Setfv Uses

func (s Source) Setfv(param int, v []float32)

Setfv sets a float32 vector value for the given parameter.

func (Source) Seti Uses

func (s Source) Seti(param int, v int32)

Seti sets an int32 value for the given parameter.

func (Source) State Uses

func (s Source) State() int32

State returns the playing state of the source.

func (Source) UnqueueBuffers Uses

func (s Source) UnqueueBuffers(buffer ...Buffer)

UnqueueBuffers removes the specified buffers from the buffer queue.

func (Source) Velocity Uses

func (s Source) Velocity() Vector

Velocity returns the source's velocity.

type Vector Uses

type Vector [3]float32

Vector represents an vector in a Cartesian coordinate system.

func ListenerPosition Uses

func ListenerPosition() Vector

ListenerPosition returns the position of the listener.

func ListenerVelocity Uses

func ListenerVelocity() Vector

ListenerVelocity returns the velocity of the listener.

Package al imports 4 packages (graph) and is imported by 5 packages. Updated 2017-04-20. Refresh now. Tools for package owners.