Sfoglia il codice sorgente

Add dynamic ramps to ly output

master
Nils 2 anni fa
parent
commit
96f70c061a
  1. 16
      engine/items.py

16
engine/items.py

@ -2657,7 +2657,7 @@ class DynamicRamp(Item):
"""Get the complete velocity for a tickindex, without the base
velocity from the dynamic Signature"""
if self._cachedVelocity >= 0 and self._cachedTargetVelocity >= 0 and self._cachedTargetTick >= 0 and self._cachedTickIndex >= 0:
assert tickindex <= self._cachedTargetTick
#assert tickindex <= self._cachedTargetTick #not correct.
#assert tickindex >= self._cachedTickIndex #this creates problems with patterns which modify the tickindex while exporting.
if self.graphType == "linear":
@ -2682,6 +2682,10 @@ class DynamicRamp(Item):
elif self._cachedVelocity < self._cachedTargetVelocity:
keyword = "cresc"
#else it stays dyn-ramp.
#We export this so many times.. let's bake the variant into a variable for later lilypond export.
self._cacheKeywordForLilypond = "\\<" if keyword == "cresc" else "\\>"
return {
"type": "DynamicSignature",
"graphType" : self.graphType,
@ -2692,6 +2696,16 @@ class DynamicRamp(Item):
"UIstring" : keyword,
}
def _lilypond(self, carryLilypondRanges):
"""
Lilypond Dynamics are postfix.
Don't export anything directly, but add the dynamic keyword to the lilypond ranges dict
so the next chord can use it as postfix. """
carryLilypondRanges["DynamicSignature"] = self._cacheKeywordForLilypond
return ""
class LegatoSlur(Item):
def __init__(self):
super().__init__()

Caricamento…
Annulla
Salva