]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' of git://git.sv.gnu.org/lilypond
authorGraham Percival <graham@percival-music.ca>
Sat, 9 Feb 2008 17:23:14 +0000 (09:23 -0800)
committerGraham Percival <graham@percival-music.ca>
Sat, 9 Feb 2008 17:23:14 +0000 (09:23 -0800)
Documentation/de/index.html.in
input/regression/musicxml/03a-Directions-MusicXML.xml
input/regression/musicxml/03b-AccordionRegistrations-MusicXML.xml [new file with mode: 0644]
python/musicexp.py
python/musicxml.py
scripts/lilypond-book.py
scripts/musicxml2ly.py
stepmake/stepmake/metafont-rules.make

index 5e1565f95d5f0a15ae45e8806771db9894612a8b..7416fb4050899757c51d9af7815871b5af1dd8a6 100644 (file)
        <br>
        <strong>@DATE@</strong>
       </p>
+      
+      <p>
+      <strong>Achtung:</strong> Diese &Uuml;bersetzung befindet sich noch in der Entwicklung, <br>
+      die englische Version (Link unten auf der Seite) bietet die
+      vollst&auml;ndige Fassung der Dokumentation.
+      </p>
     </div>
 
     <table align="center">
index 071052e68e5d896764cfa78bdd676b64224e4d6e..b68d4e59b7f1002dc664530d63a7322548019671 100644 (file)
@@ -4,6 +4,7 @@
 <score-partwise version="2.0">\r
   <movement-title>MusicXML directions (attached to staff)</movement-title>\r
   <identification/>\r
+  <defaults/>\r
   <part-list>\r
     <score-part id="P1">\r
       <part-name></part-name>\r
       </note>\r
       <direction>\r
         <direction-type>\r
-          <braclet type="stop" line-end="none"/>\r
+          <bracket type="stop" line-end="none"/>\r
         </direction-type>\r
       </direction>\r
       <note>\r
       <direction placement="below">\r
         <direction-type>\r
           <dynamics><ppp/></dynamics>\r
+        </direction-type>\r
+        <direction-type>\r
           <wedge type="crescendo"/>\r
         </direction-type>\r
         <offset>2</offset>\r
       <direction placement="below">\r
         <direction-type>\r
           <wedge type="stop"/>\r
+        </direction-type>\r
+        <direction-type>\r
           <dynamics><fff/></dynamics>\r
         </direction-type>\r
         <offset>2</offset>\r
diff --git a/input/regression/musicxml/03b-AccordionRegistrations-MusicXML.xml b/input/regression/musicxml/03b-AccordionRegistrations-MusicXML.xml
new file mode 100644 (file)
index 0000000..ad6fa3c
--- /dev/null
@@ -0,0 +1,356 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 2.0 Partwise//EN"\r
+                                "http://www.musicxml.org/dtds/partwise.dtd">\r
+<score-partwise version="2.0">\r
+  <movement-title>Accordion registrations</movement-title>\r
+  <identification/>\r
+  <defaults/>\r
+  <part-list>\r
+    <score-part id="P1">\r
+      <part-name></part-name>\r
+    </score-part>\r
+  </part-list>\r
+  <!--=========================================================-->\r
+  <part id="P1">\r
+    <!-- Direction type can contain the following child types:\r
+         rehearsal+ | segno+ | words+ |\r
+         coda+ | wedge | dynamics+ | dashes | bracket | pedal | \r
+         metronome | octave-shift | harp-pedals | damp | \r
+         damp-all | eyeglasses | scordatura | image |\r
+         accordion-registration | other-direction -->\r
+    <!-- Rehearsal marks -->\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
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>0/0/1</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-middle>1</accordion-middle>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>0/1/0</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-middle>1</accordion-middle>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>0/1/1</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-middle>2</accordion-middle>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>0/2/0</text></lyric>\r
+      </note>\r
+    </measure>\r
+    <measure number="2">\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-middle>2</accordion-middle>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>0/2/1</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-middle>3</accordion-middle>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>0/3/0</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-middle>3</accordion-middle>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>0/3/1</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>1/0/1</text></lyric>\r
+      </note>\r
+    </measure>\r
+    <measure number="3">\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>1/0/0</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-middle>1</accordion-middle>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>1/1/0</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-middle>1</accordion-middle>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>1/1/1</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-middle>2</accordion-middle>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>1/2/0</text></lyric>\r
+      </note>\r
+    </measure>\r
+    <measure number="4">\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-middle>2</accordion-middle>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>1/2/1</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-middle>3</accordion-middle>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>1/3/0</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-middle>3</accordion-middle>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>1/3/1</text></lyric>\r
+      </note>\r
+      <!-- Special cases: No accordion-(high|middle|low) given, empty middle, \r
+           middle with invalid value, middle with 0 -->\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>empty</text></lyric>\r
+      </note>\r
+    </measure>\r
+    <measure number="5">\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-middle/>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>empty M</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-middle>test</accordion-middle>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>inval.M</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-middle>0</accordion-middle>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>M=0</text></lyric>\r
+      </note>\r
+      <direction>\r
+        <direction-type>\r
+          <accordion-registration>\r
+              <accordion-high/>\r
+              <accordion-middle>5</accordion-middle>\r
+              <accordion-low/>\r
+          </accordion-registration>\r
+        </direction-type>\r
+      </direction>\r
+      <note>\r
+        <pitch><step>C</step><octave>4</octave></pitch>\r
+        <duration>1</duration>\r
+        <voice>1</voice>\r
+        <type>quarter</type>\r
+        <lyric number="1"><text>M=5</text></lyric>\r
+      </note>\r
+      \r
+      <barline location="right">\r
+        <bar-style>light-heavy</bar-style>\r
+      </barline>\r
+    </measure>\r
+    <!--=======================================================-->\r
+  </part>\r
+  <!--=========================================================-->\r
+</score-partwise>\r
index 07e4f5d7928f42f476ea17dfc3c0ad48238eb2e6..7aa45b1a9949edf57d88acbf0c59158175dc9aec 100644 (file)
@@ -794,12 +794,24 @@ class BeamEvent (SpanEvent):
 class PedalEvent (SpanEvent):
     def ly_expression (self):
         return {-1: '\\sustainDown',
+            0:'\\sustainUp\\sustainDown',
             1:'\\sustainUp'}.get (self.span_direction, '')
 
