gme

package module
v0.0.0-...-aac85c9 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: LGPL-2.1 Imports: 5 Imported by: 3

Documentation

Overview

Package gme decodes game music files.

This package requires cgo and uses code from http://blargg.8bitalley.com/libs/audio.html#Game_Music_Emu.

Index

Constants

View Source
const (
	FadeLength = time.Second * 8
)

Variables

View Source
var (
	// InfoOnly is the sample rate to New if only track information is needed.
	InfoOnly = C.gme_info_only
)

Functions

This section is empty.

Types

type GME

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

GME decodes game music.

func New

func New(b []byte, sampleRate int) (*GME, error)

New opens the file from b with given sample rate.

func (*GME) Close

func (g *GME) Close()

Close closes the GME file and frees its used memory.

func (*GME) Ended

func (g *GME) Ended() bool

Ended returns whether the current track has ended.

func (*GME) Play

func (g *GME) Play(data []int16) (err error)

Play decodes the next samples into data. Data is populated with two channels interleaved.

func (*GME) Played

func (g *GME) Played() time.Duration

Played returns the played time of the current track.

func (*GME) Start

func (g *GME) Start(track int) error

Start initializes the n-th track for playback, 0-based.

func (*GME) Track

func (g *GME) Track(track int) (Track, error)

Track returns information about the n-th track, 0-based.

func (*GME) Tracks

func (g *GME) Tracks() int

Tracks returns the number of tracks in the file.

func (*GME) Warning

func (g *GME) Warning() string

Warning returns the last warning produced and clears it.

type Track

type Track struct {
	PlayLength time.Duration

	// Times; negative if unknown.
	// Length is the total length, if specified by file.
	Length      time.Duration
	IntroLength time.Duration
	LoopLength  time.Duration

	System    string
	Game      string
	Song      string
	Author    string
	Copyright string
	Comment   string
	Dumper    string
}

Jump to

Keyboard shortcuts

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