From: Jan Nieuwenhuizen Date: Thu, 31 Mar 2011 20:20:49 +0000 (+0200) Subject: Midi2ly: have --key option reach all staves. Fixes #1587. X-Git-Tag: release/2.13.57-1~8 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=928bfc525857997de35e1017d711da4eb0199262;p=lilypond.git Midi2ly: have --key option reach all staves. Fixes #1587. --- diff --git a/input/regression/midi/key-option-all-staves.ly b/input/regression/midi/key-option-all-staves.ly new file mode 100644 index 0000000000..e669b321b5 --- /dev/null +++ b/input/regression/midi/key-option-all-staves.ly @@ -0,0 +1,24 @@ +\version "2.13.53" + +\header { +texidoc="Midi2ly --key works on all staves, this is G major (--key=1)" +options="--key=1" +} + +\score { + << + \context Staff = "treble" << + \context Voice="one" \relative c'' { + fis + } + >> + \context Staff = "bass" << + \context Voice="two" \relative c { + \clef bass + fis + } + >> + >> + \layout {} + \midi {} +} diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py index 1ab0233b79..1923d3b880 100644 --- a/scripts/midi2ly.py +++ b/scripts/midi2ly.py @@ -1002,6 +1002,7 @@ def convert_midi (in_file, out_file): s += '\n\\score {\n <<\n' + control_track = False i = 0 for i, staff in enumerate (staves): track_name = get_track_name (i) @@ -1009,11 +1010,12 @@ def convert_midi (in_file, out_file): staff_name = track_name context = None if not i and not item and len (staves) > 1: - # control track - staff_name = get_track_name (1) - context = 'Staff' + control_track = track_name + continue elif (item and item.__class__ == Note): context = 'Staff' + if control_track: + s += ' \\context %(context)s=%(staff_name)s \\%(control_track)s\n' % locals () elif item and item.__class__ == Text: context = 'Lyrics' if context: