Documentation ¶
Index ¶
- func AutoSuspend() bool
- func AutoUnlock() bool
- func Codecs(extension string) bool
- func HTML5PoolSize() int
- func Mute(mute bool)
- func NoAudio() bool
- func Orientation() (orientation []float64)
- func Pos() (x, y, z float64)
- func SetAutoSuspend(auto bool)
- func SetAutoUnlock(autoUnlock bool)
- func SetHTML5PoolSize(size int)
- func SetOrientation(x, y, z, upX, upY, upZ float64)
- func SetPos(x, y, z float32)
- func SetStereo(stereo float64)
- func SetVolume(volume float64)
- func Stop()
- func Unload()
- func UsingWebAudio() bool
- func Volume() float64
- type CallbackErrorFunc
- type CallbackFunc
- type DistanceModel
- type OptionalBool
- type OptionalFloat
- type OptionalInt
- type OptionalString
- type PannerAttr
- func (a PannerAttr) ConeInnerAngle() float64
- func (a PannerAttr) ConeOuterAngle() float64
- func (a PannerAttr) ConeOuterGain() float64
- func (a PannerAttr) DistanceModel() DistanceModel
- func (a PannerAttr) MaxDistance() float64
- func (a PannerAttr) PanningModel() PanningModel
- func (a PannerAttr) RefDistance() float64
- func (a PannerAttr) RolloffFactor() float64
- func (a PannerAttr) SetConeInnerAngle(angle float64)
- func (a PannerAttr) SetConeOuterAngle(angle float64)
- func (a PannerAttr) SetConeOuterGain(gain float64)
- func (a PannerAttr) SetDistanceModel(model DistanceModel)
- func (a PannerAttr) SetMaxDistance(distance float64)
- func (a PannerAttr) SetPanningModel(model PanningModel)
- func (a PannerAttr) SetRefDistance(distance float64)
- func (a PannerAttr) SetRolloffFactor(factor float64)
- type PannerOptions
- type PanningModel
- type Sound
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoSuspend ¶
func AutoSuspend() bool
AutoSuspend suspends the Web Audio AudioContext after 30 seconds of inactivity to decrease processing and energy usage. Automatically resumes upon new playback. Set this property to false to disable this behavior.
func AutoUnlock ¶
func AutoUnlock() bool
AutoUnlock attempts to enable audio on mobile (iOS, Android, etc) devices and desktop Chrome/Safari.
func Codecs ¶
Codecs checks supported audio codecs. Returns true if the codec is supported in the current browser.
func HTML5PoolSize ¶
func HTML5PoolSize() int
HTML5PoolSize gets the pool size. Each HTML5 Audio object must be unlocked individually, so we keep a global pool of unlocked nodes to share between all Howl instances. This pool gets created on the first user interaction and is set to the size of this property.
func Orientation ¶
func Orientation() (orientation []float64)
Orientation gets the direction the listener is pointing in the 3D cartesian space. A front and up vector must be provided. The front is the direction the face of the listener is pointing, and up is the direction the top of the listener is pointing. Thus, these values are expected to be at right angles from each other. [x, y, z, xUp, yUp, zUp]
func Pos ¶
func Pos() (x, y, z float64)
Pos gets the position of the listener in 3D cartesian space.
func SetAutoUnlock ¶
func SetAutoUnlock(autoUnlock bool)
SetAutoUnlock sets the AutoUnlock property.
func SetHTML5PoolSize ¶
func SetHTML5PoolSize(size int)
SetHTML5PoolSize sets the HTML5PoolSize property.
func SetOrientation ¶
func SetOrientation(x, y, z, upX, upY, upZ float64)
SetOrientation sets the orientation.
func SetPos ¶
func SetPos(x, y, z float32)
SetPos sets the position of the listener in 3D cartesian space. Sounds using 3D position will be relative to the listener's position.
func SetStereo ¶
func SetStereo(stereo float64)
SetStereo is a helper method to update the stereo panning position of all current Howls. Future Howls will not use this value unless explicitly set.
func SetVolume ¶
func SetVolume(volume float64)
SetVolume sets the global volume for all sounds, relative to their own volume.
func Unload ¶
func Unload()
Unload and destroy all currently loaded Howl objects. This will immediately stop all sounds and remove them from cache.
func UsingWebAudio ¶
func UsingWebAudio() bool
UsingWebAudio returns true if the Web Audio API is available.
Types ¶
type CallbackErrorFunc ¶
type CallbackErrorFunc func(error)
type CallbackFunc ¶
type CallbackFunc func()
type DistanceModel ¶
type DistanceModel int
const ( DistanceModelUndefined DistanceModel = iota DistanceModelLinear DistanceModelInverse DistanceModelExponential )
type OptionalBool ¶
type OptionalBool = any
type OptionalFloat ¶
type OptionalFloat = any
type OptionalInt ¶
type OptionalInt = any
type OptionalString ¶
type OptionalString = any
type PannerAttr ¶
type PannerAttr struct {
// contains filtered or unexported fields
}
func (PannerAttr) ConeInnerAngle ¶
func (a PannerAttr) ConeInnerAngle() float64
func (PannerAttr) ConeOuterAngle ¶
func (a PannerAttr) ConeOuterAngle() float64
func (PannerAttr) ConeOuterGain ¶
func (a PannerAttr) ConeOuterGain() float64
func (PannerAttr) DistanceModel ¶
func (a PannerAttr) DistanceModel() DistanceModel
func (PannerAttr) MaxDistance ¶
func (a PannerAttr) MaxDistance() float64
func (PannerAttr) PanningModel ¶
func (a PannerAttr) PanningModel() PanningModel
func (PannerAttr) RefDistance ¶
func (a PannerAttr) RefDistance() float64
func (PannerAttr) RolloffFactor ¶
func (a PannerAttr) RolloffFactor() float64
func (PannerAttr) SetConeInnerAngle ¶
func (a PannerAttr) SetConeInnerAngle(angle float64)
func (PannerAttr) SetConeOuterAngle ¶
func (a PannerAttr) SetConeOuterAngle(angle float64)
func (PannerAttr) SetConeOuterGain ¶
func (a PannerAttr) SetConeOuterGain(gain float64)
func (PannerAttr) SetDistanceModel ¶
func (a PannerAttr) SetDistanceModel(model DistanceModel)
func (PannerAttr) SetMaxDistance ¶
func (a PannerAttr) SetMaxDistance(distance float64)
func (PannerAttr) SetPanningModel ¶
func (a PannerAttr) SetPanningModel(model PanningModel)
func (PannerAttr) SetRefDistance ¶
func (a PannerAttr) SetRefDistance(distance float64)
func (PannerAttr) SetRolloffFactor ¶
func (a PannerAttr) SetRolloffFactor(factor float64)
type PannerOptions ¶
type PannerOptions struct { // ConeInnerAngle is a parameter for directional audio sources, this is an angle, in // degrees, inside of which there will be no volume reduction. default: 360 ConeInnerAngle OptionalFloat `json:"cone_inner_angle,omitempty"` // ConeOuterAngle is a parameter for directional audio sources, this is an angle, in // degrees, outside of which the volume will be reduced to a constant value of // ConeOuterGain. default: 360 ConeOuterAngle OptionalFloat `json:"cone_outer_angle,omitempty"` // ConeOuterGain is a parameter for directional audio sources, this is the gain // outside of the coneOuterAngle. It is a linear value in the range [0, 1]. ConeOuterGain OptionalFloat `json:"cone_outer_gain,omitempty"` // DistanceModel determines algorithm used to reduce volume as audio moves away // from listener. Can be DistanceModelLinear, DistanceModelInverse or DistanceModelExponential. DistanceModel DistanceModel `json:"distance_model,omitempty"` // The maximum distance between source and listener, after which the volume will // not be reduced any further. default: 10000 MaxDistance OptionalFloat `json:"max_distance,omitempty"` // A reference distance for reducing volume as source moves further from the // listener. This is simply a variable of the distance model and has a different // effect depending on which model is used and the scale of your coordinates. // Generally, volume will be equal to 1 at this distance. default: 1 RefDistance OptionalFloat `json:"ref_distance,omitempty"` // How quickly the volume reduces as source moves from listener. This is simply a // variable of the distance model and can be in the range of [0, 1] with linear // and [0, ∞] with inverse and exponential. RolloffFactor OptionalFloat `json:"rolloff_factor,omitempty"` // Determines which spatialization algorithm is used to position audio. Can be // PanningModelHRTF or PanningModelEqualPower. PanningModel PanningModel `json:"panning_model,omitempty"` }
type PanningModel ¶
type PanningModel int
const ( PanningModelUndefined PanningModel = iota PanningModelHRTF PanningModelEqualPower )
type Sound ¶
type Sound interface { ID() int State() State Playing() bool Duration() time.Duration Play() Sound Pause() Stop() Mute() Unmute() Fade(from float64, to float64, duration time.Duration) Volume() float64 SetVolume(volume float64) Rate() float64 SetRate(float64) Seek() time.Duration SetSeek(duration time.Duration) Loop() bool SetLoop(loop bool) Stereo() float64 SetStereo(stereo float64) Pos() (x, y, z float64) SetPos(x, y, z float64) Orientation() (x, y, z float64) SetOrientation(x, y, z float64) PannerAttr() PannerAttr SetPannerAttr(attr PannerAttr) }