Browse Source

Prevent Fraction type to get saved to json for standard durations

master
Nils 6 years ago
parent
commit
1370b28ea1
  1. 7
      engine/items.py

7
engine/items.py

@ -366,6 +366,9 @@ class Duration(object):
else: #the highest value in datalist was smaller
return None
if completeDuration == int(completeDuration):
completeDuration = int(completeDuration)
durList = [D1024, D512, D256, D128, D64, D32, D16, D8, D4, D2, D1, DB, DL, DM]
guessedBase = _closest(completeDuration, durList)
@ -1341,8 +1344,10 @@ class Chord(Item):
for note in self.notelist:
oldValues.append(note.duration.copy()) #we don't actually need a copy since we create a new one. But better safe than sorry. This matches also the behaviour of the other duration change functions.
complDur = note.duration.completeDuration()
#newTicks = complDur / newparts
#newTicks = complDur / newparts
note.duration = Duration.createByGuessing(Fraction(complDur, newparts))
#Now we have one note with the duration the user wants to have. Make n-1 copies-
spawnedNotes = []

Loading…
Cancel
Save