From bbb93380f847fa912466e595b31c60f3008fc388 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 27 Mar 2002 00:57:32 +0000 Subject: [PATCH] lilypond-1.3.137 --- Documentation/user/internals.itely | 4 ++ input/bugs/pc-mmrest.ly | 29 +++++++++++++ input/test/music-creation.ly | 34 ++++++++++++++++ lily/GNUmakefile | 1 + lily/a2-engraver.cc | 13 +++--- lily/chord.cc | 2 +- lily/include/part-combine-music.hh | 2 + lily/music-ctor.cc | 1 + lily/thread-devnull-engraver.cc | 11 +++-- lily/voice-devnull-engraver.cc | 54 +++++++++++++++---------- ly/engraver.ly | 6 ++- make/mutopia-rules.make | 2 +- mutopia/Coriolan/coriolan-paper.ly | 11 +++++ mutopia/Coriolan/coriolan-part-paper.ly | 7 ++++ mutopia/Coriolan/fagotto-2.ly | 29 +++++++------ mutopia/Coriolan/oboe-1.ly | 20 ++++----- scm/c++.scm | 4 +- scm/midi.scm | 2 +- scripts/convert-ly.py | 22 ++++++---- scripts/ly2dvi.py | 12 +++++- 20 files changed, 197 insertions(+), 69 deletions(-) create mode 100644 input/bugs/pc-mmrest.ly create mode 100644 input/test/music-creation.ly create mode 100644 lily/music-ctor.cc diff --git a/Documentation/user/internals.itely b/Documentation/user/internals.itely index 3f37cc89b7..3664cef1c3 100644 --- a/Documentation/user/internals.itely +++ b/Documentation/user/internals.itely @@ -456,6 +456,10 @@ Get the property @var{sym} of music expression @var{m}. Set property @var{sym} in music expression @var{m} to @var{val}. @end defun +@defun ly-make-music name +Make a music object/expression of type @var{name}. Warning: this +interface will likely change in the near future. +@end defun @node Molecules @section Molecules diff --git a/input/bugs/pc-mmrest.ly b/input/bugs/pc-mmrest.ly new file mode 100644 index 0000000000..4071a597d6 --- /dev/null +++ b/input/bugs/pc-mmrest.ly @@ -0,0 +1,29 @@ +% +% mmrests of second voice should not disappear +% +% the problem is more complex: the mmrest-engraver lives at staff level, +% but it seems that we need one per voice. +% +\score { + \notes < + \context Staff = Viole < + \context Voice=one \partcombine Voice + \context Thread=one \relative c''{ R1 d4 d d d } + \context Thread=two { R1*2 } + > + > + \paper { +% { + \translator { + \StaffContext + \remove Multi_measure_rest_engraver; + \remove Bar_engraver; + } + \translator { + \VoiceContext + \consists Multi_measure_rest_engraver; + \consists Bar_engraver; + } +% } + } +} \ No newline at end of file diff --git a/input/test/music-creation.ly b/input/test/music-creation.ly new file mode 100644 index 0000000000..cc58b96b82 --- /dev/null +++ b/input/test/music-creation.ly @@ -0,0 +1,34 @@ +\header { + + texidoc = "You can create music expressions from Scheme. The + mechanism for this is rather clumsy to use, so avoid if possible."; + + } + + +#(define (make-note-req p d) + (let* ( (ml (ly-make-music "Note_req")) ) + (ly-set-mus-property ml 'duration d) + (ly-set-mus-property ml 'pitch p) + ml +)) + +#(define (make-note elts) + (let* ( (ml (ly-make-music "Request_chord")) ) + (ly-set-mus-property ml 'elements elts) + ml +)) + +#(define (seq-music-list elts) + (let* ( (ml (ly-make-music "Sequential_music")) ) + (ly-set-mus-property ml 'elements elts) + ml +)) + + +fooMusic = #(seq-music-list + (list (make-note (list (make-note-req (make-pitch 1 0 0) (make-duration 2 0)))) + (make-note (list (make-note-req (make-pitch 1 1 0) (make-duration 2 0))))) + ) + +\score { \fooMusic } diff --git a/lily/GNUmakefile b/lily/GNUmakefile index 7f88845376..c3d76bbc25 100644 --- a/lily/GNUmakefile +++ b/lily/GNUmakefile @@ -23,5 +23,6 @@ $(outdir)/my-lily-parser.o: $(outdir)/parser.hh $(outdir)/my-lily-lexer.o: $(outdir)/parser.hh $(outdir)/lexer.o: $(outdir)/parser.hh +$(outdir)/kpath.o: $(outdir)/version.hh $(outdir)/lily-guile.o: $(outdir)/version.hh $(outdir)/lily-version.o: $(outdir)/version.hh diff --git a/lily/a2-engraver.cc b/lily/a2-engraver.cc index b6958618bc..55d6c45d95 100644 --- a/lily/a2-engraver.cc +++ b/lily/a2-engraver.cc @@ -137,15 +137,18 @@ A2_engraver::acknowledge_grob (Grob_info i) || Slur::has_interface (i.elem_l_) // || Tie::has_interface (i.elem_l_) || i.elem_l_->has_interface (ly_symbol2scm ("tie-interface")) + /* Usually, dynamics are removed by *_devnull_engravers for the second voice. On the one hand, we don't want all dynamics for the first voice to be placed above the staff. On the other - hand, colliding of scripts may be worse */ -#if 0 - || i.elem_l_->has_interface (ly_symbol2scm ("dynamic-interface")) - || i.elem_l_->has_interface (ly_symbol2scm ("text-interface")) -#endif + hand, colliding of scripts may be worse. + So, we don't set directions for these when we're playing solo. + */ + || (i.elem_l_->has_interface (ly_symbol2scm ("dynamic-interface")) + && state_ != SOLO) + || (i.elem_l_->has_interface (ly_symbol2scm ("text-interface")) + && state_ != SOLO) )) { /* diff --git a/lily/chord.cc b/lily/chord.cc index 32215b656c..dd20c964ee 100644 --- a/lily/chord.cc +++ b/lily/chord.cc @@ -189,7 +189,7 @@ Chord::step_scm (SCM tonic, SCM p) int i = unsmob_pitch (p)->notename_i_ - unsmob_pitch (tonic)->notename_i_ + (unsmob_pitch (p)->octave_i_ - - unsmob_pitch (tonic)->octave_i_ ) * 7; + - unsmob_pitch (tonic)->octave_i_) * 7; while (i < 0) i += 7; i++; diff --git a/lily/include/part-combine-music.hh b/lily/include/part-combine-music.hh index 95062639a5..ef18fb2b78 100644 --- a/lily/include/part-combine-music.hh +++ b/lily/include/part-combine-music.hh @@ -27,6 +27,8 @@ public: virtual Moment length_mom () const; virtual Pitch to_relative_octave (Pitch); virtual void compress (Moment); + + Part_combine_music (); }; #endif /* PART_COMBINE_MUSIC_HH */ diff --git a/lily/music-ctor.cc b/lily/music-ctor.cc new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/lily/music-ctor.cc @@ -0,0 +1 @@ + diff --git a/lily/thread-devnull-engraver.cc b/lily/thread-devnull-engraver.cc index 3ab759ed81..9e995b2f74 100644 --- a/lily/thread-devnull-engraver.cc +++ b/lily/thread-devnull-engraver.cc @@ -27,16 +27,19 @@ Thread_devnull_engraver::acknowledge_grob (Grob_info i) { SCM s = get_property ("devNullThread"); #if 0 - /* No need */ - if (gh_equal_p (s, ly_symbol2scm ("never"))) + /* No need, next if will never be true */ + if (s == ly_symbol2scm ("never")) return; #endif - if (gh_equal_p (s, ly_symbol2scm ("allways")) + if (s == ly_symbol2scm ("allways") || (s == SCM_EOL && daddy_trans_l_->id_str_.left_str (3) == "two" && (to_boolean (get_property ("unison")) || to_boolean (get_property ("unisilence"))) && to_boolean (get_property ("soloADue")))) - i.elem_l_->suicide (); + { + /* Ugh, we can suicide them, but they remain living */ + i.elem_l_->suicide (); + } } diff --git a/lily/voice-devnull-engraver.cc b/lily/voice-devnull-engraver.cc index 6ad506a925..94859cf819 100644 --- a/lily/voice-devnull-engraver.cc +++ b/lily/voice-devnull-engraver.cc @@ -24,11 +24,10 @@ protected: ADD_THIS_TRANSLATOR (Voice_devnull_engraver); static char const *eat_spanners[] = { - "beam-interface", + "beam", + "crescendo", + "decrescendo", "slur", - "tie", - "dynamic-interface", - "crescendo-interface", 0 }; @@ -48,31 +47,35 @@ Voice_devnull_engraver::try_music (Music *m) && (to_boolean (get_property ("unison")) || to_boolean (get_property ("unisilence"))))) { - for (char const **p = eat_spanners; *p; p++) + if (Span_req *s = dynamic_cast (m)) { - if (Span_req *s = dynamic_cast (m)) + SCM t = s->get_mus_property ("span-type"); + + for (char const **p = eat_spanners; *p; p++) { - if (scm_equal_p (s->get_mus_property ("span-type"), - ly_str02scm ( *p)) == SCM_BOOL_T) - { - return true; - } + if (t == ly_str02scm (*p)) + return true; } } + /* Ugh. Should eat other requests, script etc. too. */ + else if (Tie_req *t = dynamic_cast (m)) + return true; } return false; } - + static char const *junk_interfaces[] = { -#if 0 "beam-interface", -#endif + "dynamic-interface", + "hairpin-interface", + "multi-measure-rest-interface", + "script-interface", "slur-interface", - "tie-interface", + "text-interface", "text-item-interface", "text-script-interface", - "dynamic-interface", - "crescendo-interface", + "text-spanner-interface", + "tie-interface", 0 }; @@ -81,21 +84,30 @@ Voice_devnull_engraver::acknowledge_grob (Grob_info i) { SCM s = get_property ("devNullVoice"); #if 0 - /* No need */ - if (gh_equal_p (s, ly_symbol2scm ("never"))) + /* No need, next if will never be true */ + if (s == ly_symbol2scm ("never")) return; #endif - if (gh_equal_p (s, ly_symbol2scm ("allways")) - || (gh_equal_p (s, ly_symbol2scm ("unisolo")) + if (s == ly_symbol2scm ("allways") + || (s == SCM_EOL && daddy_trans_l_->id_str_.left_str (3) == "two" && (to_boolean (get_property ("unison")) || to_boolean (get_property ("unisilence"))))) for (char const **p = junk_interfaces; *p; p++) if (i.elem_l_->has_interface (ly_symbol2scm (*p))) { +#if 0 + /* Ugh: virtual mmrest::suicide () ? */ + if (i.elem_l_->has_interface (ly_symbol2scm ("multi-measure-rest-interface"))) + i.elem_l_->set_grob_property ("skip-timestep", SCM_BOOL_T); + else + ; +#endif + /* Ugh, we can suicide them, but they remain living */ i.elem_l_->suicide (); return; } } + diff --git a/ly/engraver.ly b/ly/engraver.ly index c71b63ba58..91cba44360 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -104,7 +104,9 @@ VoiceContext = \translator { \name Voice; Generic_property_list = #generic-voice-properties - + + % must come before all + \consists "Voice_devnull_engraver"; \consists "Output_property_engraver"; \consists "Arpeggio_engraver"; @@ -119,6 +121,7 @@ VoiceContext = \translator { \consists "Auto_beam_engraver"; \consists "Chord_tremolo_engraver"; + \consists "Percent_repeat_engraver"; \consists "Melisma_engraver"; %{ @@ -137,7 +140,6 @@ VoiceContext = \translator { \consists "Tuplet_engraver"; \consists "Grace_position_engraver"; \consists "A2_engraver"; - \consists "Voice_devnull_engraver"; \consists "Skip_req_swallow_translator"; \accepts Thread; % bug if you leave out this! diff --git a/make/mutopia-rules.make b/make/mutopia-rules.make index f31f882320..a901a3be97 100644 --- a/make/mutopia-rules.make +++ b/make/mutopia-rules.make @@ -31,5 +31,5 @@ $(outdir)/%.dvi: %.ly $(PYTHON) $(LY2DVI) --outdir=$(outdir) --dependencies $< $(outdir)-$(PAPERSIZE)/%.dvi: %.ly - $(PYTHON) $(LY2DVI) --outdir=$(outdir)-$(PAPERSIZE) --dependencies --papersize=$(PAPERSIZE) $< + $(PYTHON) $(LY2DVI) --outdir=$(outdir)-$(PAPERSIZE) --dependencies --set=papersize=$(PAPERSIZE) $< diff --git a/mutopia/Coriolan/coriolan-paper.ly b/mutopia/Coriolan/coriolan-paper.ly index b281667604..abdc99a0b1 100644 --- a/mutopia/Coriolan/coriolan-paper.ly +++ b/mutopia/Coriolan/coriolan-paper.ly @@ -9,6 +9,7 @@ % Mandatory Mutopia settings: textheight = 270.0\mm; linewidth = 180.0\mm; + indent = 30.\mm; \translator { \ThreadContext @@ -32,11 +33,21 @@ %% devNullThread = #'never \consists "Thread_devnull_engraver"; + + % While adds brings back rests of second voice, + % it prints some on the bar lines and it is messy + % because collisions don't work. Also, it increases + % memory usage from 91M RSS, to 116M. + %\consists "Multi_measure_rest_engraver"; + %\consists "Bar_engraver"; } \translator { \HaraKiriStaffContext + \consists "Mark_engraver"; MultiMeasureRest \override #'minimum-width = #6 + %\remove "Multi_measure_rest_engraver"; + %\remove "Bar_engraver"; } \translator { \OrchestralScoreContext diff --git a/mutopia/Coriolan/coriolan-part-paper.ly b/mutopia/Coriolan/coriolan-part-paper.ly index e5ff529fe0..75dbc1a545 100644 --- a/mutopia/Coriolan/coriolan-part-paper.ly +++ b/mutopia/Coriolan/coriolan-part-paper.ly @@ -32,13 +32,20 @@ %% devNullThread = #'never \consists "Thread_devnull_engraver"; + + %\consists "Multi_measure_rest_engraver"; + %\consists "Bar_engraver"; } % We need the HaraKiri staff for Staff Combining, % but we better remove the Instrument_name_engraver. \translator { \HaraKiriStaffContext + \consists "Mark_engraver"; \remove "Instrument_name_engraver"; + + %\remove "Multi_measure_rest_engraver"; + %\remove "Bar_engraver"; } \translator { \OrchestralScoreContext diff --git a/mutopia/Coriolan/fagotto-2.ly b/mutopia/Coriolan/fagotto-2.ly index 59b624f56b..40475c2c11 100644 --- a/mutopia/Coriolan/fagotto-2.ly +++ b/mutopia/Coriolan/fagotto-2.ly @@ -28,11 +28,11 @@ fagottoII = \notes \relative c { f\sf r| e1\sf| es\sf| - d2. es4\sf(| - )d2. es4\sf(| - )d2. es4\sf(| - )d2. es4\sf(| - )d4 r r2| + d2. es4\sf| + d2. es4\sf| + d2. es4\sf| + d2. es4\sf| + d4 r r2| R1*9| \clef "tenor"; @@ -107,7 +107,7 @@ fagottoII = \notes \relative c { %% 110| % copied from cello, copied from viola| [g8 bes d es][f, a cis d]| - [es,8:8 g: b: c!:][d,: f: a: bes:]| + [es,8:8 g: b: c:][d,: f: a: bes:]| [c,: es: g: a:][cis,: e: g: bes:]| [d,: g: bes: d:][d,: fis: a: d:]| g,,2 ~ g4. g8| @@ -172,8 +172,8 @@ fagottoII = \notes \relative c { b,2\sf r| b\sf r| R1*3| - bes2 r\ff| - bes2 r\sf| + bes2\ff r| + bes2\sf r| R1*2| r2 r4 bes\ff(| )as2. bes4\sf(| @@ -223,13 +223,12 @@ fagottoII = \notes \relative c { \property Voice.crescendoSpanner = #'dashed-line r4 r8 c\< c4. c8| r4 r8 c c4. c8| - + + r4 r8 \clef "tenor"; %\property Staff.clefGlyph = #"clefs-C" %\property Staff.clefPosition = #2 - - - r4 r8 d d4. d8| + d d4. d8| r4 r8 es es4. es8| \clef "bass"; @@ -266,8 +265,8 @@ fagottoII = \notes \relative c { %a deux| %%238 copied from cello from viola| - [c8\f e g as][bes, d fis g]| - [as, c e f!][g, bes d es]| + [c8\f es g as][bes, d fis g]| + [as, c e f][g, bes d es]| f4 r r2| @@ -293,7 +292,7 @@ fagottoII = \notes \relative c { % a deux| %% 270 copied from cello| - [c,8-"sempre"\ff b c d][es\ff d es c]| + [c,8-"sempre"\ff b c d][es d es c]| [b c d c][b c b g]| [c8 b c d][es d es c]| [b c d c][b c b g]| diff --git a/mutopia/Coriolan/oboe-1.ly b/mutopia/Coriolan/oboe-1.ly index 5da1133ee6..09f4623371 100644 --- a/mutopia/Coriolan/oboe-1.ly +++ b/mutopia/Coriolan/oboe-1.ly @@ -41,11 +41,11 @@ oboeI = \notes \relative c'' { as\sf r| g1\sf| ges\sf| - f2. ges4(| - )f2. ges4(| - )f2. ges4(| - )f2. ges4(| - )f4 r r2| + f2. ges4| + f2. ges4| + f2. ges4| + f2. ges4| + f4 r r2| R1*9| \property Voice.crescendoText = #"cresc." \property Voice.crescendoSpanner = #'dashed-line @@ -168,8 +168,8 @@ oboeI = \notes \relative c'' { f2.\<( g4| f e cis)a| \!a'2\ff c| - b1\p~| - b~| + b1~| + b\p~| b~| b~| b| @@ -258,9 +258,11 @@ oboeI = \notes \relative c'' { R1| c4-. g-. r2| as4-. e-. r2| - f4-"dim" r f r| + \property Voice.decrescendoText = #"dim." + \property Voice.decrescendoSpanner = #'dashed-line + f4\> r f r| R1| - es4\p r r2| + \!es4\p r r2| R1| d4 r r2| R1| diff --git a/scm/c++.scm b/scm/c++.scm index 8cd3d7b2bf..b995d72b30 100644 --- a/scm/c++.scm +++ b/scm/c++.scm @@ -119,6 +119,8 @@ (length . ,Repeated_music::unfolded_music_length))) ("fold" . ((iterator-ctor . ,Folded_repeat_iterator::constructor) (length . ,Repeated_music::folded_music_length))) + ("percent" . ((iterator-ctor . ,Percent_repeat_iterator::constructor) + (length . ,Repeated_music::unfolded_music_length))) ("tremolo" . ((iterator-ctor . ,Chord_tremolo_iterator::constructor) (length . ,Repeated_music::unfolded_music_length))))) @@ -128,5 +130,5 @@ (cdr handle) (begin (ly-warn - (string-append "Unknown repeat type `" name "'\nSee scm/lily.scm for supported repeats")) + (string-append "Unknown repeat type `" name "'\nSee scm/c++.scm for supported repeats")) '(type . 'repeated-music))))) diff --git a/scm/midi.scm b/scm/midi.scm index c2cdabe9e8..0d8f588e56 100644 --- a/scm/midi.scm +++ b/scm/midi.scm @@ -33,7 +33,7 @@ (set! instrument-equaliser-alist (append '( - ("flute" . (0 . 0.6)) + ("flute" . (0 . 0.7)) ("oboe" . (0 . 0.7)) ("clarinet" . (0 . 0.7)) ("bassoon" . (0 . 0.6)) diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 2596951399..c37c2b6ab1 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -24,8 +24,10 @@ import string import re import time -lilypond_version_re_str = '\\\\version *\"(.*)\"' -lilypond_version_re = re.compile(lilypond_version_re_str) +# Did we ever have \mudela-version? I doubt it. +# lilypond_version_re_str = '\\\\version *\"(.*)\"' +lilypond_version_re_str = '\\\\(mudela-)?version *\"(.*)\"' +lilypond_version_re = re.compile (lilypond_version_re_str) def program_id (): return '%s (GNU LilyPond) %s' %(program_name, version); @@ -92,11 +94,11 @@ def version_cmp (t1, t2): return t1[x] - t2[x] return 0 -def guess_lilypond_version(filename): +def guess_lilypond_version (filename): s = gulp_file (filename) m = lilypond_version_re.search (s) if m: - return m.group(1) + return m.group (2) else: return '' @@ -177,6 +179,8 @@ if 1: if 1: def conv(str): str = re.sub ('\\\\melodic', '\\\\notes',str) + if re.search ('\\\\header', str): + sys.stderr.write ('\nNot smart enough to convert \\multi constructs') return str @@ -185,8 +189,7 @@ if 1: if 1: def conv(str): str = re.sub ('default_paper *=', '',str) - str = re.sub ('default_midi *=', '',x) - + str = re.sub ('default_midi *=', '',str) return str conversions.append (((1,0,4), conv, 'default_{paper,midi}')) @@ -570,7 +573,7 @@ if 1: str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?timeSignatureStyle"? *= *"([^"]*)"', '\\\\property \\1.TimeSignature \\\\override #\'style = #\'\\2', str) - str = re.sub ('"?timeSignatureStyle"? *= *#?""', 'TimeSignature \\\\override #\'style = ##f, str) + str = re.sub ('"?timeSignatureStyle"? *= *#?""', 'TimeSignature \\\\override #\'style = ##f', str) str = re.sub ('"?timeSignatureStyle"? *= *#?"([^"]*)"', 'TimeSignature \\\\override #\'style = #\'\\1', str) @@ -810,4 +813,9 @@ for f in files: try: do_one_file (f) except UnknownVersion: + sys.stderr.write ('\n') + sys.stderr.write ("%s: can't determine version for %s" % (program_name, f)) + sys.stderr.write ('\n') + sys.stderr.write ("%s: skipping" % program_name) pass +sys.stderr.write ('\n') diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 042cf07ba4..3127bc3280 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -19,6 +19,7 @@ import __main__ import operator import tempfile +sys.path.append ('@datadir@/python') import gettext gettext.bindtextdomain ('lilypond', '@localedir@') gettext.textdomain('lilypond') @@ -321,9 +322,14 @@ def find_tex_files (files, extra): return tfiles def one_latex_definition (defn, first): - s = '' + s = '\n' for (k,v) in defn[1].items (): - s = r'''\def\the%s{%s}''' % (k,open (v).read ()) + val = open (v).read () + if (string.strip (val)): + s = s + r'''\def\lilypond%s{%s}''' % (k, val) + else: + s = s + r'''\let\lilypond%s\relax''' % k + s = s + '\n' if first: s = s + '\\def\\mustmakelilypondtitle{}\n' @@ -526,6 +532,8 @@ if files: type = 'DVI' dest = os.path.join (outdir, dest) + if outdir != '.': + system ('mkdir -p %s' % outdir) system ('cp \"%s\" \"%s\"' % (srcname, dest )) system ('cp *.midi %s' % outdir, ignore_error = 1) -- 2.39.5