From 90a0ed1b980386f82ef15acbfe2812d3f676de03 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 8 Mar 1999 17:47:47 +0100 Subject: [PATCH] patch::: 1.1.33.jcn2: jcn2.. pl 33.jcn2 - fixed autobeamer's beam->unlink () --- NEWS | 3 + TODO | 1 + VERSION | 2 +- input/bugs/auto-beam.ly | 6 +- lily/auto-beam-engraver.cc | 72 +++++++++++-------- lily/include/auto-beam-engraver.hh | 3 +- ly/property.ly | 4 +- mutopia/E.Satie/petite-ouverture-a-danser.ly | 4 +- .../J.S.Bach/Solo-Cello-Suites/gigue-cello.ly | 4 +- .../J.S.Bach/Solo-Cello-Suites/gigue-viola.ly | 4 +- .../Solo-Cello-Suites/menuetto-cello.ly | 4 +- .../Solo-Cello-Suites/menuetto-viola.ly | 4 +- mutopia/N.W.Gade/score.ly | 3 - 13 files changed, 65 insertions(+), 49 deletions(-) diff --git a/NEWS b/NEWS index d4ffd6d070..bd52f10d13 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +pl 33.jcn2 + - fixed autobeamer's beam->unlink () + pl 33.jcn1 - allow autobeaming according to duration iso (crude) multiplicity diff --git a/TODO b/TODO index 31eec353bf..48ab1d9468 100644 --- a/TODO +++ b/TODO @@ -67,6 +67,7 @@ specify the third. Should there be? .* TODO before 1.2 . * Gade score +. * remove [] in favour of auto-beamer . * In the score, the staff lines extend too far to the left. This is also illustrated in the second score of span-bars.ly as I've pointed out earlier. diff --git a/VERSION b/VERSION index acfa121bf2..f994aaa2e0 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=33 -MY_PATCH_LEVEL=jcn1 +MY_PATCH_LEVEL=jcn2 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/bugs/auto-beam.ly b/input/bugs/auto-beam.ly index 622efcc3b7..ee339e34cb 100644 --- a/input/bugs/auto-beam.ly +++ b/input/bugs/auto-beam.ly @@ -13,9 +13,9 @@ % add experimental auto-beaming \consists Auto_beam_engraver; beamAuto = 1.; - beamAutoEnd8 = "1/4"; - beamAutoEnd16 = "1/4"; - beamAutoEnd32 = "1/4"; + beamAutoEnd_8 = "1/4"; + beamAutoEnd_16 = "1/4"; + beamAutoEnd_32 = "1/4"; } } } diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index c4c72ea4bb..8055b73a52 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -21,7 +21,7 @@ ADD_THIS_TRANSLATOR (Auto_beam_engraver); Auto_beam_engraver::Auto_beam_engraver () { - beam_p_ = 0; + stem_l_arr_p_ = 0; shortest_mom_ = 1; finished_beam_p_ = 0; finished_grouping_p_ = 0; @@ -135,7 +135,7 @@ Auto_beam_engraver::consider_end_and_begin () else r = Moment (1); - if (beam_p_ && !r) + if (stem_l_arr_p_ && !r) end_beam (); /* @@ -147,7 +147,7 @@ Auto_beam_engraver::consider_end_and_begin () if (begin_mom) r = time->whole_in_measure_.mod_rat (begin_mom); - if (!beam_p_ && (!begin_mom || !r)) + if (!stem_l_arr_p_ && (!begin_mom || !r)) begin_beam (); } @@ -155,47 +155,59 @@ Auto_beam_engraver::consider_end_and_begin () void Auto_beam_engraver::begin_beam () { - DOUT << String ("starting autobeam at: ") + now_mom ().str () + "\n"; - assert (!beam_p_); - beam_p_ = new Beam; + // DOUT << String ("starting autobeam at: ") + now_mom ().str () + "\n"; + assert (!stem_l_arr_p_); + stem_l_arr_p_ = new Array; + assert (!grouping_p_); grouping_p_ = new Rhythmic_grouping; +} + +Beam* +Auto_beam_engraver::create_beam_p () +{ + Beam* beam_p = new Beam; + + for (int i = 0; i < stem_l_arr_p_->size (); i++) + beam_p->add_stem ((*stem_l_arr_p_)[i]); - /* urg, copied from Beam_engraver */ + /* urg, copied from Beam_engraver */ Scalar prop = get_property ("beamslopedamping", 0); if (prop.isnum_b ()) - beam_p_->damping_i_ = prop; + beam_p->damping_i_ = prop; prop = get_property ("beamquantisation", 0); if (prop.isnum_b ()) - beam_p_->quantisation_ = (Beam::Quantisation)(int)prop; + beam_p->quantisation_ = (Beam::Quantisation)(int)prop; - // must set minVerticalAlign = = maxVerticalAlign to get sane results - // see input/test/beam-interstaff.ly + // must set minVerticalAlign = = maxVerticalAlign to get sane results + // see input/test/beam-interstaff.ly prop = get_property ("minVerticalAlign", 0); if (prop.isnum_b ()) - beam_p_->vertical_align_drul_[MIN] = prop; + beam_p->vertical_align_drul_[MIN] = prop; prop = get_property ("maxVerticalAlign", 0); if (prop.isnum_b ()) - beam_p_->vertical_align_drul_[MAX] = prop; + beam_p->vertical_align_drul_[MAX] = prop; - announce_element (Score_element_info (beam_p_, 0)); + announce_element (Score_element_info (beam_p, 0)); + return beam_p; } void Auto_beam_engraver::end_beam () { DOUT << String ("ending autobeam at: ") + now_mom ().str () + "\n"; - if (beam_p_->stems_.size () < 2) + if (stem_l_arr_p_->size () < 2) { DOUT << "junking autombeam: less than two stems\n"; junk_beam (); } else { - finished_beam_p_ = beam_p_; + finished_beam_p_ = create_beam_p (); finished_grouping_p_ = grouping_p_; - beam_p_ = 0; + delete stem_l_arr_p_; + stem_l_arr_p_ = 0; grouping_p_ = 0; shortest_mom_ = 1; } @@ -232,7 +244,7 @@ void Auto_beam_engraver::do_removal_processing () { typeset_beam (); - if (beam_p_) + if (stem_l_arr_p_ && stem_l_arr_p_->size ()) { DOUT << "Unfinished beam\n"; junk_beam (); @@ -244,7 +256,7 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info) { if (Beam *b = dynamic_cast (info.elem_l_)) { - if (beam_p_) + if (stem_l_arr_p_) { DOUT << "junking autobeam: beam encountered\n"; junk_beam (); @@ -252,14 +264,14 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info) } if (Bar *b = dynamic_cast (info.elem_l_)) { - if (beam_p_) + if (stem_l_arr_p_) { DOUT << "junking autobeam: bar encountered\n"; junk_beam (); } } - if (beam_p_) + if (stem_l_arr_p_) { Rhythmic_req *rhythmic_req = dynamic_cast (info.req_l_); if (!rhythmic_req) @@ -276,7 +288,7 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info) if (!stem_l) return; - if (stem_l->beam_l_ && (stem_l->beam_l_ != beam_p_)) + if (stem_l->beam_l_) { DOUT << "junking autobeam: beamed stem encountered\n"; junk_beam (); @@ -288,7 +300,7 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info) now that we have last_add_mom_, perhaps we can (should) do away with these individual junk_beams */ - if (rhythmic_req->duration_.durlog_i_<= 2) + if (rhythmic_req->duration_.durlog_i_ <= 2) { DOUT << "ending autobeam: stem doesn't fit in beam\n"; end_beam (); @@ -315,7 +327,7 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info) } grouping_p_->add_child (start, rhythmic_req->length_mom ()); stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_; - beam_p_->add_stem (stem_l); + stem_l_arr_p_->push (stem_l); Moment now = now_mom (); last_add_mom_ = now; extend_mom_ = extend_mom_ >? now + rhythmic_req->length_mom (); @@ -326,9 +338,11 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info) void Auto_beam_engraver::junk_beam () { - assert (beam_p_); - beam_p_->unlink (); - beam_p_ = 0; + assert (stem_l_arr_p_); + for (int i = 0; i < stem_l_arr_p_->size (); i++) + (*stem_l_arr_p_)[i]->flag_i_ = 0; + delete stem_l_arr_p_; + stem_l_arr_p_ = 0; delete grouping_p_; grouping_p_ = 0; shortest_mom_ = 1; @@ -337,7 +351,7 @@ Auto_beam_engraver::junk_beam () void Auto_beam_engraver::process_acknowledged () { - if (beam_p_) + if (stem_l_arr_p_) { Moment now = now_mom (); if ((extend_mom_ < now) @@ -347,7 +361,7 @@ Auto_beam_engraver::process_acknowledged () + last_add_mom_.str () + "\n"; end_beam (); } - else if (!beam_p_->stems_.size ()) + else if (!stem_l_arr_p_->size ()) { DOUT << "junking started autobeam: no stems\n"; junk_beam (); diff --git a/lily/include/auto-beam-engraver.hh b/lily/include/auto-beam-engraver.hh index 671967ba0a..f56c7059fc 100644 --- a/lily/include/auto-beam-engraver.hh +++ b/lily/include/auto-beam-engraver.hh @@ -29,13 +29,14 @@ protected: private: void begin_beam (); void consider_end_and_begin (); + Beam* create_beam_p (); void end_beam (); void junk_beam (); void typeset_beam (); Moment shortest_mom_; Beam *finished_beam_p_; - Beam *beam_p_; + Array* stem_l_arr_p_; Moment last_add_mom_; Moment extend_mom_; Rhythmic_grouping*grouping_p_; diff --git a/ly/property.ly b/ly/property.ly index fbd082d12f..61b3333070 100644 --- a/ly/property.ly +++ b/ly/property.ly @@ -61,8 +61,8 @@ barAtLineStart 0/1 generate bar at beginning of line [Staff] beamAuto 0/1 auto-beam on/off beamAutoEnd "num/den" end auto-beam -beamAutoEnd8 "num/den" end auto-beam of 8ths -beamAutoEnd16 "num/den" end auto-beam of 16ths +beamAutoEnd_8 "num/den" end auto-beam of 8ths +beamAutoEnd_16 "num/den" end auto-beam of 16ths timeSignatureStyle C Use C and stroked C for 4/4,2/2 timeSignatureStyle old Use old style mensuration marks diff --git a/mutopia/E.Satie/petite-ouverture-a-danser.ly b/mutopia/E.Satie/petite-ouverture-a-danser.ly index 498d09a1b6..67b645ef54 100644 --- a/mutopia/E.Satie/petite-ouverture-a-danser.ly +++ b/mutopia/E.Satie/petite-ouverture-a-danser.ly @@ -152,8 +152,8 @@ lower = \type Staff \notes \relative c{ \translator{ \OrchestralScoreContext } \translator{ \VoiceContext - beamAutoEnd8 = "1/4"; - beamAutoEnd16 = "1/4"; + beamAutoEnd_8 = "1/4"; + beamAutoEnd_16 = "1/4"; } } \midi { diff --git a/mutopia/J.S.Bach/Solo-Cello-Suites/gigue-cello.ly b/mutopia/J.S.Bach/Solo-Cello-Suites/gigue-cello.ly index 32c983c8d2..a60db7abd6 100644 --- a/mutopia/J.S.Bach/Solo-Cello-Suites/gigue-cello.ly +++ b/mutopia/J.S.Bach/Solo-Cello-Suites/gigue-cello.ly @@ -54,8 +54,8 @@ gigue_cello_staff = \type Staff < gourlay_maxmeasures = 7.0; \translator{ \VoiceContext - beamAutoEnd8 = "3/4"; - beamAutoEnd16 = "3/4"; + beamAutoEnd_8 = "3/4"; + beamAutoEnd_16 = "3/4"; } } \midi{ \tempo 4 = 60; } diff --git a/mutopia/J.S.Bach/Solo-Cello-Suites/gigue-viola.ly b/mutopia/J.S.Bach/Solo-Cello-Suites/gigue-viola.ly index fbb79b2a0c..ab4becc7b8 100644 --- a/mutopia/J.S.Bach/Solo-Cello-Suites/gigue-viola.ly +++ b/mutopia/J.S.Bach/Solo-Cello-Suites/gigue-viola.ly @@ -54,8 +54,8 @@ gigue_viola_staff = \type Staff < gourlay_maxmeasures = 7.0; \translator{ \VoiceContext - beamAutoEnd8 = "3/4"; - beamAutoEnd16 = "3/4"; + beamAutoEnd_8 = "3/4"; + beamAutoEnd_16 = "3/4"; } } \midi{ \tempo 4 = 60; } diff --git a/mutopia/J.S.Bach/Solo-Cello-Suites/menuetto-cello.ly b/mutopia/J.S.Bach/Solo-Cello-Suites/menuetto-cello.ly index 8595daaade..94da30920d 100644 --- a/mutopia/J.S.Bach/Solo-Cello-Suites/menuetto-cello.ly +++ b/mutopia/J.S.Bach/Solo-Cello-Suites/menuetto-cello.ly @@ -68,7 +68,7 @@ menuetto_i_cello_staff = \type Staff < gourlay_maxmeasures = 7.0; \translator{ \VoiceContext - beamAutoEnd8 = "3/4"; + beamAutoEnd_8 = "3/4"; } } \midi{ \tempo 4 = 110; } @@ -103,7 +103,7 @@ menuetto_ii_cello_staff = \type Staff < gourlay_maxmeasures = 7.0; \translator{ \VoiceContext - beamAutoEnd8 = "3/4"; + beamAutoEnd_8 = "3/4"; } } \midi{ \tempo 4 = 130; } diff --git a/mutopia/J.S.Bach/Solo-Cello-Suites/menuetto-viola.ly b/mutopia/J.S.Bach/Solo-Cello-Suites/menuetto-viola.ly index 90267514e0..a1ff358dd3 100644 --- a/mutopia/J.S.Bach/Solo-Cello-Suites/menuetto-viola.ly +++ b/mutopia/J.S.Bach/Solo-Cello-Suites/menuetto-viola.ly @@ -67,7 +67,7 @@ menuetto_i_viola_staff = \type Staff < gourlay_maxmeasures = 7.0; \translator{ \VoiceContext - beamAutoEnd8 = "3/4"; + beamAutoEnd_8 = "3/4"; } } \midi{ \tempo 4 = 110; } @@ -101,7 +101,7 @@ menuetto_ii_viola_staff = \type Staff < gourlay_maxmeasures = 7.0; \translator{ \VoiceContext - beamAutoEnd8 = "3/4"; + beamAutoEnd_8 = "3/4"; } } \midi{ \tempo 4 = 130; } diff --git a/mutopia/N.W.Gade/score.ly b/mutopia/N.W.Gade/score.ly index 6f858159ab..b48b6d279c 100644 --- a/mutopia/N.W.Gade/score.ly +++ b/mutopia/N.W.Gade/score.ly @@ -124,9 +124,6 @@ copyright = "Mats Bengtsson, 1999. Free circulation permitted and " + textstyle = "italic"; textScriptPadding = 5.0; } -\translator{\VoiceContext -\remove Auto_beam_engraver; % Bug workaround! -} } } -- 2.39.5