--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.1 Partwise//EN"\r
+ "http://www.musicxml.org/dtds/partwise.dtd">\r
+<score-partwise version="1.1">\r
+ <movement-title>Slurs</movement-title>\r
+ <identification>\r
+ <creator type="composer">Reinhold Kainhofer</creator>\r
+ <rights>Public Domain</rights>\r
+ <encoding>\r
+ <software>Finale 2008 for Windows</software>\r
+ <software>Dolet Light for Finale 2008</software>\r
+ <encoding-date>2008-11-11</encoding-date>\r
+ </encoding>\r
+ </identification>\r
+ <part-list>\r
+ <score-part id="P1">\r
+ <part-name print-object="no">MusicXML Part</part-name>\r
+ <score-instrument id="P1-I1">\r
+ <instrument-name>Grand Piano</instrument-name>\r
+ </score-instrument>\r
+ <midi-instrument id="P1-I1">\r
+ <midi-channel>1</midi-channel>\r
+ <midi-program>1</midi-program>\r
+ </midi-instrument>\r
+ </score-part>\r
+ </part-list>\r
+ <!--=========================================================-->\r
+ <part id="P1">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>0</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>G</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ <notations>\r
+ <slur number="1" placement="above" type="start"/>\r
+ </notations>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>C</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ <notations>\r
+ <slur number="1" type="stop"/>\r
+ <slur number="1" placement="above" type="start"/>\r
+ </notations>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>A</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ <notations>\r
+ <slur number="1" type="stop"/>\r
+ <slur number="1" placement="below" type="start"/>\r
+ </notations>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>G</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ <notations>\r
+ <slur number="1" type="stop"/>\r
+ </notations>\r
+ </note>\r
+ </measure>\r
+ <!--=======================================================-->\r
+ <measure number="2">\r
+ <note>\r
+ <pitch>\r
+ <step>G</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ <notations>\r
+ <slur number="1" placement="above" type="start"/>\r
+ </notations>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>C</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ <notations>\r
+ <slur number="2" placement="above" type="start"/>\r
+ </notations>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>A</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ <stem default-y="10.5">up</stem>\r
+ <notations>\r
+ <slur number="2" type="stop"/>\r
+ </notations>\r
+ </note>\r
+ <note default-x="312">\r
+ <pitch>\r
+ <step>G</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ <stem default-y="5.5">up</stem>\r
+ <notations>\r
+ <slur number="1" type="stop"/>\r
+ </notations>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+</score-partwise>\r
tuplet_events.append ((ev_chord, tuplet_event, frac))
- slurs = [s for s in notations.get_named_children ('slur')
- if s.get_type () in ('start','stop')]
- if slurs:
- if len (slurs) > 1:
- error_message (_ ('cannot have two simultaneous slurs'))
+ # First, close all open slurs, only then start any new slur
+ # TODO: Record the number of the open slur to dtermine the correct
+ # closing slur!
+ endslurs = [s for s in notations.get_named_children ('slur')
+ if s.get_type () in ('stop')]
+ if endslurs and not inside_slur:
+ endslurs[0].message (_ ('Encountered closing slur, but no slur is open'))
+ elif endslurs:
+ if len (endslurs) > 1:
+ endslurs[0].message (_ ('Cannot have two simultaneous (closing) slurs'))
# record the slur status for the next note in the loop
if not grace:
- if slurs[0].get_type () == 'start':
- inside_slur = True
- elif slurs[0].get_type () == 'stop':
- inside_slur = False
- lily_ev = musicxml_spanner_to_lily_event (slurs[0])
+ inside_slur = False
+ lily_ev = musicxml_spanner_to_lily_event (endslurs[0])
ev_chord.append (lily_ev)
+ startslurs = [s for s in notations.get_named_children ('slur')
+ if s.get_type () in ('start')]
+ if startslurs and inside_slur:
+ startslurs[0].message (_ ('Cannot have a slur inside another slur'))
+ elif startslurs:
+ if len (startslurs) > 1:
+ startslurs[0].message (_ ('Cannot have two simultaneous slurs'))
+ # record the slur status for the next note in the loop
+ if not grace:
+ inside_slur = True
+ lily_ev = musicxml_spanner_to_lily_event (startslurs[0])
+ ev_chord.append (lily_ev)
+
+
if not grace:
mxl_tie = notations.get_tie ()
if mxl_tie and mxl_tie.type == 'start':