Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var QuitError = errors.New("intentionally quitting")
View Source
var SigIntError = errors.New("SIGINT caught")
Functions ¶
Types ¶
type Backend ¶
type Backend struct {
// Commands can be used to send commands to the UI.
Commands chan Command
// UIStates receives updates to the UI state non-blockingly.
UIStates chan UIState
// contains filtered or unexported fields
}
func NewBackend ¶
type Command ¶
type Command struct {
// Exit exits all current playbacks and returns to waiting state.
Exit bool
// Quit quits the entire main loop.
Quit bool
// PlayOne plays the given file.
PlayOne string
// PlayPrelude enters prelude player mode.
PlayPrelude bool
// New list of tags for prelude selection.
PreludeTags map[string]bool
// Tempo sets the tempo to a new factor.
Tempo float64
// NumVerses is an override for the verse count.
NumVerses int
// Answer continues the current playback (exits a Prompt state).
Answer bool
// Skip skips the current playback (exits a Prompt state).
Skip bool
// Config contains a new configuration. Will be applied on next hymn.
Config *processor.Config
// OutPort contains a new, not yet opened, MIDI port. Will be applied once silent.
OutPort drivers.Out
}
func (Command) IsMainLoopCommand ¶
IsMainLoopCommands returns if the command can only be handled by the main loop.
type UIState ¶
type UIState struct {
// Err is set to show an error message. The backend is dead, but can be
// restarted by sending a PlayOne or PlayPrelude message.
Err error
// PlayOne is the name of the currently playing file.
PlayOne string
// PlayPrelude indicates if we're in the prelude player.
PlayPrelude bool
// List of tags for prelude selection.
PreludeTags map[string]bool
// Tempo is the current tempo as a factor of normal.
Tempo float64
// Number of verses to play.
NumVerses int
// HavePostlude tells if a postlude is pending.
HavePostlude bool
// Prompt is the text to prompt the user with.
// To clear a prompt, send the Answer or Skip message.
Prompt string
// SkipPrompt is nonempty is when the skip button should be available.
// To clear a prompt, send the Answer or Skip message.
SkipPrompt string
// CurrentFile is the currently being played file.
CurrentFile string
// CurrentPart is the currently being played part.
CurrentPart processor.OutputKey
// CurrentMessage is a message for what is currently playing.
CurrentMessage string
// Playing is whether we are currently playing.
Playing bool
// PlaybackPosTime is the wall time PlaybackPos was last updated.
PlaybackPosTime time.Time
// PlaybackPos is the current playback position.
PlaybackPos time.Duration
// PlaybackLen is the length of the current file.
PlaybackLen time.Duration
// Verse is the current verse.
Verse int
// Comment is the hymn comment string.
Comment string
// UnrolledNumVerses of real verses in hymn. Only useful if NumVerses == 1.
UnrolledNumVerses int
}
UIState is the state of the user interface.
func (UIState) ActualPlaybackFraction ¶
func (UIState) ActualPlaybackPos ¶
Click to show internal directories.
Click to hide internal directories.