audio

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {

	// CreateMedia creates a new Media object based on the specified info.
	CreateMedia(info MediaInfo) Media

	// Play plays the specified media as soon as possible.
	Play(media Media, info PlayInfo) Playback
}

API provides access to a low-level audio manipulation and playback.

func NewNopAPI added in v0.15.0

func NewNopAPI() API

type Media added in v0.15.0

type Media interface {

	// Length returns the duration of the media.
	Length() time.Duration

	// Delete frees any resources used by this media.
	Delete()
}

Media represents a playable audio sequence.

type MediaDataType added in v0.15.0

type MediaDataType int8

MediaDataType indicates the type of media data contained in a data block.

const (
	MediaDataTypeAuto MediaDataType = iota
	MediaDataTypeWAV
	MediaDataTypeMP3
)

type MediaInfo added in v0.15.0

type MediaInfo struct {
	Data     []byte
	DataType MediaDataType
}

MediaInfo contains the necessary information to create a Media.

type PlayInfo added in v0.15.0

type PlayInfo struct {

	// Loop indicates whether the playback should loop.
	Loop bool

	// Gain indicates the amount of volume, where 1.0 is max and 0.0 is min.
	Gain float64

	// Pan indicates the sound panning, where -1.0 is left, 0.0 is center, and
	// 1.0 is right.
	Pan float64
}

PlayInfo specifies conditions for the playback.

type Playback added in v0.15.0

type Playback interface {

	// Stop causes the playback to stop.
	Stop()
}

Jump to

Keyboard shortcuts

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