+class TextSpannerEvent (SpanEvent):
+    def ly_expression (self):
+        return {-1: '\\startTextSpan',
+            1:'\\stopTextSpan'}.get (self.span_direction, '')
+
+class BracketSpannerEvent (SpanEvent):
+    def ly_expression (self):
+        return {-1: '\\startGroup',
+            1:'\\stopGroup'}.get (self.span_direction, '')
+
+
 # type==-1 means octave up, type==-2 means octave down
 class OctaveShiftEvent (SpanEvent):
     def wait_for_note (self):
-        return False;
+        return False
     def set_span_type (self, type):
         self.span_type = {'up': 1, 'down': -1}.get (type, 0)
     def ly_octave_shift_indicator (self):
@@ -839,7 +851,7 @@ class ArpeggioEvent(Event):
         Event.__init__ (self)
         self.direction = 0
     def wait_for_note (self):
-        return True;
+        return True
     def ly_expression (self):
         # TODO: Use self.direction for up/down arpeggios
         return ('\\arpeggio')
@@ -873,17 +885,37 @@ class DynamicsEvent (Event):
     def __init__ (self):
         self.type = None
     def wait_for_note (self):
-        return True;
+        return True
     def ly_expression (self):
         if self.type:
             return '\%s' % self.type
         else:
-            return;
+            return
 
     def print_ly (self, printer):
         if self.type:
             printer.dump ("\\%s" % self.type)
 
+class MarkEvent (Event):
+    def __init__ (self, text="\\default"):
+        self.mark = text
+    def wait_for_note (self):
+        return False
+    def ly_contents (self):
+        if self.mark:
+            return '%s' % self.mark
+        else:
+            return "\"ERROR\""
+    def ly_expression (self):
+        return '\\mark %s' % self.ly_contents ()
+
+class MusicGlyphMarkEvent (MarkEvent):
+    def ly_contents (self):
+        if self.mark:
+            return '\\markup { \\musicglyph #"scripts.%s" }' % self.mark
+        else:
+            return ''
+
 
 class TextEvent (Event):
     def __init__ (self):
@@ -907,7 +939,7 @@ class ArticulationEvent (Event):
         self.type = None
         self.force_direction = None
     def wait_for_note (self):
-        return True;
+        return True
 
     def direction_mod (self):
         return { 1: '^', -1: '_', 0: '-' }.get (self.force_direction, '')
index 3074ee5b4174c9e27311d95b4b90334c22c8624d..53fc9ffb54bb1724411df754d8a4e36d78d3004c 100644 (file)
@@ -751,6 +751,12 @@ class Wedge (Music_xml_spanner):
 class Tuplet (Music_xml_spanner):
     pass
 
+class Bracket (Music_xml_spanner):
+    pass
+
+class Dashes (Music_xml_spanner):
+    pass
+
 class Slur (Music_xml_spanner):
     def get_type (self):
        return self.type
