audios

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SampleRate = 44100

Functions

func NewBytes

func NewBytes(path string) ([]byte, error)

NewBytes is for short sounds: long audio file will make the game stutter. No returns closer since NewPlayerFromBytes needs no Closer: no any files are open.

func NewPlayer

func NewPlayer(path string) (*audio.Player, func() error, error)

func PlayEffect

func PlayEffect(src []byte, vol float64)

Types

type SoundMap

type SoundMap struct {
	// contains filtered or unexported fields
}

func NewSoundMap

func NewSoundMap(vol *float64) SoundMap

func (SoundMap) Play

func (s SoundMap) Play(name string)
func (s SoundMap) Register(path, key string) error {
	b, err := NewBytes(path)
	if err != nil {
		return err
	}
	if key == "" {
		key = filepath.Base(path)
	}
	s.bytes[key] = b
	// s.Closers = append(s.Closers, closer)
	return nil
}

func (SoundMap) PlayWithVolume

func (s SoundMap) PlayWithVolume(name string, vol2 float64)

func (SoundMap) Register

func (s SoundMap) Register(path string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL