+ 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)
+