Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalysisResult ¶
type AnalysisResult struct {
Normalization float64
}
AnalysisResult is an object that contains the results of an analysis performed on a stream.
type AudioBuffer ¶
type AudioBuffer []byte
AudioBuffer wraps a []byte of audio data and provides handy functions to get and set values for a specific position in the buffer.
func (AudioBuffer) Get ¶
func (ab AudioBuffer) Get(i int) (l, r float64)
Get returns the values for the left and right audio channels at the specified stream sample index. The values returned for the left and right audio channels range from 0 to 1.
func (AudioBuffer) Len ¶
func (ab AudioBuffer) Len() int
func (AudioBuffer) Set ¶
func (ab AudioBuffer) Set(i int, l, r float64)
Set sets the left and right audio channel values at the specified stream sample index. The values should range from 0 to 1.
func (AudioBuffer) String ¶
func (ab AudioBuffer) String() string
type AudioProperties ¶
type AudioProperties map[string]*AudioProperty
func NewAudioProperties ¶
func NewAudioProperties() AudioProperties
func (AudioProperties) Get ¶
func (ap AudioProperties) Get(name string) *AudioProperty
type AudioProperty ¶
type AudioProperty struct {
// contains filtered or unexported fields
}
AudioProperty is an object that allows associating an AnalysisResult for a specific stream with a name for that stream.
func (*AudioProperty) Analyze ¶
func (ap *AudioProperty) Analyze(stream io.ReadSeeker, scanCount int64) AnalysisResult
Analyze analyzes the provided audio stream, returning an AnalysisResult object. The stream is the audio stream to be used for scanning, and the scanCount is the number of times the function should scan various parts of the audio stream. The higher the scan count, the more accurate the results should be, but the longer the scan would take. A scanCount of 16 means it samples the stream 16 times evenly throughout the file. If a scanCount of 0 is provided, it will default to 16.
func (*AudioProperty) ResetAnalyzation ¶
func (ap *AudioProperty) ResetAnalyzation()
type DSPChannel ¶
DSPChannel represents a channel that can have various effects applied to it.
func (*DSPChannel) Add ¶
func (dsp *DSPChannel) Add(name string, effect IEffect) *DSPChannel
Add adds the specified Effect to the DSPChannel under the given name. Note that effects added to DSPChannels don't need to specify source streams, as the DSPChannel automatically handles this.
func (*DSPChannel) CreatePlayer ¶
func (dsp *DSPChannel) CreatePlayer(sourceStream io.ReadSeeker) *DSPPlayer
CreatePlayer creates a new DSPPlayer to handle playback of a stream through the DSPChannel.
type DSPPlayer ¶
type DSPPlayer struct { *audio.Player Channel *DSPChannel Source io.ReadSeeker }
DSPPlayer embeds audio.Player and so has all of the functions and abilities of the default audio.Player while also applying effects placed on the source DSPChannel.
type IEffect ¶
type IEffect interface { io.ReadSeeker ApplyEffect(data []byte, bytesRead int) // This function is called when sound data goes through an effect. The effect should modify the data byte buffer. SetSource(io.ReadSeeker) // This function allows an effect's source to be dynamically altered; this allows for easy chaining with resound.ChainEffects(). }
IEffect indicates an effect that implements io.ReadSeeker and generally takes effect on an existing audio stream. It represents the result of applying an effect to an audio stream, and is playable in its own right.
func ChainEffects ¶
ChainEffects chains multiple effects for you automatically, returning the last chained effect. Example: sfxChain := resound.Chain(
resound.NewDelay(sourceSound).SetWait(0.2).SetStrength(0.5), resound.NewPan(nil), resound.NewVolume(nil),
) sfxChain at the end would be the Volume effect, which is being fed by the Pan effect, which is fed by the Delay effect.