]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.30
authorfred <fred>
Sun, 24 Mar 2002 19:31:21 +0000 (19:31 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:31:21 +0000 (19:31 +0000)
input/scsii-menuetto.ly
src/complexwalker.cc
src/pscore.cc

index d9b570bf0bb21cf793474a57fe82df716f5fa78c..2e7358db481ce9ef595b1606d3e4dd4462efe69c 100644 (file)
@@ -69,7 +69,7 @@ ii_menuetto = music {
 %%11
 %      { a4\stemup( f2\stemdown } ) 'd4\stemup
 %      { 'cis4\stemup-. e4\stemdown }
-       { \music { a4 'd4 'cis4-. } \music { f2 e4 } } |
+       { \multivoice \music {\stem{1} a4(\stem{1}) 'd4 'cis4-. } \music { \stem{-1} f2 e4 } } |
 %%12
 %      { 'g^4 d\stemdown } (^  'f 'e ) 'f 'd^3(^ ) ='c ] |
        { [ 'g^"4" d } 'f 'e 'f 'd^"3"( ) 'c ] |
@@ -77,7 +77,10 @@ ii_menuetto = music {
 %      { bes2\stemup g4\stemdown } ( )  f4
 %      { 'c4\stemup e4\stemdown }
 %      { bes2 g4 } f4 { 'c4 e4 } | % \clef "alto" |
-       { \music { bes2 'c4 } \music { g4 f4 e4 } } |
+       { \multivoice
+               \music { \stem{1} bes2 'c4 }
+               \music { \stem{-1} g4(\stem{-1}) f4 e4 }% ugh
+       } |
 %%%14
 %%     [ { a( f } ) g a f ] { 'd4-\upbow e4 `bes4\stemdown } |
        { [ a f } g a f ] { 'd4-\upbow e4 `bes4 } |
@@ -104,7 +107,7 @@ ii_menuetto = music {
 %%%21
 %%     { 'd4\stemup g2\stemdown } (^ ) 'cis4\stemup { 'd4\stemup =f4\stemdown } |
 %      { 'd4 g2 } 'cis4 { 'd4 f4 } |
-       { \music { 'd4 'cis4 'd4 } \music { g2 f4 } } |
+       { \multivoice \music {\stem{1}  'd4(\stem{1} ) 'cis4 'd4 } \music { \stem{-1} g2 f4 } } |
 %%%22
 %%     [ { g(  cis } )f g e ] { f4 d4 } |
        { [ g cis } f g e ] { f4 d4 } |
@@ -146,160 +149,8 @@ score {
                symboltables { table_sixteen }
                width 195mm
 %              unitspace 12mm % this should do, really
-               unitspace 8mm  % to get lily to use only three lines
-               output "scsii-menuetto.out"
-       }
-}
-% scsii-menuetto.ly
-%
-% Solo Cello Suites
-% J. S. Bach
-%
-% Suite II part v
-% Menuetto I
-%
-% Copyright (c) 1995,1996,1997 Jan Nieuwenhuizen <jan@digicash.com>
-% 
-% The purpose of this file is to demonstrate features of LilyPond.
-% (there is an accompanying LaTeX file, scsii-menuetto.tex)
-%
-
-% \lefttitle{Menuetto}
-% \tempo{Moderato}
-% \metron{4=120}
-%
-% \meter{3/4}
-% \key\F               % key is F ( f-major )
-% \clef\alto           % use alto clef
-% \duration8           % default duration is 'eight note
-%
-% \verb{\nobarnumbers} % issue MusiXTeX command
-% \barnumbering0
-% \slope{30}           % Fool MusiXTeX into 30 / 10 steeper beam
-% \stemlength3         % shorter stemlength
-%              % because piece is set very tightly
-%%1            % double comments are included in .tex file
-ii_menuetto = music {
-       $
-       \octave{}
-       \duration{8}
-       { a2 f2 d2_"\f" } bes4-.  |
-%%2
-       { [ bes^"1" e c_"2"_"4" }
-%      (^ )
-       a bes-. g-. ] a4-.^"4" |
-%%3
-%      { d4 `bes4-.\stemup } stemup: 2 voices?
-       { d4 `bes4-. } g4-. [ f-. e-. ] |
-%%4
-%      { f `a } (^ e ) d cis-. `b-. `a-. ]
-%      [ f ( e ) d cis-. `b-. `a-. ]
-       { [ f `a } e d cis-. `b-. `a-. ]
-%%5
-       { a2 f2 d2 } bes4-. | %   @bes4-. |
-%%6
-%      {  bes( e  }  ) a
-       { [ bes e } a bes-. g-. ]
-       'c4-. | % ='c4-. |
-%%7
-       { a4-. f4}
-%      { 'd4-.-\upbow f4 `bes4\stemdown }
-       { 'd4-.-\upbow f4 `bes4 }
-%      { 'e4-.-\downbow g4 `g4\stemdown } |
-       { 'e4-.-\downbow g4 `g4 } |
-%%8
-%      { 'cis2.-\upbow e2. `a2.\stemdown } :||:
-       { 'cis2.-\upbow e2. `a2. } | % :||:
-%%9
-%      \clef "violin"
-%      { 'e2 a2_f\stemdown }
-       { 'e2 a2_"\f" }
-       [ 'd( 'e16 )'f16 ] |
-%%10
-%      [ { 'e( g } ) 'd 'cis_{ }_{ }_2 'e
-       { [ 'e g } 'd 'cis_"2" 'e a( )g ] |
-%%11
-%      { a4\stemup( f2\stemdown } ) 'd4\stemup
-%      { 'cis4\stemup-. e4\stemdown }
-       { \music { a4 'd4 'cis4-. } \music { f2 e4 } } |
-%%12
-%      { 'g^4 d\stemdown } (^  'f 'e ) 'f 'd^3(^ ) ='c ] |
-       { [ 'g^"4" d } 'f 'e 'f 'd^"3"( ) 'c ] |
-% %13
-%      { bes2\stemup g4\stemdown } ( )  f4
-%      { 'c4\stemup e4\stemdown }
-%      { bes2 g4 } f4 { 'c4 e4 } | % \clef "alto" |
-       { \music { bes2 'c4 } \music { g4 f4 e4 } } |
-%%%14
-%%     [ { a( f } ) g a f ] { 'd4-\upbow e4 `bes4\stemdown } |
-       { [ a f } g a f ] { 'd4-\upbow e4 `bes4 } |
-%%%15
-%%     { 'c4-\downbow f4 `a4\stemdown } [ bes( )a g a ] |
-%      { 'c4-\downbow f4 `a4 } [ bes( )a g a ] |
-%%%16
-       [ f( e )f a-. g-. bes-. ] |
-%% \tighten            % use one line less
-%% \newline            % start new line
-%%     |
-%%%17
-%%     { a2^0^\tr fis2_3 } bes4 |
-       { a2^"0" fis2_"3" } bes4 |
-%%%18
-%%     [ { 'c( es } ) bes 'c a ] fis4^\tr |
-       { [ 'c es } bes 'c a ] fis4 |
-%%%19
-%%     { 'd4-\downbow g4 `bes4\stemdown } { 'c4-\upbow g4 c4\stemdown } [ { bes d } a ] |
-       { 'd4-\downbow g4 `bes4 } { 'c4-\upbow g4 c4 } { [ bes d } a ] |
-%%%20
-%%     [ { 'c( d `g } bes a ) bes g ( ) bes ] |
-       { [ 'c d `g } bes a bes g( )bes ] |
-%%%21
-%%     { 'd4\stemup g2\stemdown } (^ ) 'cis4\stemup { 'd4\stemup =f4\stemdown } |
-%      { 'd4 g2 } 'cis4 { 'd4 f4 } |
-       { \music { 'd4 'cis4 'd4 } \music { g2 f4 } } |
-%%%22
-%%     [ { g(  cis } )f g e ] { f4 d4 } |
-       { [ g cis } f g e ] { f4 d4 } |
-%%%23
-%%     [ `g g ] { e4.\stemup^\tr `a4.\stemdown } d\stemup-\upbow |
-       [ `g g ] { e4. `a4. } d-\upbow |
-%%%24
-%%     { d2.^{fine}  `a2. `d2.\stemup_{ }_{ }_{3 mins.}}       s4 :||
-%%     { \textstyle "italic" d2.^"fine" `a2. \textstyle "roman" `d2._"3 mins."} | % :||
-       { d2.^"fine" `a2. `d2._"3 mins."} | % :||
-%% \tighten            % use one line less
-       $
-}
-
-score {
-       staff { 
-               melodic
-               music { ii_menuetto }
-               commands {
-                       key $bes$
-                       clef "alto"     
-                       skip 8:0
-                       clef "violin"
-                       skip 5:0
-                       clef "alto"
-                       skip 12:0
-               }
-       }
-       commands {
-               meter 3*4
-               skip 8:0
-               bar ":|:"
-%              clef "violin"
-               skip 5:0
-%              \clef "alto" 
-               skip 12:0
-               bar ":||"
-       }
-       paper {
-               symboltables { table_sixteen }
-               width 195mm
-%              unitspace 12mm % this should do, really
-               unitspace 8mm  % to get lily to use only three lines
+               unitspace 9mm  % to get lily to use only three lines
+               geometric 1.4
                output "scsii-menuetto.out"
        }
 }
index 378f486a08265f6452b613cf350d7fabcdabf0d1..ba8253205b8b9c832c998061345c3bd83960476b 100644 (file)
@@ -5,26 +5,49 @@
 #include "clef.hh"
 #include "pscore.hh"
 #include "complexstaff.hh"
-#include "sccol.hh"
 #include "debug.hh"
 #include "keyitem.hh"
 #include "clefitem.hh"
 #include "voicegroup.hh"
-#include "register.hh"
+#include "localkeyreg.hh"
 #include "complexwalker.hh"
 #include "misc.hh"
 
+Rhythmic_grouping
+parse_grouping(Array<Scalar> const &a)
+{
+    Array<int> r;
+    Array<Moment> grouplen_arr;
+    for (int i= 0 ; i < a.size()/2; ) {
+       r.push(a[i++]);
+       grouplen_arr.push(Moment(1,(int) a[i++]));
+    }
+    Moment here =0;
+
+    Array<Rhythmic_grouping*> children;
+    for (int i=0; i < r.size(); i++) {
+       
+       Moment last = here;
+       here += grouplen_arr[i] * Rational(r[i]);
+       children.push(
+           new Rhythmic_grouping(MInterval(last, here), r[i] ));
+    }
+    return Rhythmic_grouping(children);
+}
+
 void
-Complex_walker::do_INTERPRET_command(Command*com)
+Complex_walker::do_INTERPRET_command(Command*com_l)
 {
-    Array<Scalar> args(com->args);
+    Array<Scalar> args(com_l->args);
     args.del(0);
-    if (com->args[0] == "GROUPING") {  
+    String com = com_l->args[0];
+    
+    if (com == "GROUPING") {   
        default_grouping = parse_grouping(args);
-    }else if (com->args[0] == "NEWMEASURE") {
+    }else if (com == "NEWMEASURE") {
        local_key_.reset(key_);
 
-    } else if (com->args[0] == "KEY") {
+    } else if (com == "KEY") {
        
        if (col()->when() > Moment(0)) {
            assert(!oldkey_undo);
@@ -33,10 +56,10 @@ Complex_walker::do_INTERPRET_command(Command*com)
        
        typesetkey = key_.read(args);
        local_key_.reset(key_); 
-    } else if (com->args[0] == "CLEF") {
-       clef_.read(args);
+    } else if (com == "CLEF") {
+       clef_.set_type(args[0]);
     } else {
-       WARN << " ignoring INTERPRET command: " << com->args[0]<< "\n";
+       WARN << " ignoring INTERPRET command: " << com<< "\n";
     }
 }
 
@@ -101,17 +124,17 @@ Complex_walker::do_announces()
     for (int i = 0; i < announce_info_arr_.size(); i++){
        Staff_elem_info info = announce_info_arr_[i];
        for (iter_top(voice_reg_list_,j); j.ok(); j++) {
-           j->announce_element(info);
+           j->acknowledge_element(info);
        }
        for (iter_top ( group_reg_list_, j); j.ok(); j++) {
-           j->announce_element(info);
+           j->acknowledge_element(info);
        }
        local_key_reg_.acknowledge_element(info);
     }
 }
 
 Voice_registers *
-Complex_walker::find_voice_reg(Voice*v_l)
+Complex_walker::find_voice_reg(Voice*v_l)const
 {
    for (iter_top(voice_reg_list_, i); i.ok(); i++) {
        if (i->voice_l_ == v_l)
@@ -133,7 +156,7 @@ Complex_walker::get_voice_reg(Voice*v_l)
 }
 
 Voice_group_registers *
-Complex_walker::find_voice_group(Voice* v_l)
+Complex_walker::find_voice_group(Voice* v_l)const
 {
     if (!voice_group_map_.elt_query(v_l))
        return 0;
@@ -141,7 +164,7 @@ Complex_walker::find_voice_group(Voice* v_l)
 }
 
 Voice_group_registers *
-Complex_walker::find_voice_group(const char *id)
+Complex_walker::find_voice_group(const char *id)const
 {
     for (iter_top(group_reg_list_, i); i.ok(); i++)
        if (i->group_id_str_ == id)
@@ -176,7 +199,7 @@ Complex_walker::get_voice_group(const char* id)
 }
 
 void 
-Complex_walker::do_change_group(const Voice * v, String group_id_str)
+Complex_walker::do_change_group(Voice * v, String group_id_str)
 {
     voice_group_map_[v] = get_voice_group(group_id_str);
 }
@@ -196,12 +219,6 @@ Complex_walker::try_request(Request*req)
     } else if (Voice_group_registers::acceptable_request(req)){
        Voice_group_registers* reg_l = get_voice_group(voice_l);
        b = reg_l->try_request(req);
-#if 0
-       if (!b) {
-           bool please_b = get_voice_group("")->try_request(req);         
-           b |= please_b;
-       }
-#endif
     } 
 
     if (!b)
@@ -243,13 +260,13 @@ Complex_walker::typeset_element(Staff_elem *elem_p)
     if (!elem_p)
        return;
     if (elem_p->spanner())
-       pscore_l_->typeset_spanner(elem_p->spanner(), staff()->theline_l_);
+       pscore_l_->typeset_spanner(elem_p->spanner(), staff()->pstaff_l_);
     else
        col()->typeset_item(elem_p->item()); 
 }
 
 Complex_walker::Complex_walker(Complex_staff*s)
-    : Staff_walker(s, s->theline_l_->pscore_l_),
+    : Staff_walker(s, s->pstaff_l_->pscore_l_),
       local_key_reg_(this)      
 {
     oldkey_undo = 0;
@@ -294,3 +311,13 @@ Complex_walker::do_post_move()
        j->post_move_processing();
     local_key_reg_.post_move_processing();
 }
+
+Array<Voice_registers*>
+Complex_walker::get_voice_regs(Voice_group_registers* group_regs_l) const
+    return l_arr;
+{
+    for (Assoc_iter<Voice*,Voice_group_registers*> i(voice_group_map_); i.ok(); i++) {
+       if (i.val() == group_regs_l)
+           l_arr.push(find_voice_reg(i.key()));
+    }
+}
index 728b083f4e353c36ec0fc91b00aebae8aa1c081a..a022f5e087a710b2fedce5ad9e8cbc526c19cf60 100644 (file)
@@ -15,16 +15,11 @@ Idealspacing*
 PScore::get_spacing(PCol*l, PCol*r)
 {
     assert(l!=r);
-    for (iter_top(suz,ic); ic.ok(); ic++) {
-       if (ic->left == l && ic->right == r){
-           return ic;
-       }
-    }
-    
-    Idealspacing*ip =new Idealspacing(l,r);
-    suz.bottom().add(ip);
 
-    return ip;
+    Idealspacing*i_p =new Idealspacing(l,r);
+    suz.bottom().add(i_p);
+
+    return i_p;
 }
 
 
@@ -53,11 +48,10 @@ PScore::do_connect(PCol *c1, PCol *c2, Real d, Real h)
     if (!c1 || !c2 )
        return;
     Idealspacing*s_l=get_spacing(c1,c2);
-       
-    if (!s_l->hooke){
-       s_l->hooke = h;
-       s_l->space =d;
-    }
+
+    
+    s_l->hooke = h;
+    s_l->space =d;
 }
 
 void
@@ -73,7 +67,7 @@ void
 PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
 {
     assert(c && i && s);
-//    assert(!breakstat != 4 || c->breakable() );
+
     if (breakstat == 0) {
        typeset_item(i, c->prebreak_p_, s);
        return;
@@ -254,10 +248,10 @@ void
 PScore::process()
 {
     clean_cols();
-    *mlog << "Preprocessing" << endl;
+    *mlog << "Preprocessing ... " <<flush;
     preprocess();
-    *mlog << "Calculating" << endl;
+    *mlog << "\nCalculating column positions ... " <<flush;
     calc_breaking();
-    *mlog << "Postprocessing" << endl;
+    *mlog << "\nPostprocessing ..." << endl;
     postprocess();
 }