return lstr
-class EventChord(NestedMusic):
+class EventChord (NestedMusic):
def get_length (self):
l = Rational (0)
for e in self.elements:
self.forced_accidental = False
def get_properties (self):
- str = RhythmicEvent.get_properties ()
+ str = RhythmicEvent.get_properties (self)
if self.pitch:
str += self.pitch.lisp_expression ()
def escape_ly_output_string (input_string):
return_string = input_string
- needs_quotes = re.search ("[0-9\" ,.]", return_string);
+ needs_quotes = re.search ("[0-9\" ,._-]", return_string);
return_string = string.replace (return_string, "\"", "\\\"")
if needs_quotes:
return_string = "\"" + return_string + "\""
and n.get_maybe_exist_typed_child (Chord)):
now = last_moment
measure_position = last_measure_position
-
- last_moment = now
- last_measure_position = measure_position
- n._when = now
+ n._when = now
n._measure_position = measure_position
- n._duration = dur
- now += dur
- measure_position += dur
+ n._duration = dur
+ if dur > Rational (0):
+ last_moment = now
+ last_measure_position = measure_position
+ now += dur
+ measure_position += dur
if n._name == 'note':
instrument = n.get_maybe_exist_named_child ('instrument')
if instrument:
def last_event_chord (self, starting_at):
value = None
+
+ # if the position matches, find the last EventChord, do not cross a bar line!
+ at = len( self.elements ) - 1
+ while (at >= 0 and
+ not isinstance (self.elements[at], musicexp.EventChord) and
+ not isinstance (self.elements[at], musicexp.BarCheck)):
+ at -= 1
+
if (self.elements
- and isinstance (self.elements[-1], musicexp.EventChord)
+ and at >= 0
+ and isinstance (self.elements[at], musicexp.EventChord)
and self.begin_moment == starting_at):
- value = self.elements[-1]
+ value = self.elements[at]
else:
self.jumpto (starting_at)
value = None