sdl

package
v0.0.0-...-d0ed23c Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package sdl implements an audio engine using libSDL2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine is the SDL2 audio engine.

func New

func New(flags int) (*Engine, error)

New initializes an SDL2 Mixer for the audio engine.

Pass the SDL2 Mixer flags for its initialization. The flags are an OR'd value made up of:

mix.INIT_MP3
mix.INIT_OGG
mix.INIT_FLAC
mix.INIT_MOD

func (*Engine) LoadMusic

func (e *Engine) LoadMusic(filename string) (Track, error)

LoadMusic loads a music file from disk.

func (*Engine) LoadMusicBin

func (e *Engine) LoadMusicBin(data []byte) (Track, error)

LoadMusicBin loads a music file from bytes data.

func (*Engine) LoadSound

func (e *Engine) LoadSound(filename string) (Track, error)

LoadSound loads a wave file from disk.

func (*Engine) LoadSoundBin

func (e *Engine) LoadSoundBin(data []byte) (Track, error)

LoadSoundBin loads a wave file from bytes data.

func (*Engine) Playing

func (e *Engine) Playing() bool

Playing returns if either music or sounds are currently playing.

func (*Engine) PlayingMusic

func (e *Engine) PlayingMusic() bool

PlayingMusic returns if music is currently playing.

func (*Engine) PlayingSound

func (e *Engine) PlayingSound() bool

PlayingSound returns if sounds are playing.

func (*Engine) Setup

func (e *Engine) Setup() error

Setup initializes SDL2 Mixer.

func (*Engine) StopAll

func (e *Engine) StopAll()

StopAll stops all music and sounds.

func (*Engine) StopMusic

func (e *Engine) StopMusic()

StopMusic stops all music.

func (*Engine) StopSounds

func (e *Engine) StopSounds()

StopSounds stops all sounds.

func (*Engine) Teardown

func (e *Engine) Teardown() error

Teardown closes the SDL mixer.

type Track

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

Track is a music or sound effect file.

func (Track) Destroy

func (t Track) Destroy() error

Destroy the track.

func (Track) Pause

func (t Track) Pause() error

Pause the track.

func (*Track) Play

func (t *Track) Play(loops int) error

Play the track.

func (*Track) Playing

func (t *Track) Playing() bool

Playing tells if this sound is already playing.

func (Track) Stop

func (t Track) Stop() error

Stop the track.

Jump to

Keyboard shortcuts

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