mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
feat(tracker): add ability to loop part of song during playback
Closes #128.
This commit is contained in:
parent
aa7a2e56fa
commit
dc12f58082
@ -36,6 +36,7 @@ type (
|
||||
ChangedSinceSave bool
|
||||
RecoveryFilePath string
|
||||
ChangedSinceRecovery bool
|
||||
Loop Loop
|
||||
}
|
||||
|
||||
Model struct {
|
||||
@ -81,6 +82,12 @@ type (
|
||||
sointu.SongPos
|
||||
}
|
||||
|
||||
// Loop identifier the order rows, which are the loop positions
|
||||
// Length = 0 means no loop is chosen, regardless of start
|
||||
Loop struct {
|
||||
Start, Length int
|
||||
}
|
||||
|
||||
Explore struct {
|
||||
IsSave bool // true if this is a save operation, false if open operation
|
||||
IsSong bool // true if this is a song, false if instrument
|
||||
@ -125,6 +132,7 @@ const (
|
||||
ScoreChange
|
||||
BPMChange
|
||||
RowsPerBeatChange
|
||||
LoopChange
|
||||
SongChange ChangeType = PatchChange | ScoreChange | BPMChange | RowsPerBeatChange
|
||||
)
|
||||
|
||||
@ -148,6 +156,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) 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 }
|
||||
@ -233,6 +242,9 @@ 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 {
|
||||
@ -385,6 +397,7 @@ func (m *Model) resetSong() {
|
||||
}
|
||||
m.d.FilePath = ""
|
||||
m.d.ChangedSinceSave = false
|
||||
m.d.Loop = Loop{}
|
||||
}
|
||||
|
||||
// send sends a message to the player
|
||||
|
Reference in New Issue
Block a user