+2006-05-16 Han-Wen Nienhuys <hanwen@lilypond.org>
+
+ * python/musicxml.py (Part.interpret): don't complain about
+ incomplete measures.
+
+ * scripts/musicxml2ly.py (musicxml_voice_to_lily_voice): only add
+ new music if last_event_chord() returned None.
+
+ * python/musicxml.py (Part.interpret): skip back over chord notes.
+
2006-05-16 Erik Sandberg <mandolaerik@gmail.com>
+
* lily/percent-repeat-engraver.cc, lily/parser.yy,
lily/define-music-types.cc, lily/percent-repeat-iterator.cc,
lily/slash-repeat-engraver.cc,
attributes_dict = {}
attributes_object = None
measures = self.get_typed_children (Measure)
-
+ last_moment = Rational (-1)
+ last_measure_position = Rational (-1)
for m in measures:
measure_start_moment = now
measure_position = Rational (0)
factor = Rational (1,
int (attributes_dict['divisions'].get_text ()))
- elif (n.get_maybe_exist_typed_child (Duration)
- and not n.get_maybe_exist_typed_child (Chord)):
-
+
+
+ if (n.get_maybe_exist_typed_child (Duration)):
mxl_dur = n.get_maybe_exist_typed_child (Duration)
dur = mxl_dur.get_length () * factor
and attributes_object.get_measure_length () == dur):
rest._is_whole_measure = True
-
+
+ if (dur > Rational (0)
+ 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._measure_position = measure_position
problem = 'incomplete'
if now > new_now:
problem = 'overfull'
-
- m.message ('%s measure? Expected: %s, Difference: %s' % (problem, now, new_now - now))
+
+ ## only for verbose operation.
+ if problem <> 'incomplete':
+ m.message ('%s measure? Expected: %s, Difference: %s' % (problem, now, new_now - now))
now = new_now
'Acoustic Snare Drum': 'acousticsnare',
'Side Stick': 'sidestick',
'Open Triangle': 'opentriangle',
+ 'Mute Triangle': 'mutetriangle',
'Tambourine': 'tambourine',
}
self.add_music (evc, diff)
def last_event_chord (self, starting_at):
+
+ value = None
if (self.elements
and isinstance (self.elements[-1], musicexp.EventChord)
and self.begin_moment == starting_at):
- return self.elements[-1]
+ value = self.elements[-1]
else:
self.jumpto (starting_at)
- return None
+ value = None
+
+ return value
+
def correct_negative_skip (self, goto):
self.end_moment = goto
self.begin_moment = goto
modes_found = {}
voice_builder = LilyPondVoiceBuilder()
+
for n in voice._elements:
if n.get_name () == 'forward':
continue
- try:
- voice_builder.jumpto (n._when)
- except NegativeSkip, neg:
- voice_builder.correct_negative_skip (n._when)
- n.message ("Negative skip? from %s to %s, diff %s" % (neg.here, neg.dest, neg.dest - neg.here))
+ if not n.get_maybe_exist_named_child ('chord'):
+ try:
+ voice_builder.jumpto (n._when)
+ except NegativeSkip, neg:
+ voice_builder.correct_negative_skip (n._when)
+ n.message ("Negative skip? from %s to %s, diff %s" % (neg.here, neg.dest, neg.dest - neg.here))
if isinstance (n, musicxml.Attributes):
if n.is_first () and n._measure_position == Rational (0):
ev_chord = voice_builder.last_event_chord (n._when)
if not ev_chord:
ev_chord = musicexp.EventChord()
+ voice_builder.add_music (ev_chord, n._duration)
-
ev_chord.append (main_event)
- voice_builder.add_music (ev_chord, n._duration)
notations = n.get_maybe_exist_typed_child (musicxml.Notations)
tuplet_event = None