mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
fix(tracker): clamp CurrentInstrument and CurrentUnit when song is loaded
This commit is contained in:
parent
207ae5195d
commit
73cbc4314f
@ -82,6 +82,12 @@ func (t *Tracker) LoadSong(song sointu.Song) error {
|
||||
defer t.songPlayMutex.Unlock()
|
||||
t.song = song
|
||||
t.ClampPositions()
|
||||
if l := len(t.song.Patch.Instruments); t.CurrentInstrument >= len(t.song.Patch.Instruments) {
|
||||
t.CurrentInstrument = l - 1
|
||||
}
|
||||
if l := len(t.song.Patch.Instruments[t.CurrentInstrument].Units); t.CurrentUnit >= l {
|
||||
t.CurrentUnit = l - 1
|
||||
}
|
||||
if t.sequencer != nil {
|
||||
t.sequencer.SetPatch(song.Patch)
|
||||
t.sequencer.SetRowLength(song.SamplesPerRow())
|
||||
|
Loading…
x
Reference in New Issue
Block a user