Browse Source

make sure that on cursor metrical sig crossing we start at 0 ticks internally

master
Nils 4 months ago
parent
commit
6daf2d271e
  1. 10
      engine/track.py

10
engine/track.py

@ -557,7 +557,7 @@ class Track(object):
def right(self):
if self.currentBlock().right(): #side effect: actual moving
self.parseRight()
self.parseRight() #we parse the previous item
return 1
elif self.state.blockindex+1 < len(self.blocks): #block counts from 0, len from 1. If block+1 is smaller than the amount of blocks this means this is not the final block.
#block end. This is already the previous state. right now we are in the next block already.
@ -600,7 +600,10 @@ class Track(object):
break
def measureStart(self):
if self.state.ticksSinceLastMeasureStartLive < 0: #upbeats are lower than 0
if self.state.ticksSinceLastMeasureStartLive == 0:
#Already at the start
return
elif self.state.ticksSinceLastMeasureStartLive < 0: #upbeats are lower than 0
while not self.state.ticksSinceLastMeasureStartLive == 0:
self.right()
else:
@ -614,6 +617,8 @@ class Track(object):
else:
self.head()
assert self.state.ticksSinceLastMeasureStartLive == 0, self.state.ticksSinceLastMeasureStartLive
def startOfBlock(self):
currentBlock = self.currentBlock() #we stay in this block so this doesn't need to change.
while not currentBlock.localCursorIndex == 0:
@ -792,6 +797,7 @@ class Track(object):
self.state.keySignatures.append(item)
elif isinstance(item, MetricalInstruction):
self.state.metricalInstructions.append(item)
self.state.ticksSinceLastMeasureStartLive = 0 #by definition.
elif isinstance(item, DynamicSignature):
self.state.dynamicSignatures.append(item)
self.state.dynamicRamp = None #reset

Loading…
Cancel
Save