I'm trying this on Windows, SDK v2.0.3 but I think the problem is older than that.
This is what I'm doing:
- Create a sequence, add a track, add a synth
- Add Notes to a track on positions 1,5,9,13 (making the sequence greater than 5 steps)
- Set the sequence to loop from position 1 to 5 two times
- The sequence plays twice, but after that it continues to the end of the sequence. Shouldn't it stop at position 5?
sequence:setLoops(1,5,2)
The sequence plays like this:
1,2,3,4,5,1,2,3,4,5,6,7,8,9,10,11,12,13,stop
Example code:
local seq2 = playdate.sound.sequence.new()
seq2:setTempo(4)
local track = playdate.sound.track.new()
seq2:addTrack(track)
track:addNote(1, "C3", 1, 1)
track:addNote(5, "C4", 1, 1)
track:addNote(9, "C5", 1, 1)
track:addNote(13, "C6", 1, 1)
local synth = playdate.sound.synth.new(playdate.sound.kWavePOVosim)
synth:setADSR(0, 0.1, 0.6, 0)
local instrument = playdate.sound.instrument.new()
instrument:addVoice(synth)
track:setInstrument(instrument)
seq2:setLoops(1, 5, 2)
seq2:play()
note: it doesn't matter where I call setLoops(), the result is always the same.