From d7dd7c254ec8a719ea034fbdf5d60dc4c3f5dcca Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 22:45:28 +0000 Subject: [PATCH] lilypond-1.3.24 --- lily/spacing-spanner.cc | 45 +++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 7d9194d66e..e912cf5d3c 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -14,6 +14,7 @@ #include "warn.hh" #include "paper-score.hh" #include "line-of-score.hh" +#include "misc.hh" Spacing_spanner::Spacing_spanner () { @@ -41,16 +42,25 @@ Array Spacing_spanner::do_measure (Link_array cols) const { Moment shortest; + Moment mean_shortest; shortest.set_infinite (1); + + int n = 0; for (int i =0 ; i < cols.size (); i++) { if (cols[i]->musical_b ()) { - SCM st = cols[i]->get_elt_property ("shortest-starter"); - - shortest = shortest get_elt_property ("shortest-starter-duration"); + Moment this_shortest = (*SMOB_TO_TYPE(Moment, st)); + shortest = shortest meas_springs; @@ -184,19 +194,39 @@ Spacing_spanner::default_bar_spacing (Paper_column *lc, Paper_column *rc, */ if (delta_t) { - Real k= paper_l()->arithmetic_constant (shortest); - durational_distance = paper_l()->length_mom_to_dist (delta_t,k); + durational_distance = get_duration_space (delta_t, shortest); } return symbol_distance >? durational_distance; } +/** + Get the measure wide constant for arithmetic spacing. + + @see + John S. Gourlay. ``Spacing a Line of Music,'' Technical Report + OSU-CISRC-10/87-TR35, Department of Computer and Information Science, + The Ohio State University, 1987. + + */ +Real +Spacing_spanner::get_duration_space (Moment d, Moment shortest) const +{ + Real log = log_2 (Moment (1,8) get_var ("arithmetic_basicspace") + - log; + + return (log_2 (d) + k) * paper_l ()->get_var ("arithmetic_multiplier"); +} + + Real Spacing_spanner::note_spacing (Paper_column *lc, Paper_column *rc, Moment shortest) const { Moment shortest_playing_len = 0; - SCM s = lc->get_elt_property ("shortest-playing"); + SCM s = lc->get_elt_property ("shortest-playing-duration"); + // SCM s = lc->get_elt_property ("mean-playing-duration"); if (SMOB_IS_TYPE_B(Moment, s)) shortest_playing_len = *SMOB_TO_TYPE (Moment, s); @@ -213,8 +243,7 @@ Spacing_spanner::note_spacing (Paper_column *lc, Paper_column *rc, Moment shorte shortest = 1; } Moment delta_t = rc->when_mom () - lc->when_mom (); - Real k= paper_l()->arithmetic_constant(shortest); - Real dist = paper_l()->length_mom_to_dist (shortest_playing_len, k); + Real dist = get_duration_space (shortest_playing_len, shortest); dist *= (double)(delta_t / shortest_playing_len); dist += stem_dir_correction (lc,rc); -- 2.39.5