package main import "github.com/gopxl/beep/v2/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() }