audios

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeFromFile added in v0.6.0

func DecodeFromFile(fsys fs.FS, name string) (StreamSeekCloser, Format, error)

Types

type Format added in v0.6.0

type Format = beep.Format

func FormatFromFS added in v0.6.0

func FormatFromFS(fsys fs.FS) (Format, error)

FormatFromFS returns the format of the first audio file in the file system. It is possible that there is no audio file in file system.

type MusicPlayer added in v0.3.1

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

func NewMusicPlayer added in v0.3.1

func NewMusicPlayer(f beep.StreamSeekCloser, format beep.Format, ratio float64) MusicPlayer

func NewMusicPlayerFromFile added in v0.6.0

func NewMusicPlayerFromFile(fsys fs.FS, name string, ratio float64) (MusicPlayer, error)

func (*MusicPlayer) Close added in v0.3.1

func (mp *MusicPlayer) Close()

func (MusicPlayer) Duration added in v0.6.0

func (mp MusicPlayer) Duration() time.Duration

func (MusicPlayer) IsEmpty added in v0.6.0

func (mp MusicPlayer) IsEmpty() bool

func (MusicPlayer) IsPaused added in v0.6.0

func (mp MusicPlayer) IsPaused() bool

func (MusicPlayer) IsPlayed added in v0.6.0

func (mp MusicPlayer) IsPlayed() bool

func (*MusicPlayer) Pause added in v0.6.0

func (mp *MusicPlayer) Pause()

func (*MusicPlayer) Play added in v0.6.0

func (mp *MusicPlayer) Play()

func (MusicPlayer) PlaybackRate added in v0.6.0

func (mp MusicPlayer) PlaybackRate() float64

func (*MusicPlayer) Resume added in v0.6.0

func (mp *MusicPlayer) Resume()

func (*MusicPlayer) Rewind added in v0.6.0

func (mp *MusicPlayer) Rewind()

func (*MusicPlayer) SetPlaybackRate added in v0.6.0

func (mp *MusicPlayer) SetPlaybackRate(ratio float64)

func (*MusicPlayer) SetVolume added in v0.6.0

func (mp *MusicPlayer) SetVolume(vol float64)

func (MusicPlayer) Time added in v0.6.0

func (mp MusicPlayer) Time() time.Duration

type Sound added in v0.3.1

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

Sound is for playing simple sound effects.

func NewSound added in v0.3.1

func NewSound(fsys fs.FS, name string, volumeScale *float64) Sound

NewSound returns an empty struct when error occurs because most of error just comes from file not found.

func (Sound) Play added in v0.3.1

func (s Sound) Play(vol float64)

Play plays a random sound from the sound pod.

type SoundMap

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

func NewSoundMap

func NewSoundMap(fsys fs.FS, format beep.Format, volumeScale *float64) SoundMap

It is possible that there is no sounds in file system. Hence, selecting format from the first met sound in file system then do beep.NewBuffer(format) may cause error.

func (*SoundMap) AppendSound added in v0.6.0

func (sm *SoundMap) AppendSound(name string, streamer beep.StreamSeekCloser)

func (*SoundMap) AppendSoundFromFile added in v0.6.0

func (sm *SoundMap) AppendSoundFromFile(fsys fs.FS, name string) error

func (SoundMap) Len added in v0.6.0

func (sm SoundMap) Len() int

Len returns the number of sounds in SoundMap.

func (SoundMap) Play

func (sm SoundMap) Play(name string, vol float64)

func (*SoundMap) SetResampleRatio added in v0.6.0

func (sm *SoundMap) SetResampleRatio(ratio float64)

type SoundPlayer added in v0.3.1

type SoundPlayer interface {
	Play(vol float64)
}

SoundPlayer is an interface for playing sound. It is implemented by Sound and SoundPod.

type SoundPod added in v0.6.0

type SoundPod struct {
	SoundMap
}

SoundBag is for playing randomly one of the sounds.

func NewSoundPod added in v0.6.0

func NewSoundPod(fsys fs.FS, format beep.Format, volumeScale *float64) SoundPod

func (SoundPod) Play added in v0.6.0

func (sp SoundPod) Play(vol float64)

Play plays a random sound from the sound pod.

type StreamSeekCloser added in v0.6.0

type StreamSeekCloser = beep.StreamSeekCloser

type Streamer added in v0.6.0

type Streamer = beep.Streamer

func NewSilence added in v0.6.0

func NewSilence(duration time.Duration) Streamer

Jump to

Keyboard shortcuts

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