Documentation ¶
Overview ¶
Package al provides golang audio library bindings for OpenAL. Official OpenAL documentation can be found online. Prepend "AL_" to the function or constant names found in this package. Refer to the official OpenAL documentation for more information.
Package al is provided as part of the vu (virtual universe) 3D engine.
Index ¶
- Constants
- func BindingReport() (report []string)
- func DeleteBuffers(buffers []Buffer)
- func DeleteSources(source ...Source)
- func Disable(capability int32)
- func DistanceModel() int32
- func DopplerFactor() float32
- func DopplerVelocity() float32
- func Enable(capability int32)
- func Enabled(capability int32) bool
- func Error() int32
- func Extensions() string
- func Init() error
- func InitPath(path string) error
- func ListenerGain() float32
- func PauseSources(source ...Source)
- func PlaySources(source ...Source)
- func Renderer() string
- func RewindSources(source ...Source)
- func SetDistanceModel(v int32)
- func SetDopplerFactor(v float32)
- func SetDopplerVelocity(v float32)
- func SetListenerGain(v float32)
- func SetListenerOrientation(v Orientation)
- func SetListenerPosition(v Vector)
- func SetListenerVelocity(v Vector)
- func SetSpeedOfSound(v float32)
- func SpeedOfSound() float32
- func StopSources(source ...Source)
- func Vendor() string
- func Version() string
- type Buffer
- type CaptureDevice
- type Context
- type Device
- type Orientation
- type Source
- func (s Source) BuffersProcessed() int32
- func (s Source) BuffersQueued() int32
- func (s Source) Gain() float32
- func (s Source) MaxGain() float32
- func (s Source) MinGain() float32
- func (s Source) OffsetByte() int32
- func (s Source) OffsetSample() int32
- func (s Source) OffsetSeconds() int32
- func (s Source) Orientation() Orientation
- func (s Source) Position() Vector
- func (s Source) QueueBuffers(buffers []Buffer)
- func (s Source) SetGain(v float32)
- func (s Source) SetMaxGain(v float32)
- func (s Source) SetMinGain(v float32)
- func (s Source) SetOrientation(o Orientation)
- func (s Source) SetPosition(v Vector)
- func (s Source) SetVelocity(v Vector)
- func (s Source) State() int32
- func (s Source) UnqueueBuffers(buffers []Buffer)
- func (s Source) Velocity() Vector
- type Vector
Constants ¶
const ( FALSE = 0 TRUE = 1 NONE = 0 NO_ERROR = 0 SOURCE_RELATIVE = 0x202 CONE_INNER_ANGLE = 0x1001 CONE_OUTER_ANGLE = 0x1002 PITCH = 0x1003 POSITION = 0x1004 DIRECTION = 0x1005 VELOCITY = 0x1006 LOOPING = 0x1007 BUFFER = 0x1009 GAIN = 0x100A MIN_GAIN = 0x100D MAX_GAIN = 0x100E ORIENTATION = 0x100F SOURCE_STATE = 0x1010 INITIAL = 0x1011 PLAYING = 0x1012 PAUSED = 0x1013 STOPPED = 0x1014 BUFFERS_QUEUED = 0x1015 BUFFERS_PROCESSED = 0x1016 SEC_OFFSET = 0x1024 SAMPLE_OFFSET = 0x1025 BYTE_OFFSET = 0x1026 SOURCE_TYPE = 0x1027 STATIC = 0x1028 STREAMING = 0x1029 UNDETERMINED = 0x1030 FORMAT_MONO8 = 0x1100 FORMAT_MONO16 = 0x1101 FORMAT_STEREO8 = 0x1102 FORMAT_STEREO16 = 0x1103 REFERENCE_DISTANCE = 0x1020 ROLLOFF_FACTOR = 0x1021 CONE_OUTER_GAIN = 0x1022 MAX_DISTANCE = 0x1023 FREQUENCY = 0x2001 BITS = 0x2002 CHANNELS = 0x2003 SIZE = 0x2004 UNUSED = 0x2010 PENDING = 0x2011 PROCESSED = 0x2012 INVALID_NAME = 0xA001 INVALID_ENUM = 0xA002 INVALID_VALUE = 0xA003 INVALID_OPERATION = 0xA004 OUT_OF_MEMORY = 0xA005 VENDOR = 0xB001 VERSION = 0xB002 RENDERER = 0xB003 EXTENSIONS = 0xB004 DOPPLER_FACTOR = 0xC000 DOPPLER_VELOCITY = 0xC001 SPEED_OF_SOUND = 0xC003 DISTANCE_MODEL = 0xD000 INVERSE_DISTANCE = 0xD001 INVERSE_DISTANCE_CLAMPED = 0xD002 LINEAR_DISTANCE = 0xD003 LINEAR_DISTANCE_CLAMPED = 0xD004 EXPONENT_DISTANCE = 0xD005 EXPONENT_DISTANCE_CLAMPED = 0xD006 )
AL/al.h constants (with AL_ removed). Refer to the original header for constant documentation.
const ( C_FALSE = 0 C_TRUE = 1 C_NO_ERROR = 0 C_FREQUENCY = 0x1007 C_REFRESH = 0x1008 C_SYNC = 0x1009 C_MONO_SOURCES = 0x1010 C_STEREO_SOURCES = 0x1011 C_INVALID_DEVICE = 0xA001 C_INVALID_CONTEXT = 0xA002 C_INVALID_ENUM = 0xA003 C_INVALID_VALUE = 0xA004 C_OUT_OF_MEMORY = 0xA005 C_DEFAULT_DEVICE_SPECIFIER = 0x1004 C_DEVICE_SPECIFIER = 0x1005 C_EXTENSIONS = 0x1006 C_MAJOR_VERSION = 0x1000 C_MINOR_VERSION = 0x1001 C_ATTRIBUTES_SIZE = 0x1002 C_ALL_ATTRIBUTES = 0x1003 C_CAPTURE_DEVICE_SPECIFIER = 0x310 C_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 0x311 C_CAPTURE_SAMPLES = 0x312 )
AL/alc.h constants (with AL removed). Refer to the original header for constant documentation.
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.
Variables ¶
This section is empty.
Functions ¶
func BindingReport ¶
func BindingReport() (report []string)
Show which function pointers are bound [+] or not bound [-]. Expected to be used as a sanity check to see if the OpenAL libraries exist.
func ListenerGain ¶
func ListenerGain() float32
ListenerGain returns the total gain applied to the final mix.
func RewindSources ¶
func RewindSources(source ...Source)
RewindSources rewinds the sources to their beginning positions.
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).
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 ¶
GenBuffers generates n new buffers. The generated buffers should be deleted once they are no longer in use.
func (Buffer) BufferData ¶
BufferData buffers PCM data to the current buffer.
type CaptureDevice ¶
type CaptureDevice struct {
Device
}
Capture device
func CaptureOpen ¶
func CaptureOpen(name string, frequency uint, format int, buffersize int64) *CaptureDevice
Open opens a new capture device in the OpenAL layer.
func (*CaptureDevice) Samples ¶
func (dev *CaptureDevice) Samples(bs []byte, samples int64)
func (*CaptureDevice) Start ¶
func (dev *CaptureDevice) Start()
func (*CaptureDevice) Stop ¶
func (dev *CaptureDevice) Stop()
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context represents a context created in the OpenAL layer. A valid current context is required to run OpenAL functions. The returned context will be available process-wide if it's made the current by calling MakeContextCurrent.
func GetCurrentContext ¶
func GetCurrentContext() *Context
func (*Context) MakeCurrent ¶
MakeContextCurrent makes a context current process-wide.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
alc.h Device represents an audio device.
func (*Device) CreateContext ¶
CreateContext creates a new context.
func (*Device) GetEnumValue ¶
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 ¶
GenSources generates n new sources. These sources should be deleted once they are not in use.
func (Source) BuffersProcessed ¶
BuffersProcessed returns the number of the processed buffers.
func (Source) BuffersQueued ¶
BuffersQueued returns the number of the queued buffers.
func (Source) OffsetByte ¶
OffsetByte returns the byte offset of the current playback position.
func (Source) OffsetSample ¶
OffsetSample returns the sample offset of the current playback position.
func (Source) OffsetSeconds ¶
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) QueueBuffers ¶
QueueBuffers adds the buffers to the buffer queue.
func (Source) SetMaxGain ¶
SetMaxGain sets the source's maximum gain setting.
func (Source) SetMinGain ¶
SetMinGain sets the source's minimum gain setting.
func (Source) SetOrientation ¶
func (s Source) SetOrientation(o Orientation)
SetOrientation sets the orientation of the source.
func (Source) SetPosition ¶
SetPosition sets the position of the source.
func (Source) SetVelocity ¶
SetVelocity sets the source's velocity.
func (Source) UnqueueBuffers ¶
UnqueueBuffers removes the specified buffers from the buffer queue.
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.