mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
feat(tracker): save recovery file regularly & load it on startup
This commit is contained in:
parent
12f15d1066
commit
df2605fddd
@ -148,8 +148,6 @@ func NewTracker(model *tracker.Model, synthService sointu.SynthService) *Tracker
|
||||
t.Theme.Palette.Fg = primaryColor
|
||||
t.Theme.Palette.ContrastFg = black
|
||||
t.TrackEditor.Focus()
|
||||
t.SetOctave(4)
|
||||
t.ResetSong()
|
||||
t.quitWG.Add(1)
|
||||
return t
|
||||
}
|
||||
@ -160,6 +158,7 @@ func (t *Tracker) Main() {
|
||||
app.Size(unit.Dp(800), unit.Dp(600)),
|
||||
app.Title("Sointu Tracker"),
|
||||
)
|
||||
recoveryTicker := time.NewTicker(time.Second * 10)
|
||||
t.Explorer = explorer.NewExplorer(w)
|
||||
var ops op.Ops
|
||||
mainloop:
|
||||
@ -180,6 +179,7 @@ mainloop:
|
||||
}
|
||||
select {
|
||||
case <-t.quitChannel:
|
||||
recoveryTicker.Stop()
|
||||
break mainloop
|
||||
case e := <-t.errorChannel:
|
||||
t.Alert.Update(e.Error(), Error, time.Second*5)
|
||||
@ -211,9 +211,12 @@ mainloop:
|
||||
t.Layout(gtx, w)
|
||||
e.Frame(gtx.Ops)
|
||||
}
|
||||
case <-recoveryTicker.C:
|
||||
go t.SaveRecovery()
|
||||
}
|
||||
}
|
||||
w.Perform(system.ActionClose)
|
||||
t.SaveRecovery()
|
||||
t.quitWG.Done()
|
||||
}
|
||||
|
||||
|
629
tracker/model.go
629
tracker/model.go
File diff suppressed because it is too large
Load Diff
@ -296,6 +296,9 @@ loop:
|
||||
}
|
||||
|
||||
func (p *Player) compileOrUpdateSynth() {
|
||||
if p.bpm <= 0 {
|
||||
return // bpm not set yet
|
||||
}
|
||||
if p.synth != nil {
|
||||
err := p.synth.Update(p.patch, p.bpm)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user