From: fred Date: Sun, 24 Mar 2002 19:36:36 +0000 (+0000) Subject: lilypond-0.0.45 X-Git-Tag: release/1.5.59~5114 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=716b38c6949156023c292a95d54d67a47f83580e;p=lilypond.git lilypond-0.0.45 --- diff --git a/lily/include/input-music.hh b/lily/include/input-music.hh index 36ca215f67..49e41d5729 100644 --- a/lily/include/input-music.hh +++ b/lily/include/input-music.hh @@ -35,7 +35,7 @@ struct Input_music { virtual ~Input_music(){} virtual void print() const =0; virtual void set_default_group(String)=0; - virtual bool find_plet_start_bo(char c, Moment& moment_r) = 0; + virtual bool find_plet_start_b(char c, Moment& moment_r) = 0; virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) = 0; virtual void transpose(Melodic_req const&) const =0; @@ -58,7 +58,7 @@ struct Simple_music : Input_music { virtual Voice_list convert()const; virtual void translate_time(Moment dt); virtual void print() const; - virtual bool find_plet_start_bo(char c, Moment& moment_r); + virtual bool find_plet_start_b(char c, Moment& moment_r); virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i); virtual Input_music *clone() const { return new Simple_music(*this); @@ -76,7 +76,7 @@ struct Complex_music : Input_music { Complex_music(Complex_music const &); virtual void print() const ; void concatenate(Complex_music*); - virtual bool find_plet_start_bo(char c, Moment& moment_r); + virtual bool find_plet_start_b(char c, Moment& moment_r); virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i); }; diff --git a/lily/include/voice-element.hh b/lily/include/voice-element.hh index 0b606f1301..aa72fb8122 100644 --- a/lily/include/voice-element.hh +++ b/lily/include/voice-element.hh @@ -17,7 +17,10 @@ /** one horizontal bit. Voice_element is nothing but a container for *the requests, */ struct Voice_element { - Moment duration; + /** the duration of the element. This can be 0; The duration is + determined from rhythmical requests contained in this + Voice_element */ + Moment duration_; char const* defined_ch_C_; Voice const *voice_l_; IPointerList reqs; @@ -28,7 +31,7 @@ struct Voice_element { Voice_element(Voice_element const & src ); void add(Request*); - bool find_plet_start_bo(char c, Moment& moment_r); + bool find_plet_start_b(char c, Moment& moment_r); void print ()const; void set_default_group(String id); void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i); diff --git a/lily/include/voice.hh b/lily/include/voice.hh index 4e7e615693..f5a950a2c9 100644 --- a/lily/include/voice.hh +++ b/lily/include/voice.hh @@ -15,6 +15,9 @@ */ struct Voice { + /** the elements, earliest first. + Please use the member #add()# to add a new element + */ IPointerList elts; Moment start; @@ -26,7 +29,7 @@ struct Voice { Moment last() const; void transpose(Melodic_req const &)const; void add(Voice_element*); - bool find_plet_start_bo(char c, Moment& moment_r); + bool find_plet_start_b(char c, Moment& moment_r); void print() const; void set_default_group(String id); void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i); diff --git a/lily/input-music.cc b/lily/input-music.cc index 26377e7f53..e407c87dd5 100644 --- a/lily/input-music.cc +++ b/lily/input-music.cc @@ -2,6 +2,7 @@ #include "input-music.hh" #include "voice.hh" #include "musical-request.hh" +#include "command-request.hh" #include "voice-element.hh" void @@ -10,7 +11,7 @@ Input_music::check_plet(Voice_element* velt_l) for (iter_top(velt_l->reqs,i); i.ok(); i++) if ( i->plet() ) { Moment start_moment = 0; - if ( !find_plet_start_bo( i->plet()->type_c_, start_moment ) ) { + if ( !find_plet_start_b( i->plet()->type_c_, start_moment ) ) { error( "begin of plet not found", i->defined_ch_C_ ); break; } @@ -48,7 +49,15 @@ Voice_list Simple_music::convert()const { Voice_list l; - l.bottom().add(new Voice(voice_)); + Voice * v_p = new Voice(voice_); + PCursor i= v_p->elts.bottom(); + // need-to-have, otherwise memory will be filled up with regs. + if (!i.ok() || i->duration_) { + v_p->add ( new Voice_element); + i=v_p->elts.bottom(); + } + i->add(new Terminate_voice_req); + l.bottom().add(v_p); return l; } @@ -56,17 +65,20 @@ Simple_music::convert()const void Simple_music::print() const { +#ifndef NPRINT mtor << "Simple_music {"; voice_.print(); mtor << "}\n"; +#endif } bool -Simple_music::find_plet_start_bo(char c, Moment& moment_r) +Simple_music::find_plet_start_b(char c, Moment& moment_r) { - return voice_.find_plet_start_bo(c, moment_r); + return voice_.find_plet_start_b(c, moment_r); } void -Simple_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) +Simple_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, + int num_i, int den_i) { voice_.set_plet_backwards(now_moment_r, until_moment, num_i, den_i); } @@ -115,10 +127,10 @@ Complex_music::set_default_group(String g) i->set_default_group(g); } bool -Complex_music::find_plet_start_bo(char c, Moment& moment_r) +Complex_music::find_plet_start_b(char c, Moment& moment_r) { for (iter_bot(elts,i); i.ok(); i--) { - if ( i->find_plet_start_bo(c, moment_r) ) + if ( i->find_plet_start_b(c, moment_r) ) return true; } return false; diff --git a/lily/voice-elt.cc b/lily/voice-elt.cc index 4c1249b140..4e33437886 100644 --- a/lily/voice-elt.cc +++ b/lily/voice-elt.cc @@ -27,7 +27,7 @@ void Voice_element::print() const { #ifndef NPRINT - mtor << "voice_element { dur :"<< duration <<"\n"; + mtor << "voice_element { dur :"<< duration_ <<"\n"; for (iter_top(reqs,rc); rc.ok(); rc++) { rc->print(); } @@ -39,8 +39,8 @@ void Voice_element::add(Request*r) { if (r->duration()) { - assert (!duration || duration == r->duration()); - duration = r->duration(); + assert (!duration_ || duration_ == r->duration()); + duration_ = r->duration(); } r->elt_l_ = this; @@ -51,7 +51,7 @@ Voice_element::add(Request*r) Voice_element::Voice_element() { voice_l_ = 0; - duration = 0; + duration_ = 0; defined_ch_C_ = 0; } @@ -65,10 +65,10 @@ Voice_element::Voice_element(Voice_element const&src) } bool -Voice_element::find_plet_start_bo(char c, Moment& moment_r) +Voice_element::find_plet_start_b(char c, Moment& moment_r) { assert( c == ']' ); - moment_r += duration; + moment_r += duration_; for ( PCursor i( reqs.top() ); i.ok(); i++ ) { if (i->beam() && i->beam()->spantype == Span_req::START ) return true; @@ -91,7 +91,7 @@ void Voice_element::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) { - now_moment_r += duration; + now_moment_r += duration_; if ( now_moment_r > until_moment ) return; for ( PCursor i( reqs.top() ); i.ok(); i++ ) { diff --git a/lily/voice.cc b/lily/voice.cc index 2294d57b2e..d76b3ebe83 100644 --- a/lily/voice.cc +++ b/lily/voice.cc @@ -30,10 +30,10 @@ Voice::set_default_group(String s) } bool -Voice::find_plet_start_bo(char c, Moment& moment_r) +Voice::find_plet_start_b(char c, Moment& moment_r) { for (iter_bot(elts, i); i.ok(); i--) - if ( i->find_plet_start_bo(c, moment_r) ) + if ( i->find_plet_start_b(c, moment_r) ) return true; return false; } @@ -88,7 +88,7 @@ Voice::last() const l = start; for (iter_top(elts,i); i.ok(); i++) - l += i->duration; + l += i->duration_; return l; }