al

package
Version: 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, BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoError          = 0x0000
	InvalidName      = 0xA001
	InvalidEnum      = 0xA002
	InvalidValue     = 0xA003
	InvalidOperation = 0xA004
	OutOfMemory      = 0xA005
)

Error returns one of these error codes.

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

Distance models.

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

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

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

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

View Source
const CapabilityDistanceModel = Capability(0x200)

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

Variables

This section is empty.

Functions

func CloseDevice

func CloseDevice()

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

func DeleteBuffers

func DeleteBuffers(buffer ...Buffer)

DeleteBuffers deletes the buffers.

func DeleteSources

func DeleteSources(source ...Source)

DeleteSources deletes the sources.

func DeviceError

func DeviceError() int32

DeviceError returns the last known error from the current device.

func Disable

func Disable(c Capability)

Disable disables a capability.

func DistanceModel

func DistanceModel() int32

DistanceModel returns the distance model.

func DopplerFactor

func DopplerFactor() float32

DopplerFactor returns the doppler factor.

func DopplerVelocity

func DopplerVelocity() float32

DopplerVelocity returns the doppler velocity.

func Enable

func Enable(c Capability)

Enable enables a capability.

func Enabled

func Enabled(c Capability) bool

Enabled returns true if the specified capability is enabled.

func Error

func Error() int32

Error returns the most recently generated error.

func Extensions

func Extensions() string

Extensions returns the enabled extensions.

func ListenerGain

func ListenerGain() float32

ListenerGain returns the total gain applied to the final mix.

func OpenDevice

func OpenDevice() error

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

func PauseSources

func PauseSources(source ...Source)

PauseSources pauses the sources.

func PlaySources

func PlaySources(source ...Source)

PlaySources plays the sources.

func Renderer

func Renderer() string

Renderer returns the renderer information.

func RewindSources

func RewindSources(source ...Source)

RewindSources rewinds the sources to their beginning positions.

func SetDistanceModel

func SetDistanceModel(v int32)

SetDistanceModel sets the distance model.

func SetDopplerFactor

func SetDopplerFactor(v float32)

SetDopplerFactor sets the doppler factor.

func SetDopplerVelocity

func SetDopplerVelocity(v float32)

SetDopplerVelocity sets the doppler velocity.

func SetListenerGain

func SetListenerGain(v float32)

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

func SetListenerOrientation

func SetListenerOrientation(v Orientation)

SetListenerOrientation sets the orientation of the listener.

func SetListenerPosition

func SetListenerPosition(v Vector)

SetListenerPosition sets the position of the listener.

func SetListenerVelocity

func SetListenerVelocity(v Vector)

SetListenerVelocity sets the velocity of the listener.

func SetSpeedOfSound

func SetSpeedOfSound(v float32)

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

func SpeedOfSound

func SpeedOfSound() float32

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

func StopSources

func StopSources(source ...Source)

StopSources stops the sources.

func Vendor

func Vendor() string

Vendor returns the vendor.

func Version

func Version() string

Version returns the version string.

Types

type Buffer

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 GenBuffers

func GenBuffers(n int) []Buffer

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

func (Buffer) Bits

func (b Buffer) Bits() int32

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

func (Buffer) BufferData

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

BufferData buffers PCM data to the current buffer.

func (Buffer) Channels

func (b Buffer) Channels() int32

Channels return the number of the audio channels.

func (Buffer) Frequency

func (b Buffer) Frequency() int32

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

func (Buffer) Size

func (b Buffer) Size() int32

Size returns the size of the data.

func (Buffer) Valid

func (b Buffer) Valid() bool

Valid returns true if the buffer exists and is valid.

type Capability

type Capability int32

Capability represents OpenAL extension capabilities.

type Cone

type Cone struct {
	InnerAngle  int32
	OuterAngle  int32
	OuterVolume float32
}

type Orientation

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

func ListenerOrientation() Orientation

ListenerOrientation returns the orientation of the listener.

type Source

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 GenSources

func GenSources(n int) []Source

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

func (Source) Buffer

func (s Source) Buffer() Buffer

BuffersQueued returns the number of the queued buffers.

func (Source) BuffersProcessed

func (s Source) BuffersProcessed() int32

BuffersProcessed returns the number of the processed buffers.

func (Source) BuffersQueued

