From 05f5061e69643d55729054e2910b2d0b20efbd93 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 3 Dec 1996 23:54:59 +0000 Subject: [PATCH] lilypond-0.0.14 --- hdr/sccol.hh | 2 ++ hdr/stcol.hh | 1 + src/sccol.cc | 21 +++++++++++++++++++++ src/stcol.cc | 3 ++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/hdr/sccol.hh b/hdr/sccol.hh index f8aceb2304..b61a02682f 100644 --- a/hdr/sccol.hh +++ b/hdr/sccol.hh @@ -29,6 +29,8 @@ struct Score_column { static int compare(Score_column & c1, Score_column &c2) { return sgn(c1.when - c2.when); } + void add_duration(Real ); + void preprocess(); void set_breakable() { pcol_->set_breakable(); } diff --git a/hdr/stcol.hh b/hdr/stcol.hh index 17469a4db5..a620f8795d 100644 --- a/hdr/stcol.hh +++ b/hdr/stcol.hh @@ -26,6 +26,7 @@ struct Staff_column { bool mus() const; Real when() const; void add(Voice_element*ve); + /**************************************************************** VIRTUAL ****************************************************************/ diff --git a/src/sccol.cc b/src/sccol.cc index c29d26cf4a..be242059af 100644 --- a/src/sccol.cc +++ b/src/sccol.cc @@ -26,3 +26,24 @@ Score_column::print() const mtor << "}\n"; #endif } + +int +Real_compare(Real &a , Real& b) +{ + return sgn(a-b); +} + +void +Score_column::preprocess() +{ + durations.sort(Real_compare); +} +void +Score_column::add_duration(Real d) +{ + for (int i = 0; i< durations.sz(); i++) { + if (d == durations[i]) + return ; + } + durations.add(d); +} diff --git a/src/stcol.cc b/src/stcol.cc index 799daed316..abb27d17da 100644 --- a/src/stcol.cc +++ b/src/stcol.cc @@ -19,7 +19,7 @@ Staff_column::add(Voice_element*ve) { Real d= ve->duration; if (d){ - score_column->durations.add(d); + score_column->add_duration(d); } v_elts.add(ve); @@ -28,3 +28,4 @@ Staff_column::add(Voice_element*ve) Staff_column::Staff_column(Score_column*s) { score_column = s; } + -- 2.39.5