From: Jan Nieuwenhuizen Date: Sun, 7 Feb 1999 19:15:41 +0000 (+0100) Subject: patch::: 1.1.27.jcn3: geen genade X-Git-Tag: release/1.1.28~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=dfb3c8a4b2ee5edab542740b7ae1026b07ba2ef6;p=lilypond.git patch::: 1.1.27.jcn3: geen genade pl 27.jcn3 - bf's: zero-length repeats - Auto beamer: * turned on by default * input/test/auto-beam*.ly * support for time-defaults - Chords: * input/just-friends.ly * ChordNameContext * bf's: chord mode: accept STRINGS, rests * bf's: banter_str - new bool \property Score.barAtLineStart --- diff --git a/Documentation/tex/tutorial.yo b/Documentation/tex/tutorial.yo index 25f8d74ea6..69545dfc7b 100644 --- a/Documentation/tex/tutorial.yo +++ b/Documentation/tex/tutorial.yo @@ -98,16 +98,16 @@ mudela(verbatim)( \time 3/4; \repeat 2 { - d4 [g,8 a b c] d4 g, g | - e'4 [c8 d e fis] g4 g, g | - c4 [d8( )c b a( ] )b4 [c8 b a g] | - a4 [b8 a g fis] g2. | + d4 g,8 a b c d4 g, g | + e'4 c8 d e fis g4 g, g | + c4 d8( )c b a( )b4 c8 b a g | + a4 b8 a g fis g2. | } - b'4 [g8 a b g] - a4 [d,8 e fis d] | - g4 [e8 fis g d] cis4 [b8 cis] a4 | - [a8-. b-. cis-. d-. e-. fis-. ] + b'4 g8 a b g + a4 d,8 e fis d | + g4 e8 fis g d cis4 b8 cis a4 | + a8-. b-. cis-. d-. e-. fis-. g4 fis e | fis a, r8 cis8 d2.-\fermata @@ -223,16 +223,6 @@ verb( code(c''), the real pitch of this note is code(d''). The 4 designates the duration of the note (it is a quarter note). COMMENT( -)verb( - [g,8 -)COMMENT( - -)The open bracket starts a beam. Lily can set beams automatically, -but we want to specify them ourselves. This bracket is connected to the -following note, which is an eighth with pitch code(g') (remember -relative mode for pitches!) -COMMENT( - )verb( a b )COMMENT( @@ -242,16 +232,6 @@ duration is the same as the code(g), there is no need to enter the duration (It is not illegal to enter it anyway. You would then enter code(a8 b8)) COMMENT( -)verb( - c] -) COMMENT( - -) This ends the beam started four notes earlier, at the code(g). In -the output, you will notice a measure bar following this note. You do -not have to enter anything to make LilyPond create a bar. Instead -Lily will deduce where bars have to be by comparing durations of notes with -the current time signature. COMMENT( - )verb( d4 g, g | ) COMMENT( @@ -260,7 +240,7 @@ the current time signature. COMMENT( music, LilyPond will check that barchecks are found at the start of a bar. This can help you track down notes you forgot to enter. verb( - e'4 [c8 d e fis] + e'4 c8 d e fis ) COMMENT( ) So far, no notes were chromatically altered. Here is the first one @@ -269,17 +249,16 @@ that is: code(fis). Mudela by default uses Dutch note names, and sharp sign in the output. The program keeps track of key signatures, and will only print accidentals if they are needed. verb( - c4 [d8( )c b a( ] )b4 [c8 b a g] | + c4 d8( )c b a( )b4 c8 b a g | ) COMMENT( ) The next line shows something new: In mudela, one enters a slur by marking the beginning and ending note of the slur with an opening and closing parenthesis respectively. In the line shown above this is done for two slurs. Note that parentheses (slur markers) are between -the notes, and the brackets (beam markers) around the notes. As you -can see, the brackets and parentheses do not have to nest. +the notes. As you can see, parentheses do not have to nest. verb( - a4 [b8 a g fis] g2. | + a4 b8 a g fis g2. | ) COMMENT( ) A duration that is to be augmented with a duration dot, is notated @@ -291,14 +270,14 @@ verb( ) The end of the repeated music. LilyPond will typset a repeat bar. verb( - cis'4 [b8 cis] a4 | + cis'4 b8 cis a4 | ) COMMENT( ) This line shows that Lily will print an accidental if that is needed: the first C sharp will be printed with an accidental, the second one without. COMMENT( -)verb( [a8-. b-. cis-. d-. e-. fis-. ] % try some super and subscripts.)COMMENT( +)verb( a8-. b-. cis-. d-. e-. fis-. % try some super and subscripts.)COMMENT( )There is more to music than just pitches and rhythms. An important aspect is articulation. You can enter articulation signs either in an @@ -1256,7 +1235,10 @@ perfor0mable: COMMENT( )mudela(fragment,verbatim)( < - \type Staff { c''8. c''16 bes'8. a'16 g'4 f'8 g'4. } + \type Staff { + \property Voice.beamAuto = "0" % no beams in melody + c''8. c''16 bes'8. a'16 g'4 f'8 g'4. + } \type Lyrics \lyrics { 'got8. me16 on8. my16 knees,4 Le-8 lie!4. } > ) COMMENT( @@ -1276,7 +1258,10 @@ urg )COMMENT( )mudela(fragment,verbatim)(< - \type Staff { c''8. c''16 bes'8. a'16 g'4 f'8 g'4. } + \type Staff { + \property Voice.beamAuto = "0" % no beams in melody + c''8. c''16 bes'8. a'16 g'4 f'8 g'4. + } \type Lyrics \lyrics { 'got8 me8 on8. m$\cal_Y$16 "3s,"4 Le-8 lie!4.} > )COMMENT( @@ -1684,9 +1669,14 @@ COMMENT( Of course, you can also use different ratios, and use beamed notes or rests: +COMMENT( BROKEN + +lilypond: score-element.cc:134: class Paper_def * Score_element::paper() const: Assertion `pscore_l_' failed. + mudela(fragment)( \type Voice \times 4/5 { [c''8 c''16 c''16] r8 [g'8 g'8] } ) +) If you make a tuplet of beamed notes, where the beam is as wide as the bracket, the bracket is omitted. diff --git a/NEWS b/NEWS index 6e5bc43731..8faa209c89 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,16 @@ +pl 27.jcn3 + - bf's: zero-length repeats + - Auto beamer: + * turned on by default + * input/test/auto-beam*.ly + * support for time-defaults + - Chords: + * input/just-friends.ly + * ChordNameContext + * bf's: chord mode: accept STRINGS, rests + * bf's: banter_str + - new bool \property Score.barAtLineStart + pl 27.jcn2 - grand renaming: Duration vs Moment / Rational diff --git a/VERSION b/VERSION index 690b6a3931..473f3f5b37 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=27 -MY_PATCH_LEVEL=jcn2 +MY_PATCH_LEVEL=jcn3 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/bugs/time-grouping.ly b/input/bugs/time-grouping.ly new file mode 100644 index 0000000000..b0cc682d91 --- /dev/null +++ b/input/bugs/time-grouping.ly @@ -0,0 +1,16 @@ +%{ + wierd grouping bug +%} + +\score{ + \notes \relative c''{ + % be sure it's not related to auto-beamer + \property Voice.beamAuto = "0" + \time 1/2; + [ c8 c c c ] + \time 1/4; + [ c8 c ] + } + \paper{ + } +} diff --git a/input/just-friends.ly b/input/just-friends.ly new file mode 100644 index 0000000000..8082c7b83e --- /dev/null +++ b/input/just-friends.ly @@ -0,0 +1,58 @@ +\header { + filename = "just-friends.ly"; + title = "Just Friends"; + description = "Jazz chords example with bar lines"; + opus = ""; + source = "mutex@gmd.de"; + composer = ""; + enteredby = "jcn"; + copyright = "Public Domain"; +} + +%{ +In response to + +Message-Id: <19990206153950.A7474@gil.physik.rwth-aachen.de> +Date: Sat, 6 Feb 1999 15:39:50 +0100 +From: Christoph Kukulies +Subject: chord bars + +I was looking out for a FAQ on the www.gmd.de/Misc/Music page but didn't +find any so bear with me when asking a FAQ question: + +I want to generate some sheets that contain only the chords (changes) +of a certain tune (Jazz, Real Book, for example), like + + Just Friends + +[...] + +%} + +\score{ + \type ChordNames \chords{ + \property Score.chordInversion = 1 + \property Score.barAtLineStart = 1 + \repeat 2 { + f1-maj f-maj f-7 bes-7 + c-maj c-maj es es + d-7 g-7 b2-7/fis e-7 a1-7\break + d-7 d-7 d-7 g2-7 ges-7 + + f1-maj f1-maj f-7 bes-7 + c-maj c-maj es es + d-7 g-7 b2-7/fis e-7 a1-7\break + d-7 d2-7 g-7 c1-6 g2-7 c-7 + } + } + \paper{ + indent = 0.0\mm; + linewidth = 100.0\mm; + \translator{ + \ChordNameContext + barAuto = "1"; + \consists Bar_engraver; + \consists "Repeat_engraver"; + } + } +} diff --git a/input/opus-130.ly b/input/opus-130.ly index 0bb12e66c0..bd01cf52e2 100644 --- a/input/opus-130.ly +++ b/input/opus-130.ly @@ -63,12 +63,6 @@ cello = \notes\relative c'{ > \paper{ \translator { \OrchestralScoreContext } - \translator { - \VoiceContext - \consists Auto_beam_engraver; - beamAuto = 1.; - beamAutoEnd = "3/8"; - } } \midi{ \tempo 4 = 160; } } diff --git a/input/star-spangled-banner.ly b/input/star-spangled-banner.ly index d05c396cfa..f5b05d1e35 100644 --- a/input/star-spangled-banner.ly +++ b/input/star-spangled-banner.ly @@ -114,13 +114,6 @@ global = \notes { \translator { \BarNumberingStaffContext } - \translator{ - \VoiceContext - \consists Auto_beam_engraver; - beamAuto = 1.; - beamAutoEnd8 = "1/4"; - beamAutoEnd16 = "1/4"; - } } } diff --git a/input/test/auto-beam-override.ly b/input/test/auto-beam-override.ly new file mode 100644 index 0000000000..ad378a5837 --- /dev/null +++ b/input/test/auto-beam-override.ly @@ -0,0 +1,38 @@ +%{ + Currently (1.1.27.jcn3), the auto-beam engraver will only engrave + sensible beams, which means that it will end a beam when: + * a rest is encountered + * another beam (entered manually) is encountered + * there's a 'gap' in the beam note's durations + + The beam will be ended also when + + now / beamAutoEnd = 0 +%} + +\score{ + \notes \relative c''{ + \time 2/4; + % one beam per measure + c8 c c c + c16 c c c c c c c + % from here on consider ending beam every 1/4 note + \property Voice.beamAutoEnd = "1/4" + c8 c c c + % manually override autobeam with weird beaming + c8 [c c] c + c8 c c r + c8 c c4 + r8 c c c + % no autobeaming + \property Voice.beamAuto = "0" + c8 c c c + } + \paper{ + \translator{ + \VoiceContext + % consider ending beam at every 1/2 note + beamAutoEnd = "1/2"; + } + } +} diff --git a/input/test/auto-beam.ly b/input/test/auto-beam.ly index 02e7711dba..6839be6600 100644 --- a/input/test/auto-beam.ly +++ b/input/test/auto-beam.ly @@ -1,49 +1,62 @@ %{ - Currently (1.1.22.jcn5), the auto-beam engraver will only engrave - sensible beams (hopefully), which means that it will give up the - whole beam if: - * a rest is encountered - * another beam (entered manually) is encountered - * there's a 'gap' in the beam note's durations - - There's no smart algorithm, beginning a beam is considered when - - now / beamAutoBegin = 0 - - the beam will be ended when - - * now / beamAutoEnd = 0 + The auto-beam engraver has presets for common time signatures. %} - + \score{ \notes \relative c''{ - \time 2/4; - % one beam per measure - c8 c c c - c16 c c c c c c c - % from here on two beams per measure - \property Voice.beamAutoEnd = "1/4"; - c8 c c c - % manually override autobeam with weird beaming - c8 [c c] c - c8 c c r - c8 c c4 - r8 c c c - % no autobeaming - \property Voice.beamAuto = "0" - c8 c c c +%{ + % urg: something breaks in grouping ; see input/bugs/time-grouping.ly + \time 1/2; + c8 c c c + c16 c c c c c c c + c32 c c c c c c c c c c c c c c c + \time 1/4; + c8 c + c16 c c c + c32 c c c c c c c + \time 1/8; + c8 + c16 c + c32 c c c +%} + \time 2/2; + c8 c c c c c c c + c16 c c c c c c c c c c c c c c c + c32 c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c + \time 2/4; + c8 c c c + c16 c c c c c c c + c32 c c c c c c c c c c c c c c c + \time 2/8; + c8 c + c16 c c c + c32 c c c c c c c + \time 3/2; + c8 c c c c c c c c c c c + c16 c c c c c c c c c c c c c c c c c c c c c c c + \time 3/4; + c8 c c c c c + c16 c c c c c c c c c c c + c32 c c c c c c c c c c c c c c c c c c c c c c c + \time 3/8; + c8 c c + c16 c c c c c + c32 c c c c c c c c c c c + \time 4/4; + c8 c c c c c c c + c16 c c c c c c c c c c c c c c c + c32 c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c + \time 4/8; + c8 c c c + c16 c c c c c c c + c32 c c c c c c c c c c c c c c c + \time 6/8; + c8 c c c c c + c16 c c c c c c c c c c c + \time 9/8; + c8 c c c c c c c c + c16 c c c c c c c c c c c c c c c c c } \paper{ - \translator{ - \VoiceContext - % add experimental auto-beaming - \consists Auto_beam_engraver; - % switch it on (perhaps a bit double, but we want to be able - % to switch it off conveniently - beamAuto = 1.; - % consider starting beam at every 4 note - % beamAutoBegin = "1/4"; - beamAutoEnd = "1/2"; - } } } diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 9536e17ace..2ce8813b6d 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -22,6 +22,7 @@ ADD_THIS_TRANSLATOR (Auto_beam_engraver); Auto_beam_engraver::Auto_beam_engraver () { beam_p_ = 0; + mult_i_ = 0; finished_beam_p_ = 0; finished_grouping_p_ = 0; grouping_p_ = 0; @@ -37,22 +38,92 @@ void Auto_beam_engraver::consider_end_and_begin () { Time_description const *time = get_staff_info().time_C_; + int num = time->whole_per_measure_ / time->one_beat_; + int den = time->one_beat_.den_i (); + String time_str = String ("time") + to_str (num) + "_" + to_str (den); + int type = 1 << (mult_i_ + 2); + String type_str = to_str (type); + + /* + Determine end moment for auto beaming (and begin, mostly 0==anywhere) + In order of increasing priority: + + i. every beat + ii. time_beamAutoEnd + iii. time_beamAutoEnd + iv. beamAutoEnd + v. beamAutoEnd + + + Rationale: + + [to be defined in config file] + i. easy catch-all rule + ii. exceptions for time signature + iii. exceptions for time signature, for specific duration type - Scalar begin = get_property ("beamAutoBegin", 0); - Moment begin_mom = begin.to_rat (); + [user override] + iv. generic override + v. override for specific duration type + + The user overrides should be required for common cases. + */ - Scalar end = get_property ("beamAutoEnd", 0); - Moment end_mom = end.to_rat (); + /* + first guess: begin beam at any position + */ + Moment begin_mom (0); + /* + first guess: end beam at end of beat + */ + Moment end_mom = time->one_beat_; + + /* + second guess: property generic time exception + */ + Scalar begin = get_property (time_str + "beamAutoBegin", 0); + if (begin.length_i ()) + begin_mom = begin.to_rat (); + Scalar end = get_property (time_str + "beamAutoEnd", 0); + if (end.length_i ()) + end_mom = end.to_rat (); + + /* + third guess: property time exception, specific for duration type + */ + if (mult_i_) + { + Scalar end_mult = get_property (time_str + "beamAutoEnd" + type_str, 0); + if (end_mult.length_i ()) + end_mom = end_mult.to_rat (); + Scalar begin_mult = get_property (time_str + "beamAutoBegin" + type_str, 0); + if (begin_mult.length_i ()) + begin_mom = begin_mult.to_rat (); + } + + /* + fourth guess [user override]: property plain generic + */ + begin = get_property ("beamAutoBegin", 0); + if (begin.length_i ()) + begin_mom = begin.to_rat (); + + end = get_property ("beamAutoEnd", 0); + if (end.length_i ()) + end_mom = end.to_rat (); + + /* + fifth guess [user override]: property plain, specific for duration type + */ if (mult_i_) { - int type = 1 << (mult_i_ + 2); - Scalar end_mult = get_property (String ("beamAutoEnd") - + to_str (type), 0); + Scalar end_mult = get_property (String ("beamAutoEnd") + type_str, 0); if (end_mult.length_i ()) end_mom = end_mult.to_rat (); - else if (Moment (type, 4) / end_mom > Moment (4)) - end_mom /= Moment (type, 8); + Scalar begin_mult = get_property (String ("beamAutoBegin") + type_str, 0); + if (begin_mult.length_i ()) + begin_mom = begin_mult.to_rat (); } Real f; diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index d81cafb294..41a4330de4 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -61,6 +61,11 @@ Bar_engraver::create_bar () { bar_p_->type_str_ = default_type; } + Scalar prop = get_property ("barAtLineStart", 0); + if (prop.to_bool ()) + { + bar_p_->at_line_start_b_ = true; + } announce_element (Score_element_info (bar_p_, bar_req_l_)); } } @@ -68,6 +73,13 @@ Bar_engraver::create_bar () void Bar_engraver::request_bar (String type_str) { + Scalar prop = get_property ("barAtLineStart", 0); + if (!now_mom ()) + { + Scalar prop = get_property ("barAtLineStart", 0); + if (!prop.to_bool ()) + return; + } create_bar (); if (((type_str == "|:") && (bar_p_->type_str_ == ":|")) || ((type_str == ":|") && (bar_p_->type_str_ == "|:"))) diff --git a/lily/bar.cc b/lily/bar.cc index 824e2316a1..d8a3d2f72d 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -18,6 +18,7 @@ Bar::Bar () { breakable_b_ = true; type_str_ = "|"; + at_line_start_b_ = false; } void @@ -59,7 +60,13 @@ Bar::do_pre_processing () for (int i=0; bar_breaks[i][0]; i++) { if (bar_breaks[i][1] == type_str_) - type_str_ = bar_breaks[i][break_status_dir ()+1]; + { + type_str_ = bar_breaks[i][break_status_dir ()+1]; + if (at_line_start_b_ && (break_status_dir_ == 1) && (type_str_ == "")) + { + type_str_ = "|"; + } + } } /* diff --git a/lily/chord.cc b/lily/chord.cc index c21e30825f..c85ea0610a 100644 --- a/lily/chord.cc +++ b/lily/chord.cc @@ -218,17 +218,10 @@ Chord::Chord (Musical_pitch tonic, Array* add_arr_p, Array* add_arr_p, Array* sub_arr_p) { Musical_pitch tonic = pitch_arr_[0]; - - //urg, should do translation in scheme. - char const *acc[] = {"\\textflat\\textflat ", "\\textflat ", "", "\\textsharp " , "\\textsharp\\textsharp "}; - String tonic_str = tonic.str (); - tonic_str = tonic_str.left_str (1).upper_str () - + acc[tonic.accidental_i_ + 2]; - /* all the triads that should be there */ @@ -238,8 +231,6 @@ Chord::banter_str (Musical_pitch* inversion) const all_arr.concat (missing_triads_pitch_arr (&all_arr)); all_arr.sort (Musical_pitch::compare); - Array add_arr; - Array sub_arr; int i = 0; int j = 0; while ((i < all_arr.size ()) || (j < pitch_arr_.size ())) @@ -255,12 +246,12 @@ Chord::banter_str (Musical_pitch* inversion) const } else if ((p < a) || (p.notename_i_ == a.notename_i_)) { - add_arr.push (p); + add_arr_p->push (p); j++; } else { - sub_arr.push (a); + sub_arr_p->push (a); i++; } } @@ -269,7 +260,23 @@ Chord::banter_str (Musical_pitch* inversion) const add highest addition, because it names chord */ if (trap_i (tonic, pitch_arr_.top () > 5)) - add_arr.push (pitch_arr_.top ()); + add_arr_p->push (pitch_arr_.top ()); +} + +String +Chord::banter_str (Musical_pitch* inversion) const +{ + Musical_pitch tonic = pitch_arr_[0]; + + //urg, should do translation in scheme. + char const *acc[] = {"\\textflat\\textflat ", "\\textflat ", "", "\\textsharp " , "\\textsharp\\textsharp "}; + String tonic_str = tonic.str (); + tonic_str = tonic_str.left_str (1).upper_str () + + acc[tonic.accidental_i_ + 2]; + + Array add_arr; + Array sub_arr; + find_additions_and_subtractions (&add_arr, &sub_arr); Array scale; scale.push (Musical_pitch (0)); // c @@ -278,8 +285,11 @@ Chord::banter_str (Musical_pitch* inversion) const scale.push (Musical_pitch (3)); // f scale.push (Musical_pitch (4)); // g scale.push (Musical_pitch (5)); // a + scale.push (Musical_pitch (6)); // b // 7 always means 7-... - scale.push (Musical_pitch (6, -1)); // b + // scale.push (Musical_pitch (6, -1)); // b + + rebuild_transpose (tonic, &scale); bool has3m_b = false; bool has4_b = false; @@ -333,7 +343,7 @@ Chord::banter_str (Musical_pitch* inversion) const { inversion_str = inversion->str (); inversion_str = "/" + inversion_str.left_str (1).upper_str () - + acc[tonic.accidental_i_ + 2]; + + acc[inversion->accidental_i_ + 2]; } diff --git a/lily/include/bar.hh b/lily/include/bar.hh index 1bd1d6d8e6..c315e2137a 100644 --- a/lily/include/bar.hh +++ b/lily/include/bar.hh @@ -15,6 +15,7 @@ class Bar:public Item { public: String type_str_; + bool at_line_start_b_; VIRTUAL_COPY_CONS(Score_element); diff --git a/lily/include/chord.hh b/lily/include/chord.hh index f43f23b212..a863e76572 100644 --- a/lily/include/chord.hh +++ b/lily/include/chord.hh @@ -27,6 +27,7 @@ public: int find_tonic_i () const; int find_pitch_i (Musical_pitch p) const; int find_notename_i (Musical_pitch p) const; + void find_additions_and_subtractions(Array* add_arr_p, Array* sub_arr_p); Array pitch_arr_; }; diff --git a/lily/lexer.ll b/lily/lexer.ll index e2de809d01..e9a0c10371 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -180,13 +180,13 @@ EXTENDER __ cerr << _ ("missing end quote") << endl; exit (1); } -{RESTNAME} { +{RESTNAME} { const char *s = YYText (); yylval.string = new String (s); DOUT << "rest:"<< yylval.string; return RESTNAME; } -R { +R { return MEASURES; } \\\${BLACK}*{WHITE} { @@ -294,6 +294,9 @@ EXTENDER __ yylval.i = String_convert::dec2_i (String (YYText ())); return UNSIGNED; } + \" { + start_quote (); + } . { return yylval.c = YYText ()[0]; } diff --git a/lily/repeat-engraver.cc b/lily/repeat-engraver.cc index 2fb69d16af..feb6247267 100644 --- a/lily/repeat-engraver.cc +++ b/lily/repeat-engraver.cc @@ -36,29 +36,34 @@ Repeat_engraver::do_try_music (Music* m) return true; Music_sequence* alt = r->alternative_p_; - Moment stop_mom = now_mom () + r->repeat_p_->length_mom (); - for (PCursor i (alt->music_p_list_p_->top ()); i.ok () && (i != alt->music_p_list_p_->bottom ()); i++) + Moment repeat_length_mom = r->repeat_p_->length_mom (); + Moment stop_mom = now_mom () + repeat_length_mom; + Moment alt_mom = now_mom () + repeat_length_mom; + if (repeat_length_mom) { - stop_mom += i->length_mom (); - if (dynamic_cast (alt)) - break; + for (PCursor i (alt->music_p_list_p_->top ()); i.ok () && (i != alt->music_p_list_p_->bottom ()); i++) + { + stop_mom += i->length_mom (); + if (dynamic_cast (alt)) + break; + } + repeated_music_arr_.push (r); + stop_mom_arr_.push (stop_mom); + /* + TODO: + figure out what we don't want. + + we don't want to print more than one set of + |: :| and volta brackets on one staff. + + counting nested repeats, it seems safest to forbid + two pieces of alternative music to start at the same time. + */ } - Moment alt_mom = now_mom () + r->repeat_p_->length_mom (); - /* - TODO: - figure out what we don't want. - - we don't want to print more than one set of - |: :| and volta brackets on one staff. - - counting nested repeats, it seems safest to forbid - two pieces of alternative music to start at the same time. - */ for (int i = 0; i < alternative_start_mom_arr_.size (); i++) if (alternative_start_mom_arr_[i] == alt_mom) return false; - repeated_music_arr_.push (r); - stop_mom_arr_.push (stop_mom); + // moved stop_mom_arr_.push (stop_mom); for (PCursor i (alt->music_p_list_p_->top ()); i.ok (); i++) { alternative_music_arr_.push (i.ptr ()); @@ -106,7 +111,7 @@ Repeat_engraver::do_process_requests () (daddy_grav_l ()->get_simple_translator ("Bar_engraver")); for (int i = bar_b_arr_.size (); i < repeated_music_arr_.size (); i++) { - if (bar_engraver_l && (now > Moment (0))) + if (bar_engraver_l) bar_engraver_l->request_bar ("|:"); bar_b_arr_.push (true); } @@ -168,22 +173,5 @@ Repeat_engraver::do_pre_move_processing () void Repeat_engraver::do_post_move_processing () { -#if 0 - Time_description const *time = get_staff_info().time_C_; - Moment now = now_mom (); - for (int i = volta_p_arr_.size (); i--; ) - { - if ((now > alternative_stop_mom_arr_[i]) - && !time->whole_in_measure_) - { - volta_p_arr_[i] = 0; - volta_p_arr_.del (i); - alternative_music_arr_[i] = 0; - alternative_music_arr_.del (i); - alternative_start_mom_arr_.del (i); - alternative_stop_mom_arr_.del (i); - } - } -#endif } diff --git a/ly/auto-beam.ly b/ly/auto-beam.ly new file mode 100644 index 0000000000..d52802108a --- /dev/null +++ b/ly/auto-beam.ly @@ -0,0 +1,24 @@ +% +% setup for auto beamer +% +time2_8beamAutoEnd = "2/8"; +time3_2beamAutoEnd = "1/2"; +time3_2beamAutoEnd16 = "1/4"; +time3_2beamAutoEnd32 = "1/8"; +time3_4beamAutoBegin = "1/4"; +time3_4beamAutoEnd8 = "3/4"; +time3_4beamAutoEnd32 = "1/8"; +time3_8beamAutoBegin = "1/8"; +time3_8beamAutoEnd = "3/8"; +time4_4beamAutoEnd8 = "1/2"; +time4_4beamAutoEnd32 = "1/8"; +time4_8beamAutoEnd8 = "1/4"; +time4_8beamAutoEnd16 = "1/4"; +time4_8beamAutoEnd32 = "1/8"; +time4_16beamAutoEnd = "1/8"; +time6_8beamAutoEnd8 = "3/8"; +time6_8beamAutoEnd16 = "3/8"; +time6_8beamAutoEnd32 = "1/8"; +time9_8beamAutoEnd8 = "3/8"; +time9_8beamAutoEnd16 = "3/8"; +time6_8beamAutoEnd32 = "1/8"; diff --git a/ly/engraver.ly b/ly/engraver.ly index 6db19042b6..4205c31992 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -95,11 +95,14 @@ VoiceContext = \translator { \type "Engraver_group_engraver"; \consists "Dynamic_engraver"; \name Voice ; + beamAuto = "1"; \consists "Rest_engraver"; \consists "Dot_column_engraver"; \consists "Stem_engraver"; \consists "Beam_engraver"; + \consists "Auto_beam_engraver"; + \include "auto-beam.ly"; \consists "Abbreviation_beam_engraver"; % \consists "Multi_measure_rest_engraver"; @@ -176,12 +179,14 @@ GrandStaffContext=\translator{ \consists "Chord_name_engraver"; } -\translator { + +ChordNameContext = \translator { \type "Line_group_engraver_group"; \name ChordNames; \consists "Vertical_align_engraver"; \accepts "ChordNameVoice"; -} +}; +\translator { \ChordNameContext } ScoreContext = \translator { \type Score_engraver; diff --git a/ly/property.ly b/ly/property.ly index d572351c07..0ee196761b 100644 --- a/ly/property.ly +++ b/ly/property.ly @@ -56,6 +56,7 @@ barAlways 1 generate bar at every moment [Staff] barAuto 0 none barAuto 1 auto-generate bar every measure +barAtLineStart 0/1 generate bar at beginning of line [Staff] beamAuto 0/1 auto-beam on/off diff --git a/mutopia/E.Satie/petite-ouverture-a-danser.ly b/mutopia/E.Satie/petite-ouverture-a-danser.ly index 4625686861..498d09a1b6 100644 --- a/mutopia/E.Satie/petite-ouverture-a-danser.ly +++ b/mutopia/E.Satie/petite-ouverture-a-danser.ly @@ -152,8 +152,6 @@ lower = \type Staff \notes \relative c{ \translator{ \OrchestralScoreContext } \translator{ \VoiceContext - \consists Auto_beam_engraver; - beamAuto = 1.; beamAutoEnd8 = "1/4"; beamAutoEnd16 = "1/4"; } diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly index 2b1d22055e..757db58c92 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly @@ -133,13 +133,6 @@ global = \notes{ minVerticalAlign = 3.0*\staffheight; maxVerticalAlign = 3.0*\staffheight; } - \translator{ - \VoiceContext - \consists Auto_beam_engraver; - beamAuto = "1"; - beamAutoEnd8 = "1/2"; - beamAutoEnd16 = "1/4"; - } } \midi{ \tempo 4 = 80; } \header { diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly index d8bf07e300..91b3d1eab8 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly @@ -114,13 +114,6 @@ global = \notes{ \paper{ \include "preludes-paper.ly"; gourlay_maxmeasures = 4.0; - \translator{ - \VoiceContext - \consists Auto_beam_engraver; - beamAuto = "1"; - beamAutoEnd8 = "1/2"; - beamAutoEnd16 = "1/4"; - } } \midi{ \tempo 4 = 100; } \header { diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly index 88b1233303..757de5889b 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly @@ -210,13 +210,6 @@ global = \notes{ minVerticalAlign = 3.0*\staffheight; maxVerticalAlign = 3.0*\staffheight; } - \translator{ - \VoiceContext - \consists Auto_beam_engraver; - beamAuto = "1"; - beamAutoEnd8 = "1/2"; - beamAutoEnd16 = "1/4"; - } } \midi{ \tempo 4 = 70; } \header{ diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly index 7f7c3b03ff..7073930a1e 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly @@ -205,13 +205,6 @@ global = \notes{ minVerticalAlign = 3.0*\staffheight; maxVerticalAlign = 3.0*\staffheight; } - \translator{ - \VoiceContext - \consists Auto_beam_engraver; - beamAuto = "1"; - beamAutoEnd8 = "3/4"; - beamAutoEnd16 = "1/4"; - } } \midi{ \tempo 4 = 90; } \header{ diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly index 1a11dcfc48..dd1472ae6a 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly @@ -124,14 +124,6 @@ global = \notes{ minVerticalAlign = 3.0*\staffheight; maxVerticalAlign = 3.0*\staffheight; } - \translator{ - \VoiceContext - \consists Auto_beam_engraver; - beamAuto = "1"; - beamAutoEnd8 = "1/2"; - beamAutoEnd16 = "1/4"; - beamAutoEnd32 = "1/4"; - } } \midi{ \tempo 4 = 40; } \header{ diff --git a/mutopia/J.S.Bach/Solo-Cello-Suites/scs-paper.ly b/mutopia/J.S.Bach/Solo-Cello-Suites/scs-paper.ly index 3c909d4daf..145e973747 100644 --- a/mutopia/J.S.Bach/Solo-Cello-Suites/scs-paper.ly +++ b/mutopia/J.S.Bach/Solo-Cello-Suites/scs-paper.ly @@ -1,11 +1,3 @@ linewidth = 180.\mm; gourlay_maxmeasures = 10.0; \translator { \BarNumberingStaffContext } -\translator { - \VoiceContext - \consists Auto_beam_engraver; - beamAuto = 1.0; - beamAutoEnd8 = "1/4"; - beamAutoEnd16 = "1/4"; - beamAutoEnd32 = "1/4"; -} diff --git a/mutopia/J.S.Bach/wtk1-fugue2.ly b/mutopia/J.S.Bach/wtk1-fugue2.ly index 3ae97919be..7166c55fdb 100644 --- a/mutopia/J.S.Bach/wtk1-fugue2.ly +++ b/mutopia/J.S.Bach/wtk1-fugue2.ly @@ -194,13 +194,6 @@ bassdux = \type Voice=three \notes \relative c' { minVerticalAlign = 3.0*\staffheight; maxVerticalAlign = 3.0*\staffheight; } - \translator { - \VoiceContext - \consists Auto_beam_engraver; - beamAuto = 1.; - % eights end at 1/2, 16 at 1/4 - beamAutoEnd = "1/2"; - } } \header{ opus = "BWV 847";