Remove devices list and device vector length check

This commit is contained in:
NeilClack
2026-04-23 17:26:22 -05:00
parent 9575833392
commit 05a7098886
8 changed files with 71 additions and 80 deletions
+8 -17
View File
@@ -231,7 +231,7 @@ func (p *ScrollerPage) Init(ctx *PageCtx) error {
// Get line pattern from database
var err error
linePatternName := p.Base.Context.CfgPtr.LinePattern
linePatternName := p.Context.CfgPtr.LinePattern
p.activePattern, err = linePattern.Get(linePatternName)
if err != nil {
@@ -239,7 +239,7 @@ func (p *ScrollerPage) Init(ctx *PageCtx) error {
}
// Initialize color pattern
var baseColors = []sdl.Color{
baseColors := []sdl.Color{
colors.Tan,
colors.PeachPuff,
colors.LightCyan,
@@ -252,7 +252,7 @@ func (p *ScrollerPage) Init(ctx *PageCtx) error {
// Get font sizes from database (optimize: load once, cache as int32)
// Match the working page's logic exactly:
p.fontScale = float32(32) / float32(p.Base.Context.CfgPtr.StandardFontSize)
p.fontScale = float32(32) / float32(p.Context.CfgPtr.StandardFontSize)
// Font setup
nLines := int(float32(p.ScreenHeight) / 32.0) // 32 is your target visual size
@@ -291,7 +291,7 @@ func (p *ScrollerPage) Init(ctx *PageCtx) error {
}
// Audio setup
audioDeviceName := p.Base.Context.CfgPtr.SelectedAudioDevice
audioDeviceName := p.Context.CfgPtr.SelectedAudioDevice
// Switch audio devices if needed
if mixer.CurrentDevice() != audioDeviceName {
@@ -302,12 +302,12 @@ func (p *ScrollerPage) Init(ctx *PageCtx) error {
// Start audio playback
// selectedAudio := p.Base.Context.CfgPtr.SelectedAudio
// selectedAudio := p.Context.CfgPtr.SelectedAudio
assetsDir := p.Base.Context.CfgPtr.AssetsDir
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.Base.Context.CfgPtr); err != nil {
if err := mixer.Play(audioFile, true, p.Context.CfgPtr); err != nil {
logger.Error("Mixer returned an error: %v", err) // ADD THIS
}
@@ -414,15 +414,6 @@ func (p *ScrollerPage) HandleEvent(event *sdl.Event) error {
if !p.autoVelocity {
p.velocity -= p.increment
}
case sdl.K_a:
p.autoVelocity = !p.autoVelocity
if p.autoVelocity {
// Reset to initial state when enabling
p.velocity = p.velocityFloor
p.velocityDirection = 1
p.velocityState = 0
p.velocityTimer = 0.0
}
}
return nil
}
@@ -594,7 +585,7 @@ func (p *ScrollerPage) Destroy() error {
return nil
}
mixer.Stop(1000, p.Base.Context.CfgPtr)
mixer.Stop(1000, p.Context.CfgPtr)
// GL cleanup — delete all text textures
if p.lines != nil {