self.duration = Rational(0)
self.start = Rational(0)
self.converted = False
+ self.voice_id = None;
class Music_xml_spanner(Music_xml_node):
return p
+class Measure_element (Music_xml_node):
+ def get_voice_id (self):
+ voice = self.get_maybe_exist_named_child ('voice')
+ if voice:
+ return voice.get_text ()
+ else:
+ return self.voice_id;
+
+
class Attributes(Measure_element):
def __init__(self):
class Lyric(Music_xml_node):
- def get_number(self):
+ def number(self):
"""
Return the number attribute(if it exists) of the lyric element.
self.has_lyrics = len(lyrics) > 0
for l in lyrics:
- nr = l.get_number()
+ nr = l.number
if(nr > 0) and not(nr in self._lyrics):
self._lyrics.append(nr)
measure_start_moment = now
measure_position = Rational(0)
- for n in m.get_all_children():
+ voice_id = None;
+ assign_to_next_voice = []
+ for n in m.get_all_children ():
+ # assign a voice to all measure elements
+ if (n.get_name() == 'backup'):
+ voice_id = None;
+
+ if isinstance(n, Measure_element):
+ if n.get_voice_id ():
+ voice_id = n.get_voice_id ()
+ for i in assign_to_next_voice:
+ i.voice_id = voice_id
+ assign_to_next_voice = []
+ else:
+ if voice_id:
+ n.voice_id = voice_id
+ else:
+ assign_to_next_voice.append (n)
+
# figured bass has a duration, but applies to the next note
# and should not change the current measure position!
if isinstance(n, FiguredBass):
class KeyAlter(Music_xml_node):
pass
+class Direction (Measure_element):
+ pass
+
class KeyOctave(Music_xml_node):
pass