liborchid

package
v0.0.0-...-deee9ad Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match(a, b string) (matched bool, distance int)

Match takes two strings a, b and returns whether they match (fuzzy matching; if a matches b then all characters in a can be found in b in the same relative order as they appear in a) and the distance between a and b. If match is false then the distance returned should not be trusted.

Types

type Input

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

Input represents an editable rune buffer with a cursor.

func NewInput

func NewInput() *Input

NewInput creates a new empty Input.

func (*Input) Cursor

func (i *Input) Cursor() int

Cursor returns the current cursor position. Note that the cursor position is not the length of the buffer, and is in the interval [0, len(buffer)].

func (*Input) Delete

func (i *Input) Delete()

Delete deletes a rune at the current cursor if possible, else does nothing.

func (*Input) Feed

func (i *Input) Feed(key termbox.Key, ch rune, mod termbox.Modifier)

Feed is a convenience function that interprets the given key, rune, and modifier mask and calls the appropriate methods, e.g. if key == left arrow then Move(-1) is called.

func (*Input) Insert

func (i *Input) Insert(r rune)

Insert inserts the given rune at the current cursor position.

func (*Input) Move

func (i *Input) Move(n int)

Move increments the cursor by n (n can be negative). If moving the cursor brings it to an invalid position then it will automatically be corrected.

func (*Input) String

func (i *Input) String() string

String returns the internal buffer as a string.

type MWorker

type MWorker struct {
	VolumeChange chan VolumeInfo
	Results      chan *PlaybackResult
	SongQueue    chan *Song
	Progress     chan float64
	// contains filtered or unexported fields
}

func NewMWorker

func NewMWorker() *MWorker

func (*MWorker) Play

func (mw *MWorker) Play()

func (*MWorker) Stop

func (mw *MWorker) Stop()

func (*MWorker) Stream

func (mw *MWorker) Stream() *Stream

func (*MWorker) VolumeInfo

func (mw *MWorker) VolumeInfo() VolumeInfo

type PlaybackResult

type PlaybackResult struct {
	Song     *Song
	Stream   *Stream
	Complete bool
	Error    error
}

type Queue

type Queue struct {
	Shuffle bool
	Repeat  bool
	Songs   []*Song
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue(songs []*Song) *Queue

func (*Queue) Next

func (p *Queue) Next(i int, force bool) *Song

func (*Queue) Peek

func (p *Queue) Peek(i int) *Song

func (*Queue) Remove

func (p *Queue) Remove(s *Song)

func (*Queue) SetCurrent

func (p *Queue) SetCurrent(s *Song)

func (*Queue) Song

func (p *Queue) Song() *Song

func (*Queue) ToggleRepeat

func (p *Queue) ToggleRepeat()

func (*Queue) ToggleShuffle

func (p *Queue) ToggleShuffle()

type Song

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

func FindSongs

func FindSongs(dir string, recursive bool) (songs []*Song)

func NewSong

func NewSong(path string) *Song

func (*Song) Metadata

func (s *Song) Metadata() tag.Metadata

func (*Song) Name

func (s *Song) Name() string

func (*Song) Stream

func (s *Song) Stream() (*Stream, error)

type Stream

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

func NewStream

func NewStream(stream beep.StreamSeekCloser, format beep.Format) *Stream

func (*Stream) Complete

func (s *Stream) Complete() <-chan bool

func (*Stream) Paused

func (s *Stream) Paused() bool

func (*Stream) Play

func (s *Stream) Play()

func (*Stream) Progress

func (s *Stream) Progress() float64

func (*Stream) SetVolume

func (s *Stream) SetVolume(v VolumeInfo)

func (*Stream) Stop

func (s *Stream) Stop()

func (*Stream) Toggle

func (s *Stream) Toggle() bool

type Viewbox

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

Viewbox represents the bounds [a,b) for a scrollable list with height h and maximum index m. It can be used to find the bounds for a scrollable list as the user is scrolling through it.

func NewViewbox

func NewViewbox(max, height int) *Viewbox

NewViewbox returns a new Viewbox.

func (*Viewbox) Hi

func (v *Viewbox) Hi() int

Hi returns the upper bound.

func (*Viewbox) Lo

func (v *Viewbox) Lo() int

Lo returns the lower bound.

func (*Viewbox) Update

func (v *Viewbox) Update(i int) (lo int, hi int)

Update updates the bounds so that i fits in [a',b'), taking into account the maximum value and the height. The new bounds are returned.

type VolumeInfo

type VolumeInfo struct {
	V   float64
	Min float64
	Max float64
}

func (VolumeInfo) Silent

func (v VolumeInfo) Silent() bool

func (VolumeInfo) Volume

func (v VolumeInfo) Volume() float64

Jump to

Keyboard shortcuts

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