Audio player
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
792 B

package main
import "github.com/faiface/beep/speaker"
type appConfig struct {
Input map[string][]string // Keybinds
Layout string
Volume int // Starting volume
Remember bool
Dir string
QueueFiles []*libraryEntry
QueuePlaying int
AudioPosition int
}
var config = &appConfig{
Layout: defaultLayout,
Volume: defaultVolume,
Remember: true,
}
func clearAppState() {
config.Dir = ""
config.QueueFiles = nil
config.QueuePlaying = 0
config.AudioPosition = 0
}
func saveAppState() {
config.Dir = mainDirectory
config.QueueFiles = queueFiles
config.QueuePlaying = queuePlaying
speaker.Lock()
if playingStreamer == nil {
config.AudioPosition = 0
} else {
config.AudioPosition = playingStreamer.Position()
}
speaker.Unlock()
}