feat(tracker): do not wrap around when playing or moving cursor

The wrapping was usually unwanted behaviour. The user can use the
looping (Ctrl-L) to loop the song forever if this is really desired.
This commit is contained in:
5684185+vsariola@users.noreply.github.com
2024-09-07 18:52:52 +03:00
parent 5e65410d27
commit 877556b428
4 changed files with 19 additions and 5 deletions

View File

@ -192,12 +192,21 @@ func (p *Player) advanceRow() {
if p.song.Score.Length == 0 || p.song.Score.RowsPerPattern == 0 {
return
}
origPos := p.songPos
p.songPos.PatternRow++ // advance row (this is why we subtracted one in Play())
if p.loop.Length > 0 && p.songPos.PatternRow >= p.song.Score.RowsPerPattern && p.songPos.OrderRow == p.loop.Start+p.loop.Length-1 {
p.songPos.PatternRow = 0
p.songPos.OrderRow = p.loop.Start
}
p.songPos = p.song.Score.Wrap(p.songPos)
p.songPos = p.song.Score.Clamp(p.songPos)
if p.songPos == origPos {
p.send(IsPlayingMsg{bool: false})
p.playing = false
for i := range p.song.Score.Tracks {
p.releaseTrack(i)
}
return
}
p.send(nil) // just send volume and song row information
lastVoice := 0
for i, t := range p.song.Score.Tracks {