Browse Source

Fix duplicate to reserverd-space block. it was using the track duration, not the blocks

master
Nils 2 years ago
parent
commit
2185895f67
  1. 21
      engine/track.py

21
engine/track.py

@ -490,7 +490,7 @@ class Track(object):
copy = block.copy(newParentTrack=self, nameSuffix="-reserved")
copy.data = list() #empty
copy.minimumInTicks = self.duration()
copy.minimumInTicks = block.duration()
self.blocks.insert(index +1, copy)
self.toPosition(originalPosition) #has head() in it
@ -1306,14 +1306,29 @@ class Track(object):
currentSubGroupFlag = obj["flag"]
subBeamGroups[-1].append(obj)
previous_subGroup_firstNoteDuration = 0
previous_subGroup_lastNoteDuration = 0
for subBeamGroup in subBeamGroups:
for obj in subBeamGroup:
startStaffLine = obj[startDotOnLineKeyword]
length = beamPosition - startStaffLine
length = beamPosition - startStaffLine #vertical, in stafflines.
obj["beam"] = (startStaffLine, length, direction) #(starting point, length, 1|-)] 1 stem is on the right or -1 left side of the note.
firstItem, lastItem = subBeamGroup[0], subBeamGroup[-1]
connectorLength = lastItem["completeDuration"] if not lastItem == beamGroup[-1] else 0
#Now calculate the horizontal length.
#This is difficult because you can mix durations e.g. 16th and 8th in the same beam.
#This syncopation 16 8 16 has the 8th in the middle. If any of the 16th beams connects to the left or right side this would be indistinguishable from a 16th note.
#It is also difficult because it is on the boundary of subBeamGroups
if not lastItem == beamGroup[-1]:
connectorLength = lastItem["completeDuration"]
elif lastItem == beamGroup[-1]:
connectorLength = 0
resultBeamGroups.append((firstItem["tickindex"], lastItem["tickindex"] + connectorLength, abs(firstItem["flag"]), beamPosition, direction)) #tick-start, tick-end, duration-type, position as staffline. Extra simple for the GUI.
#Beams finished
resultAppend(metaData)

Loading…
Cancel
Save