mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
feat(tracker, gioui): add error message if vuanalyzer detects a NaN
Closes #50
This commit is contained in:
@ -3,6 +3,7 @@ package gioui
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gioui.org/app"
|
||||
"gioui.org/io/clipboard"
|
||||
@ -29,6 +30,9 @@ func (t *Tracker) Run(w *app.Window) error {
|
||||
case v := <-t.volumeChan:
|
||||
t.lastVolume = v
|
||||
w.Invalidate()
|
||||
case e := <-t.errorChannel:
|
||||
t.Alert.Update(e.Error(), Error, time.Second*5)
|
||||
w.Invalidate()
|
||||
case e := <-w.Events():
|
||||
switch e := e.(type) {
|
||||
case system.DestroyEvent:
|
||||
|
@ -69,6 +69,7 @@ type Tracker struct {
|
||||
player *tracker.Player
|
||||
refresh chan struct{}
|
||||
playerCloser chan struct{}
|
||||
errorChannel chan error
|
||||
audioContext sointu.AudioContext
|
||||
|
||||
*tracker.Model
|
||||
@ -152,10 +153,11 @@ func New(audioContext sointu.AudioContext, synthService sointu.SynthService, syn
|
||||
PatternOrderList: &layout.List{Axis: layout.Vertical},
|
||||
PatternOrderScrollBar: &ScrollBar{Axis: layout.Vertical},
|
||||
ConfirmInstrDelete: new(Dialog),
|
||||
errorChannel: make(chan error, 32),
|
||||
}
|
||||
t.Model = tracker.NewModel()
|
||||
vuBufferObserver := make(chan []float32)
|
||||
go tracker.VuAnalyzer(0.3, 1e-4, 1, -100, 20, vuBufferObserver, t.volumeChan)
|
||||
go tracker.VuAnalyzer(0.3, 1e-4, 1, -100, 20, vuBufferObserver, t.volumeChan, t.errorChannel)
|
||||
t.Theme.Palette.Fg = primaryColor
|
||||
t.Theme.Palette.ContrastFg = black
|
||||
t.SetEditMode(tracker.EditTracks)
|
||||
|
Reference in New Issue
Block a user