audioplayer

package
v0.0.0-...-843c29a Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package audioplayer controls the audio.

Package audioplayer the audio.

Index

Constants

This section is empty.

Variables

View Source
var (
	WillPlay  func() bool
	IsPlaying func() bool
)
View Source
var (
	Playlist    = make([]globals.Track, 0)
	Songindex   = 0 // the index of the currently playing track
	TogglePause func() error
	Stop        func() error
	SetPause    func(bool) error
)

global variables

Functions

func Addsong

func Addsong(track globals.Track)

Addsong adds a song to the playlist

func Clear

func Clear()

Clear removes all entries from the playlist and stops playback.

func Close

func Close()

Close closes the audio engine

func Deletesong

func Deletesong(index int)

Deletesong removes the currently selected song from the playlist.

func GetMediaPosition

func GetMediaPosition() (float32, error)

GetMediaPosition returns media position as a float percentage between 0.0 and 1.0.

func GetPlaying

func GetPlaying() globals.Track

GetPlaying returns that is currently selected in the playlist if there is no such track second returned value is false

func GetPlaytime

func GetPlaytime() (time.Duration, time.Duration)

GetPlaytime returns the play time, and the total time of the track. If no track is playing the returned timings will be zero.

func Initialize

func Initialize()

Initialize the speaker with the specification defined at the top.

func Insertsong

func Insertsong(track globals.Track)

Insertsong inserts a song into the playlist directly after the song that is currently playing.

func MoveDown

func MoveDown(index int)

MoveDown swaps the currently selected track in the playlist with the one below it.

func MoveUp

func MoveUp(index int)

MoveUp swaps the currently selected track in the playlist with the one above it.

func Nextsong

func Nextsong()

Nextsong plays the next song (if available)

func PlaySong

func PlaySong(index int)

PlaySong plays the song at the index of the playlist

func Previoussong

func Previoussong()

Previoussong plays the previous song (if available)

func SetMediaPosition

func SetMediaPosition(percentage float32)

SetMediaPosition sets media position as percentage between 0.0 and 1.0. Some formats and protocols do not support this.

func Shuffle

func Shuffle()

Shuffle shuffles the playlist and places the currently playing track as the first track in the playlist. It will not halt playback.

Types

This section is empty.

Jump to

Keyboard shortcuts

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