audio selection works

This commit is contained in:
NeilClack
2026-06-17 00:46:56 -05:00
parent 4b7d2c13d5
commit 74874f97c5
6 changed files with 598 additions and 143 deletions
+25 -7
View File
@@ -3,7 +3,6 @@ package page
import (
"fmt"
"math"
"path/filepath"
"strings"
"github.com/go-gl/gl/v3.3-core/gl"
@@ -261,12 +260,31 @@ func (p *ScrollerPage) Init(ctx *PageCtx) error {
}
}
assetsDir := p.Context.CfgPtr.AssetsDir
audioFile := filepath.Join(assetsDir, "audio/audio.wav")
logger.Info("Attempting to play %s", audioFile)
if err := mixer.Play(audioFile, true, p.Context.CfgPtr); err != nil {
logger.Error("Mixer returned an error: %v", err)
}
audioFilePath := p.Context.DbPtr.Find
// Download if it doesn't exist
fmt.Printf("%s", audioFilePath)
// // Check if the track has previously been downloaded
// // TODO: Download audio via a goroutine
// // this is a path
// // figure out how to get the filename, not the path, from the path.
// _, err = os.Stat(audioFilePath)
// if err != nil {
// filename := filepath.Base(audioFilePath)
// url := "https://files.radiantwavetech.com/audio/" + filename
// logger.Info("%s not present. Downloading...", entry.DisplayName)
// // Download the track if not, display loading bar
// if err = netreq.Download(filename, filepath.Join(p.Base.Context.CfgPtr.AssetsDir, "audio"), url); err != nil {
// logger.Error("Failed to download file: %v", err)
// return
// }
// logger.Info("Downloaded %s", entry.DisplayName)
// }
// if err := mixer.Play(audioFile, true, p.Context.CfgPtr); err != nil {
// logger.Error("Mixer returned an error: %v", err)
// }
currentDevice := mixer.CurrentDevice()
if currentDevice == "" {