From 6032eafe8aeaaa9ad30763c4a62934833722533c Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:32:20 +0000 Subject: [PATCH] lilypond-0.0.32 --- hdr/keyitem.hh | 14 ++---- src/keyitem.cc | 32 +++++++------ src/note.cc | 124 +++++++++++++++++-------------------------------- 3 files changed, 65 insertions(+), 105 deletions(-) diff --git a/hdr/keyitem.hh b/hdr/keyitem.hh index b882c9551a..86dae4d9fc 100644 --- a/hdr/keyitem.hh +++ b/hdr/keyitem.hh @@ -10,25 +10,21 @@ #include "item.hh" #include "varray.hh" -struct Clef; /// An item which places accidentals at the start of the line -struct Keyitem : Item { - const char * name() const; +struct Key_item : Item { Array pitch; Array acc; int c_position; /* *************** */ - - Keyitem(int cposition); + const char * name() const; + Key_item(int cposition); void add(int pitch, int acc); - void read(Array k); - void read(const Clef& c); - + void read(const Key_register&); + void set_c_position(int); void preprocess(); - Molecule* brew_molecule_p()const; }; diff --git a/src/keyitem.cc b/src/keyitem.cc index 22cf0e6d01..6b465572dd 100644 --- a/src/keyitem.cc +++ b/src/keyitem.cc @@ -4,43 +4,45 @@ #include "molecule.hh" #include "paperdef.hh" #include "lookup.hh" -#include "clef.hh" +//#include "clefreg.hh" +#include "keyreg.hh" const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */ const int SHARP_TOP_PITCH=4; /* ais and bis typeset in lower octave */ -NAME_METHOD(Keyitem); +NAME_METHOD(Key_item); -Keyitem::Keyitem(int c) +Key_item::Key_item(int c) { - c_position = c; + set_c_position(c); } void -Keyitem::read(Array s) +Key_item::read(const Key_register& key_reg_r) { - for (int i = 0 ; i< s.size(); ) { - int note = s[i++]; - int acc = s[i++]; - + const Array &idx_arr =key_reg_r.accidental_idx_arr_; + for (int i = 0 ; i< idx_arr.size(); i++) { + int note = idx_arr[i]; + int acc = key_reg_r.key_.acc(note); + add(note, acc); } } void -Keyitem::read(const Clef& c) +Key_item::set_c_position(int c0) { - int octaves =(abs(c.c0_position_i_) / 7) +1 ; - c_position=(c.c0_position_i_ + 7*octaves)%7; + int octaves =(abs(c0) / 7) +1 ; + c_position=(c0 + 7*octaves)%7; } void -Keyitem::add(int p, int a) +Key_item::add(int p, int a) { if ((a<0 && p>FLAT_TOP_PITCH) || (a>0 && p>SHARP_TOP_PITCH)) { - p=p-7; /* Typeset below c_position */ + p -= 7; /* Typeset below c_position */ } pitch.push(p); acc.push(a); @@ -48,7 +50,7 @@ Keyitem::add(int p, int a) Molecule* -Keyitem::brew_molecule_p()const +Key_item::brew_molecule_p()const { Molecule*output = new Molecule; Real inter = paper()->internote(); diff --git a/src/note.cc b/src/note.cc index 796090f04d..2a89743e95 100644 --- a/src/note.cc +++ b/src/note.cc @@ -6,7 +6,8 @@ #include "string.hh" #include "real.hh" #include "debug.hh" -#include "request.hh" +#include "musicalrequest.hh" +#include "commandrequest.hh" #include "voice.hh" #include "notename.hh" #include "identparent.hh" @@ -48,7 +49,7 @@ get_text(String s) return t; t= new Text_def; t->text_str_= s; t->style_str_ = textstyle; - t->defined_ch_c_l_m = defined_ch_c_l; + t->defined_ch_c_l_ = defined_ch_c_l; return t; } @@ -74,40 +75,37 @@ parse_octave (const char *a, int &j, int &oct) } void -parse_pitchmod( const char *a, int &j, int &oct, bool & overide_acc) +parse_pitch( const char *a, Melodic_req* mel_l) { + int j=0; + // octave - oct =default_octave; - parse_octave(a,j,oct); - + mel_l->octave_i_ = default_octave; + parse_octave(a,j,mel_l->octave_i_); + // accidental - overide_acc = false; + mel_l->forceacc_b_ = false; - if (a[j] == '!') - { - overide_acc = true; + if (a[j] == '!'){ + mel_l->forceacc_b_ = true; j++; - } - - mtor << "oct " << oct; - mtor << "override: " << overide_acc<<'\n'; + } } - Voice_element * get_note_element(String pitch, int * notename, int * duration ) { Voice_element*v = new Voice_element; - v->defined_ch_c_l_m = defined_ch_c_l; - int i=0; + v->defined_ch_c_l_ = defined_ch_c_l; + int dur = duration[0]; - int dots=duration[1]; + int dots = duration[1]; if (dur >= 2) { Stem_req * stem_req_p = new Stem_req(dur,dots); stem_req_p->plet_factor = Moment(default_plet_dur, default_plet_type); - stem_req_p->defined_ch_c_l_m = defined_ch_c_l; + stem_req_p->defined_ch_c_l_ = defined_ch_c_l; v->add(stem_req_p); } @@ -115,19 +113,15 @@ get_note_element(String pitch, int * notename, int * duration ) defined_ch_c_l = lexer->here_ch_c_l(); Note_req * rq = new Note_req; - - int oct; - bool forceacc; - parse_pitchmod(pitch, i, oct, forceacc); - rq->notename =notename[0]; - rq->accidental = notename[1]; - rq->octave = oct + notename[2]; - rq->forceacc = forceacc; + rq->notename_i_ =notename[0]; + rq->accidental_i_ = notename[1]; + parse_pitch(pitch, rq); + rq->octave_i_ += notename[2]; + rq->balltype = dur; rq->dots = dots; rq->plet_factor = Moment(default_plet_dur, default_plet_type); - rq->defined_ch_c_l_m = defined_ch_c_l; - rq->print(); + rq->defined_ch_c_l_ = defined_ch_c_l; v->add(rq); @@ -138,25 +132,20 @@ Voice_element* get_word_element(Text_def* tdef_p, int* duration) { Voice_element* velt_p = new Voice_element; - velt_p->defined_ch_c_l_m = defined_ch_c_l; + velt_p->defined_ch_c_l_ = defined_ch_c_l; int dur = duration[0]; int dots=duration[1]; - tdef_p->defined_ch_c_l_m = defined_ch_c_l; -#if 0 - char buf[ 21 ]; - strncpy( buf, tdef_p->defined_ch_c_l_m, 20 ); - buf[ 20 ] = 0; - cout << hex << (void*)tdef_p->defined_ch_c_l_m << dec << buf << endl; -#endif + tdef_p->defined_ch_c_l_ = defined_ch_c_l; + Lyric_req* lreq_p = new Lyric_req(tdef_p); lreq_p->balltype = dur; lreq_p->dots = dots; lreq_p->plet_factor = Moment(default_plet_dur, default_plet_type); lreq_p->print(); - lreq_p->defined_ch_c_l_m = defined_ch_c_l; + lreq_p->defined_ch_c_l_ = defined_ch_c_l; velt_p->add(lreq_p); @@ -167,14 +156,14 @@ Voice_element * get_rest_element(String, int * duration ) { Voice_element* velt_p = new Voice_element; - velt_p->defined_ch_c_l_m = defined_ch_c_l; + velt_p->defined_ch_c_l_ = defined_ch_c_l; Rest_req * rest_req_p = new Rest_req; rest_req_p->plet_factor = Moment(default_plet_dur, default_plet_type); rest_req_p->balltype = duration[0]; rest_req_p->dots = duration[1]; rest_req_p->print(); - rest_req_p->defined_ch_c_l_m = defined_ch_c_l; + rest_req_p->defined_ch_c_l_ = defined_ch_c_l; velt_p->add(rest_req_p); @@ -247,7 +236,7 @@ get_request(char c) break; } - req_p->defined_ch_c_l_m = req_defined_ch_c_l; + req_p->defined_ch_c_l_ = req_defined_ch_c_l; return req_p; } @@ -289,8 +278,6 @@ Request* get_script_req(int d , Script_def*def) { Script_req* script_req_p = new Script_req(d, def); - // all terminal symbols, rather set directly here: - script_req_p->defined_ch_c_l_m = lexer->here_ch_c_l(); return script_req_p; } @@ -298,49 +285,24 @@ Request* get_text_req(int d , Text_def*def) { Text_req* text_req_p = new Text_req(d, def); - text_req_p->defined_ch_c_l_m = defined_ch_c_l; return text_req_p; } -Voice_element* -get_mark_element(String s) -{ - Voice_element*v_p = new Voice_element; - v_p->defined_ch_c_l_m = defined_ch_c_l; - Mark_req* mark_req_p = new Mark_req(s); - mark_req_p->defined_ch_c_l_m = defined_ch_c_l; - v_p->add(mark_req_p); - return v_p; -} -Voice_element* -get_command_element(Input_command*com_p) -{ - Voice_element *velt_p = new Voice_element; - velt_p->defined_ch_c_l_m = defined_ch_c_l; - Staff_command_req* scommand_req_p = new Staff_command_req(com_p); - scommand_req_p->defined_ch_c_l_m = defined_ch_c_l; - velt_p->add(scommand_req_p); - return velt_p; -} -Voice_element* -get_barcheck_element() +Request* +get_stemdir_req(int d) { - Voice_element* velt_p = new Voice_element; - velt_p->defined_ch_c_l_m = req_defined_ch_c_l; - Barcheck_req* barcheck_req_p = new Barcheck_req; - barcheck_req_p->defined_ch_c_l_m = req_defined_ch_c_l; - velt_p->add(barcheck_req_p); - return velt_p; + Group_feature_req * gfreq_p = new Group_feature_req; + gfreq_p->stemdir_i_ =d; + return gfreq_p; } -Voice_element* -get_stemdir_element(int d) +Request* +get_grouping_req(Array i_arr) { - Voice_element*v_p = new Voice_element; - v_p->defined_ch_c_l_m = req_defined_ch_c_l; - Group_feature_req * gfreq_p = new Group_feature_req; - gfreq_p->stemdir_i_ =d; - gfreq_p->defined_ch_c_l_m = req_defined_ch_c_l; - v_p->add(gfreq_p); - return v_p; + Measure_grouping_req * mr_p = new Measure_grouping_req; + for (int i=0; i beat_i_arr_.push(i_arr[i++]); + mr_p->elt_length_arr_.push(Moment(1, i_arr[i++])); + } + return mr_p; } -- 2.39.5