d2audio

package
v0.0.0-...-7f92c57 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package d2audio provides AudioProvider implementations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sound

type Sound struct {
	*d2util.Logger
	// contains filtered or unexported fields
}

A Sound that can be started and stopped

func (*Sound) Play

func (s *Sound) Play()

Play the sound

func (*Sound) SetPan

func (s *Sound) SetPan(pan float64)

SetPan sets the stereo pan, range -1 to 1

func (*Sound) Stop

func (s *Sound) Stop()

Stop the sound, only required for looping sounds

func (*Sound) String

func (s *Sound) String() string

String returns the sound filename

type SoundEngine

type SoundEngine struct {
	*d2util.Logger
	// contains filtered or unexported fields
}

SoundEngine provides functions for playing sounds

func NewSoundEngine

func NewSoundEngine(provider d2interface.AudioProvider,
	asset *d2asset.AssetManager, l d2util.LogLevel, term d2interface.Terminal) *SoundEngine

NewSoundEngine creates a new sound engine

func (*SoundEngine) Advance

func (s *SoundEngine) Advance(elapsed float64)

Advance updates sound engine state, triggering events and envelopes

func (*SoundEngine) PlaySoundHandle

func (s *SoundEngine) PlaySoundHandle(handle string) *Sound

PlaySoundHandle plays a sound by sounds.txt handle

func (*SoundEngine) PlaySoundID

func (s *SoundEngine) PlaySoundID(id int) *Sound

PlaySoundID plays a sound by sounds.txt index, returning the sound here is kinda ugly now we could have a situation where someone holds onto the sound after the sound engine is done with it someone needs to be in charge of deciding when to stopping looping sounds though...

func (*SoundEngine) Reset

func (s *SoundEngine) Reset()

Reset stop all sounds and reset state

func (*SoundEngine) UnbindTerminalCommands

func (s *SoundEngine) UnbindTerminalCommands(term d2interface.Terminal) error

UnbindTerminalCommands unbinds commands from the terminal

type SoundEnvironment

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

SoundEnvironment represents the audio environment for map areas

func NewSoundEnvironment

func NewSoundEnvironment(soundEngine *SoundEngine) SoundEnvironment

NewSoundEnvironment creates a SoundEnvironment using the given SoundEngine

func (*SoundEnvironment) Advance

func (s *SoundEnvironment) Advance(elapsed float64)

Advance advances the sound engine and plays sounds when necessary

func (*SoundEnvironment) SetEnv

func (s *SoundEnvironment) SetEnv(environmentIdx int)

SetEnv sets the sound environment using the given record index

Directories

Path Synopsis
Package ebiten contains ebiten's implementation of the audio interface
Package ebiten contains ebiten's implementation of the audio interface

Jump to

Keyboard shortcuts

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