func (s Source) BuffersQueued() int32

BuffersQueued returns the number of the queued buffers.

func (Source) ClearBuffers

func (s Source) ClearBuffers()

BuffersQueued returns the number of the queued buffers.

func (Source) Cone

func (s Source) Cone() Cone

func (Source) Direction

func (s Source) Direction() Vector

Position returns the position of the source.

func (Source) Gain

func (s Source) Gain() float32

Gain returns the source gain.

func (Source) Looping

func (s Source) Looping() bool

Looping returns the source looping.

func (Source) MaxDistance

func (s Source) MaxDistance() float32

func (Source) MaxGain

func (s Source) MaxGain() float32

MaxGain returns the source's maximum gain setting.

func (Source) MinGain

func (s Source) MinGain() float32

MinGain returns the source's minimum gain setting.

func (Source) OffsetByte

func (s Source) OffsetByte() int32

OffsetByte returns the byte offset of the current playback position.

func (Source) OffsetSample

func (s Source) OffsetSample() float32

OffsetSample returns the sample offset of the current playback position.

func (Source) OffsetSeconds

func (s Source) OffsetSeconds() float32

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

func (Source) Orientation

func (s Source) Orientation() Orientation

Orientation returns the orientation of the source.

func (Source) Pitch

func (s Source) Pitch() float32

func (Source) Position

func (s Source) Position() Vector

Position returns the position of the source.

func (Source) QueueBuffers

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

QueueBuffers adds the buffers to the buffer queue.

func (Source) ReferenceDistance

func (s Source) ReferenceDistance() float32

func (Source) Relative

func (s Source) Relative() bool

func (Source) Rolloff

func (s Source) Rolloff() float32

func (Source) SetBuffer

func (s Source) SetBuffer(b Buffer)

BuffersQueued returns the number of the queued buffers.

func (Source) SetCone

func (s Source) SetCone(c Cone)

func (Source) SetDirection

func (s Source) SetDirection(v Vector)

SetDirection sets the direction of the source.

func (Source) SetGain

func (s Source) SetGain(v float32)

SetGain sets the source gain.

func (Source) SetLooping

func (s Source) SetLooping(should_loop bool)

SetLooping sets the source looping

func (Source) SetMaxDistance

func (s Source) SetMaxDistance(dis float32)

func (Source) SetMaxGain

func (s Source) SetMaxGain(v float32)

SetMaxGain sets the source's maximum gain setting.

func (Source) SetMinGain

func (s Source) SetMinGain(v float32)

SetMinGain sets the source's minimum gain setting.

func (Source) SetOffsetBytes

func (s Source) SetOffsetBytes(bytes int32)

OffsetSample returns the sample offset of the current playback position.

func (Source) SetOffsetSample

func (s Source) SetOffsetSample(samples float32)

OffsetSample returns the sample offset of the current playback position.

func (Source) SetOffsetSeconds

func (s Source) SetOffsetSeconds(seconds float32)

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

func (Source) SetOrientation

func (s Source) SetOrientation(o Orientation)

SetOrientation sets the orientation of the source.

func (Source) SetPitch

func (s Source) SetPitch(p float32)

func (Source) SetPosition

func (s Source) SetPosition(v Vector)

SetPosition sets the position of the source.

func (Source) SetReferenceDistance

func (s Source) SetReferenceDistance(dis float32)

func (Source) SetRelative

func (s Source) SetRelative(is_relative bool)

func (Source) SetRolloff

func (s Source) SetRolloff(roll_off float32)

func (Source) SetVelocity

func (s Source) SetVelocity(v Vector)

SetVelocity sets the source's velocity.

func (Source) State

func (s Source) State() int32

State returns the playing state of the source.

func (Source) UnqueueBuffer

func (s Source) UnqueueBuffer() Buffer

UnqueueBuffers removes the specified buffers from the buffer queue.

func (Source) Velocity

func (s Source) Velocity() Vector

Velocity returns the source's velocity.

type Vector

type Vector [3]float32

Vector represents an vector in a Cartesian coordinate system.

func ListenerPosition

func ListenerPosition() Vector

ListenerPosition returns the position of the listener.

func ListenerVelocity

func ListenerVelocity() Vector

ListenerVelocity returns the velocity of the listener.

Jump to

Keyboard shortcuts

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