Documentation ¶
Index ¶
- Variables
- func GetMasterVolume() float64
- func SetMasterVolume(volume float64)
- type AudioComponent
- type AudioFace
- type AudioSystem
- type Audioable
- type NotAudioComponent
- type NotAudioable
- type Player
- func (p *Player) Close() error
- func (p *Player) Current() time.Duration
- func (p *Player) GetVolume() float64
- func (p *Player) IsPlaying() bool
- func (p *Player) Pause()
- func (p *Player) Play()
- func (p *Player) Rewind() error
- func (p *Player) Seek(offset time.Duration) error
- func (p *Player) SetVolume(volume float64)
- func (p *Player) URL() string
Constants ¶
This section is empty.
Variables ¶
var SampleRate = 44100
SampleRate is the sample rate at which the player plays audio. Any audios resource that is added to the system is resampled to this sample rate. To change the sample rate, you must do so BEFORE adding the audio system to the world.
Functions ¶
func GetMasterVolume ¶
func GetMasterVolume() float64
GetMasterVolume gets the master volume of the audio system.
func SetMasterVolume ¶
func SetMasterVolume(volume float64)
SetMasterVolume sets the master volume. The masterVolume is multiplied by all the other volumes to get the volume of each entity played. Value must be between 0 and 1 or else it doesn't set.
Types ¶
type AudioComponent ¶
type AudioComponent struct {
Player *Player
}
AudioComponent is a Component which is used by the AudioSystem
func (*AudioComponent) GetAudioComponent ¶
func (c *AudioComponent) GetAudioComponent() *AudioComponent
GetAudioComponent Provides container classes ability to fulfil the interface and be accessed more simply by systems, eg in AddByInterface Methods
type AudioFace ¶
type AudioFace interface {
GetAudioComponent() *AudioComponent
}
AudioFace allows typesafe access to an anonymouse child AudioComponent
type AudioSystem ¶
type AudioSystem struct {
// contains filtered or unexported fields
}
AudioSystem is a System that allows for sound effects and / or music
func (*AudioSystem) Add ¶
func (a *AudioSystem) Add(basic *ecs.BasicEntity, audio *AudioComponent)
Add adds an entity to the AudioSystem
func (*AudioSystem) AddByInterface ¶
func (a *AudioSystem) AddByInterface(i ecs.Identifier)
AddByInterface Allows an Entity to be added directly using the Audioable interface, which every entity containing the BasicEntity and AnimationComponent anonymously, automatically satisfies.
func (*AudioSystem) New ¶
func (a *AudioSystem) New(w *ecs.World)
New is called when the AudioSystem is added to the world.
func (*AudioSystem) Remove ¶
func (a *AudioSystem) Remove(basic ecs.BasicEntity)
Remove removes an entity from the AudioSystem
func (*AudioSystem) Update ¶
func (a *AudioSystem) Update(dt float32)
Update is called once per frame, and updates/plays the players in the AudioSystem
type NotAudioComponent ¶
type NotAudioComponent struct{}
NotAudioComponent is used to flag an entity as not in the AudioSystem even if it has the proper components
func (*NotAudioComponent) GetNotAudioComponent ¶
func (n *NotAudioComponent) GetNotAudioComponent() *NotAudioComponent
GetNotAudioComponent implements the NotAudioable interface
type NotAudioable ¶
type NotAudioable interface {
GetNotAudioComponent() *NotAudioComponent
}
NotAudioable is an interface used to flag an entity as not in the AudioSystem even if it has the proper components
type Player ¶
type Player struct { Repeat bool // contains filtered or unexported fields }
Player holds the underlying audio data and plays/pauses/stops/rewinds/seeks it.
func LoadedPlayer ¶
LoadedPlayer retrieves the *audio.Player created from the URL
func (*Player) Close ¶
Close removes the player from the audio system's players, which are currently playing players. it then finalizes and frees the data from the player.
func (*Player) Rewind ¶
Rewind rewinds the current position to the start.
Rewind returns error when seeking the source stream returns error.
func (*Player) Seek ¶
Seek seeks the position with the given offset.
Seek returns error when seeking the source stream returns error.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
decode/convert
package convert resamples and converts audio data
|
package convert resamples and converts audio data |
decode/mp3
Package mp3 provides MP3 decoder.
|
Package mp3 provides MP3 decoder. |
decode/vorbis
Package vorbis provides Ogg/Vorbis decoder.
|
Package vorbis provides Ogg/Vorbis decoder. |
decode/wav
Package wav provides WAV (RIFF) decoder.
|
Package wav provides WAV (RIFF) decoder. |