Documentation ¶
Overview ¶
Package audio provides audio playing utilities.
Index ¶
- Variables
- func BatchLoad(baseFolder string) error
- func BlankBatchLoad(baseFolder string) error
- func DefaultPlay(filename string) error
- func Play(f *font.Font, filename string) error
- type Audio
- func (a *Audio) Copy() (klang.Audio, error)
- func (a *Audio) Filter(fs ...klang.Filter) (klang.Audio, error)
- func (a *Audio) MustCopy() klang.Audio
- func (a *Audio) MustFilter(fs ...klang.Filter) klang.Audio
- func (a *Audio) Play() <-chan error
- func (a *Audio) SetVolume(v int32) error
- func (a *Audio) Stop() error
- func (a *Audio) Xp() *float64
- func (a *Audio) Yp() *float64
- type Cache
- type Data
- type Ears
- type Pos
- type ScaleType
- type SupportsPos
Constants ¶
This section is empty.
Variables ¶
var DefaultCache = NewCache()
DefaultCache is the receiver for package level loading operations.
var DefaultFont = font.New()
DefaultFont is the font used for default functions. It can be publicly modified to apply a default font to generated audios through def methods. If it is not modified, it is a font of zero filters.
Functions ¶
func BatchLoad ¶
BatchLoad attempts to load all files within a given directory depending on their file ending
func BlankBatchLoad ¶
BlankBatchLoad acts like BatchLoad, but replaces all loaded assets with empty audio constructs. This is intended to reduce start-up times in development.
func DefaultPlay ¶
DefaultPlay is shorthand for Play(DefaultFont, filename)
Types ¶
type Audio ¶
Audio is a struct of some audio data and the variables required to filter it through a sound font.
func (*Audio) MustFilter ¶
MustFilter acts like Filter but ignores errors.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a simple audio data cache
type Data ¶
Data is an alias for an interface supporting the built in filters in our underlying audio library
type Ears ¶
type Ears struct { X *float64 Y *float64 PanWidth float64 SilenceRadius float64 // VolumeScale and PanScale are currently ignored because there is only // one scale type VolumeScale ScaleType PanScale ScaleType }
Ears are assisting variables and some position in the game world where audio should be 'heard' from, like the player character. Passing in that position's x and y as pointers then will allow for sounds further away from that point to be quieter and sounds to the left / right of that point to be panned left and right.
func (*Ears) CalculatePan ¶
CalculatePan converts PanWidth and two x positions into a left / right pan value.
type Pos ¶
type Pos func(SupportsPos)
Pos functions are filters that require a SupportsPos interface
Directories ¶
Path | Synopsis |
---|---|
Package flac provides functionality to handle .flac files and .flac encoded data.
|
Package flac provides functionality to handle .flac files and .flac encoded data. |
Package font provides utilities to package together audio manipulations as a 'font'.
|
Package font provides utilities to package together audio manipulations as a 'font'. |
ceol
Package ceol provides functionality to handle .ceol files and .ceol encoded data (Bosca Ceoil files).
|
Package ceol provides functionality to handle .ceol files and .ceol encoded data (Bosca Ceoil files). |
dls
Package dls contains data structures for DLS (.dls) file types.
|
Package dls contains data structures for DLS (.dls) file types. |
riff
Package riff reads and umarshalls RIFF files.
|
Package riff reads and umarshalls RIFF files. |
Package klang provides audio playing and encoding support
|
Package klang provides audio playing and encoding support |
filter
Package filter provides various audio filters to be applied to audios through the Filter function.
|
Package filter provides various audio filters to be applied to audios through the Filter function. |
filter/supports
Package supports holds interface types for filter supports.
|
Package supports holds interface types for filter supports. |
Package mp3 provides functionality to handle .mp3 files and .mp3 encoded data.
|
Package mp3 provides functionality to handle .mp3 files and .mp3 encoded data. |
Package sequence provides generators and options for creating audio sequences.
|
Package sequence provides generators and options for creating audio sequences. |
Package synth provides functions and types to support waveform synthesis.
|
Package synth provides functions and types to support waveform synthesis. |
Package wav provides functionality to handle .wav files and .wav encoded data.
|
Package wav provides functionality to handle .wav files and .wav encoded data. |
Package wininternal defines common initialization steps for audio on windows.
|
Package wininternal defines common initialization steps for audio on windows. |