absentia

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 9 Imported by: 0

README

Absentia | A music player for lunatics

Go Doc

This package has the functions needed in order to build a music player, which can be found in the cmd dir.

Prerequisites

You'll need Go 1.11 or higher, a C compiler, and some libraries.

Linux

On Ubuntu or Debian, run:

sudo apt install libasound2-dev libegl1-mesa-dev xorg-dev

Building

You can then install it simply with:

go get gitlab.com/sacules/absentia/cmd/absentia

Usage

Right now it only supports mp3 files.

$ absentia [music file]

Documentation

Overview

Package absentia provides a functions for building a music player

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioFormat

type AudioFormat int

AudioFormat represents the supported file formats

const (
	FormatMp3 AudioFormat = iota
	FormatOGG
	FormatFLAC
	FormatWAV
)

Currently supported formats

type Player

type Player struct {
	Paused bool

	// Length is the amount of frames of the current song
	Length int

	// Duration is the total track duration
	Duration time.Duration
	// contains filtered or unexported fields
}

Player allows to control the current audio stream

func (*Player) CurrentDuration

func (p *Player) CurrentDuration() time.Duration

CurrentDuration returns in how far the track is playing

func (*Player) CurrentPosition

func (p *Player) CurrentPosition() int

CurrentPosition returns the current frame

func (*Player) MovePlayback

func (p *Player) MovePlayback(n int) error

MovePlayback moves the player to sample n

func (*Player) Pause

func (p *Player) Pause() error

Pause stops the playback of the audio stream

func (*Player) Play

func (p *Player) Play() error

Play starts the playback of the audio stream

func (*Player) Read

func (p *Player) Read(rc io.ReadCloser, audiofmt AudioFormat) error

Read takes a ReadCloser containing audio data and creates a playback stream according to the proper format

func (*Player) SamplesPerSecond

func (p *Player) SamplesPerSecond() int

SamplesPerSecond returns the amount of samples in 1 second

func (Player) VolumeChange

func (p Player) VolumeChange(n float64)

VolumeChange modifies the audio stream's volume.

Directories

Path Synopsis
cmd
Package log provides a simple structured logging interface, with fancy colors and number line
Package log provides a simple structured logging interface, with fancy colors and number line

Jump to

Keyboard shortcuts

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