@@ -867,7 +873,9 @@ class_dict = {
         'bar-style': BarStyle,
        'beam' : Beam,
         'bend' : Bend,
+        'bracket' : Bracket,
        'chord': Chord,
+        'dashes' : Dashes,
        'dot': Dot,
        'direction': Direction,
         'direction-type': DirType,
index dd8e00d1929e692f81214c0f5d6104dbd4c6ef9e..066b7c88462655d7214b03c9d3d4414d6abdc101 100644 (file)
@@ -156,7 +156,7 @@ must use this with dvips -h INPUT.psfonts'''),
     p.add_option ('-w', '--warranty',
                   help=_ ("show warranty and copyright"),
                   action='store_true')
-    p.add_option_group ('bugs',
+    p.add_option_group (_ ('Bugs'),
                         description=(_ ("Report bugs via")
                                      + ''' http://post.gmane.org/post.php'''
                                      '''?group=gmane.comp.gnu.lilypond.bugs\n'''))
index cf0318434af1cc8168f3145090bf428fcfd18941..b7460dced4994427b94138735407cf8e1e0e5156 100644 (file)
@@ -705,12 +705,14 @@ def musicxml_barline_to_lily (barline):
     return retval.values ()
 
 spanner_event_dict = {
-    'slur' : musicexp.SlurEvent,
     'beam' : musicexp.BeamEvent,
+    'dashes' : musicexp.TextSpannerEvent,
+    'bracket' : musicexp.BracketSpannerEvent,
     'glissando' : musicexp.GlissandoEvent,
+    'octave-shift' : musicexp.OctaveShiftEvent,
     'pedal' : musicexp.PedalEvent,
+    'slur' : musicexp.SlurEvent,
     'wavy-line' : musicexp.TrillSpanEvent,
-    'octave-shift' : musicexp.OctaveShiftEvent,
     'wedge' : musicexp.HairpinEvent
 }
 spanner_type_dict = {
@@ -720,6 +722,7 @@ spanner_type_dict = {
     'decreschendo': -1,
     'diminuendo': -1,
     'continue': 0,
+    'change': 0,
     'up': -1,
     'down': -1,
     'stop': 1,
@@ -943,7 +946,7 @@ def musicxml_dynamics_to_lily_event (dynentry):
         dynamicstext = dynamicsname
         dynamicsname = string.replace (dynamicsname, "-", "")
         additional_definitions[dynamicsname] = dynamicsname + \
-              "=#(make-dynamic-script \"" + dynamicstext + "\")"
+              " = #(make-dynamic-script \"" + dynamicstext + "\")"
         needed_additional_definitions.append (dynamicsname)
     event = musicexp.DynamicsEvent ()
     event.type = dynamicsname
@@ -1023,16 +1026,138 @@ def musicxml_words_to_lily_event (words):
     return event
 
 
-direction_spanners = [ 'octave-shift', 'pedal', 'wedge' ]
+# convert accordion-registration to lilypond.
+# Since lilypond does not have any built-in commands, we need to create
+# the markup commands manually and define our own variables.
+# Idea was taken from: http://lsr.dsi.unimi.it/LSR/Item?id=194
+def musicxml_accordion_to_markup (mxl_event):
+    commandname = "accReg"
+    command = ""
+
+    high = mxl_event.get_maybe_exist_named_child ('accordion-high')
+    if high:
+        commandname += "H"
+        command += """\\combine
+          \\raise #2.5 \\musicglyph #\"accordion.accDot\"
+          """
+    middle = mxl_event.get_maybe_exist_named_child ('accordion-middle')
+    if middle:
+        txt = 1
+        try:
+          txt = string.atoi (middle.get_text ())
+        except ValueError:
+            pass
+        if txt == 3:
+            commandname += "MMM"
+            command += """\\combine
+          \\raise #1.5 \\musicglyph #\"accordion.accDot\"
+          \\combine
+          \\raise #1.5 \\translate #(cons 1 0) \\musicglyph #\"accordion.accDot\"
+          \\combine
+          \\raise #1.5 \\translate #(cons -1 0) \\musicglyph #\"accordion.accDot\"
+          """
+        elif txt == 2:
+            commandname += "MM"
+            command += """\\combine
+          \\raise #1.5 \\translate #(cons 0.5 0) \\musicglyph #\"accordion.accDot\"
+          \\combine
+          \\raise #1.5 \\translate #(cons -0.5 0) \\musicglyph #\"accordion.accDot\"
+          """
+        elif not txt <= 0:
+            commandname += "M"
+            command += """\\combine
+          \\raise #1.5 \\musicglyph #\"accordion.accDot\"
+          """
+    low = mxl_event.get_maybe_exist_named_child ('accordion-low')
+    if low:
+        commandname += "L"
+        command += """\\combine
+          \\raise #0.5 \musicglyph #\"accordion.accDot\"
+          """
+
+    command += "\musicglyph #\"accordion.accDiscant\""
+    command = "\\markup { \\normalsize %s }" % command
+    additional_definitions[commandname] = "%s = %s" % (commandname, command)
+    print additional_definitions
+    needed_additional_definitions.append (commandname)
+    return "\\%s" % commandname
+
+def musicxml_accordion_to_ly (mxl_event):
+    txt = musicxml_accordion_to_markup (mxl_event)
+    if txt:
+        ev = musicexp.MarkEvent (txt)
+        return ev
+    return
+
+
+def musicxml_rehearsal_to_ly_mark (mxl_event):
+    text = mxl_event.get_text ()
+    if not text:
+        return
+    # default is boxed rehearsal marks!
+    encl = "box"
+    if hasattr (mxl_event, 'enclosure'):
+        encl = {"none": None, "square": "box", "circle": "circle" }.get (mxl_event.enclosure, None)
+    if encl:
+        text = "\\%s { %s }" % (encl, text)
+    ev = musicexp.MarkEvent ("\\markup { %s }" % text)
+    return ev
+
+# translate directions into Events, possible values:
+#   -) string  (MarkEvent with that command)
+#   -) function (function(mxl_event) needs to return a full Event-derived object
+#   -) (class, name)  (like string, only that a different class than MarkEvent is used)
+directions_dict = {
+    'accordion-registration' : musicxml_accordion_to_ly,
+    'coda' : (musicexp.MusicGlyphMarkEvent, "coda"),
+#     'damp' : ???
+#     'damp-all' : ???
+#     'eyeglasses': ??????
+#     'harp-pedals' : 
+#     'image' : 
+#     'metronome' : 
+    'rehearsal' : musicxml_rehearsal_to_ly_mark,
+#     'scordatura' : 
+    'segno' : (musicexp.MusicGlyphMarkEvent, "segno"),
+    'words' : musicxml_words_to_lily_event,
+}
+directions_spanners = [ 'octave-shift', 'pedal', 'wedge', 'dashes', 'bracket' ]
 
 def musicxml_direction_to_lily (n):
     # TODO: Handle the <staff> element!
     res = []
+    # placement applies to all children!
+    dir = None
+    if hasattr (n, 'placement') and options.convert_directions:
+        dir = musicxml_direction_to_indicator (n.placement)
     dirtype_children = []
+    # TODO: The direction-type is used for grouping (e.g. dynamics with text), 
+    #       so we can't simply flatten them out!
     for dt in n.get_typed_children (musicxml.DirType):
         dirtype_children += dt.get_all_children ()
 
     for entry in dirtype_children:
+        # backets, dashes, octave shifts. pedal marks, hairpins etc. are spanners:
+        if entry.get_name() in directions_spanners:
+            event = musicxml_spanner_to_lily_event (entry)
+            if event:
+                res.append (event)
+            continue
+
+        # now treat all the "simple" ones, that can be translated using the dict
+        ev = None
+        tmp_tp = directions_dict.get (entry.get_name (), None)
+        if isinstance (tmp_tp, str): # string means MarkEvent
+            ev = musicexp.MarkEvent (tmp_tp)
+        elif isinstance (tmp_tp, tuple): # tuple means (EventClass, "text")
+            ev = tmp_tp[0] (tmp_tp[1])
+        elif tmp_tp:
+            ev = tmp_tp (entry)
+        if ev:
+            # TODO: set the correct direction! Unfortunately, \mark in ly does
+            #       not seem to support directions!
+            res.append (ev)
+            continue
 
         if entry.get_name () == "dynamics":
             for dynentry in entry.get_all_children ():
@@ -1040,18 +1165,6 @@ def musicxml_direction_to_lily (n):
                 if ev:
                     res.append (ev)
 
-        if entry.get_name () == "words":
-            ev = musicxml_words_to_lily_event (entry)
-            if ev:
-                res.append (ev)
-
-        # octave shifts. pedal marks, hairpins etc. are spanners:
-        if entry.get_name() in direction_spanners:
-            event = musicxml_spanner_to_lily_event (entry)
-            if event:
-                res.append (event)
-
-
     return res
 
 def musicxml_frame_to_lily_event (frame):
index dfae13f1b454ff224607918e2637b4cd7538de9d..64bdecf6775fcc8df561ad3313ac573251aa677f 100644 (file)
@@ -19,7 +19,7 @@ $(outdir)/%.pfb: %.mf $(outdir)/mf2pt1.mem
        TMP=`mktemp -d $(outdir)/pfbtemp.XXXXXXXXX` \
        && ( cd $$TMP \
                && ln -s ../mf2pt1.mem . \
-               && MFINPUTS=$(src-dir):..:: $(PERL) $(top-src-dir)/buildscripts/mf2pt1.pl $(MF2PT1_OPTIONS) $< ) \
+               && MFINPUTS=$(top-src-dir)/mf:..:: $(PERL) $(top-src-dir)/buildscripts/mf2pt1.pl $(MF2PT1_OPTIONS) $< ) \
        && mv $$TMP/*pfb $(outdir); \
        rm -rf $$TMP