feat(tracker): change keyboard shortcuts to mimic old trackers

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2024-10-11 13:44:06 +03:00
parent b4a63ce362
commit 91b7850bf7
7 changed files with 122 additions and 39 deletions

View File

@ -36,7 +36,6 @@ type (
ChangedSinceSave bool
RecoveryFilePath string
ChangedSinceRecovery bool
Loop Loop
}
Model struct {
@ -59,6 +58,7 @@ type (
recording bool
playing bool
playPosition sointu.SongPos
loop Loop
noteTracking bool
quitted bool
@ -132,7 +132,6 @@ const (
ScoreChange
BPMChange
RowsPerBeatChange
LoopChange
SongChange ChangeType = PatchChange | ScoreChange | BPMChange | RowsPerBeatChange
)
@ -156,7 +155,7 @@ const maxUndo = 64
func (m *Model) AverageVolume() Volume { return m.avgVolume }
func (m *Model) PeakVolume() Volume { return m.peakVolume }
func (m *Model) PlayPosition() sointu.SongPos { return m.playPosition }
func (m *Model) Loop() Loop { return m.d.Loop }
func (m *Model) Loop() Loop { return m.loop }
func (m *Model) PlaySongRow() int { return m.d.Song.Score.SongRow(m.playPosition) }
func (m *Model) ChangedSinceSave() bool { return m.d.ChangedSinceSave }
func (m *Model) Dialog() Dialog { return m.dialog }
@ -183,7 +182,7 @@ func NewModelPlayer(synther sointu.Synther, recoveryFilePath string) (*Model, *P
modelMsgs: modelMessages,
synther: synther,
song: m.d.Song.Copy(),
loop: m.d.Loop,
loop: m.loop,
avgVolumeMeter: VolumeAnalyzer{Attack: 0.3, Release: 0.3, Min: -100, Max: 20},
peakVolumeMeter: VolumeAnalyzer{Attack: 1e-4, Release: 1, Min: -100, Max: 20},
}
@ -244,9 +243,6 @@ func (m *Model) change(kind string, t ChangeType, severity ChangeSeverity) func(
if m.changeType&RowsPerBeatChange != 0 {
m.send(RowsPerBeatMsg{m.d.Song.RowsPerBeat})
}
if m.changeType&LoopChange != 0 {
m.send(m.d.Loop)
}
m.undoSkipCounter++
var limit int
switch m.changeSeverity {
@ -322,7 +318,6 @@ func (m *Model) UnmarshalRecovery(bytes []byte) {
}
m.d.ChangedSinceRecovery = false
m.send(m.d.Song.Copy())
m.send(m.d.Loop)
m.updatePatternUseCount()
}
@ -402,7 +397,6 @@ func (m *Model) resetSong() {
}
m.d.FilePath = ""
m.d.ChangedSinceSave = false
m.d.Loop = Loop{}
}
// send sends a message to the player