]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/multi-measure-rest-engraver.cc (process_music): extra check
authorhanwen <hanwen>
Wed, 4 Feb 2004 12:31:20 +0000 (12:31 +0000)
committerhanwen <hanwen>
Wed, 4 Feb 2004 12:31:20 +0000 (12:31 +0000)
to allow 0-length mmrest events.

* scm/part-combiner.scm (determine-split-list): many bugfixes.

* lily/new-part-combine-iterator.cc (kill_mmrest): new function.

* scm/part-combiner.scm: rewrite.

ChangeLog
lily/multi-measure-rest-engraver.cc
lily/new-part-combine-iterator.cc
lily/stem-engraver.cc
ly/engraver-init.ly
scm/part-combiner.scm

index c26e63774799c2c6e8b6f8f1b02b35eecebcfdd6..527d4fdc26a23b45cc9cfc40fdd111bc83c4d8c6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2004-02-04  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+
+       
+       * lily/multi-measure-rest-engraver.cc (process_music): extra check
+       to allow 0-length mmrest events.
+
+       * scm/part-combiner.scm (determine-split-list): many bugfixes.
+
+       * lily/new-part-combine-iterator.cc (kill_mmrest): new function.
+
        * lily/spacing-engraver.cc (finalize): robustifications.
 
        * input/regression/new-part-combine-solo-global.ly: new file.
index b645c18f2fd4167f3b4f8eb31fdf871065aa1af7..5a2b86a5a9511560f771d14f4f616df28edffc0f 100644 (file)
@@ -77,7 +77,8 @@ Multi_measure_rest_engraver::try_music (Music* req)
 void
 Multi_measure_rest_engraver::process_music ()
 {
-  if (rest_ev_ && !mmrest_)
+  if (rest_ev_ && !mmrest_
+      && stop_moment_ > now_mom ())
     {
       mmrest_ = make_spanner ("MultiMeasureRest");
 
index 9c096a628a125e47711dff0f91781f694a1ca851..37a978030a8f1100412fb9972add5c808f01c535 100644 (file)
@@ -56,6 +56,7 @@ private:
   Interpretation_context_handle null_;
   Interpretation_context_handle shared_;
 
+  void kill_mmrest (Translator_group*);
   void chords_together ();
   void solo1 ();
   void solo2 ();
@@ -160,6 +161,19 @@ New_pc_iterator::chords_together ()
 }
 
 
+void
+New_pc_iterator::kill_mmrest (Translator_group * tg)
+{
+  static Music * mmrest;
+  if (!mmrest)
+    {
+      mmrest = make_music_by_name (ly_symbol2scm ("MultiMeasureRestEvent"));
+      mmrest->set_mus_property ("duration", SCM_EOL);
+    }
+
+  tg->try_music (mmrest);
+}
+
 void
 New_pc_iterator::solo1 ()
 {
@@ -173,6 +187,8 @@ New_pc_iterator::solo1 ()
 
       second_iter_->substitute_outlet (two_.report_to (), null_.report_to ());
       second_iter_->substitute_outlet (shared_.report_to (), null_.report_to ());
+      kill_mmrest (two_.report_to ());
+      kill_mmrest (shared_.report_to ());
 
       if (playing_state_ != SOLO1)
        {
@@ -200,6 +216,8 @@ New_pc_iterator::unisono (bool silent)
 
       second_iter_->substitute_outlet (two_.report_to (), null_.report_to ());
       second_iter_->substitute_outlet (shared_.report_to (), null_.report_to ());
+      kill_mmrest (two_.report_to ());
+      kill_mmrest (shared_.report_to ());
 
       if (playing_state_ != UNISONO
          && newstate == UNISONO)
@@ -229,7 +247,9 @@ New_pc_iterator::solo2 ()
 
       first_iter_->substitute_outlet (one_.report_to (), null_.report_to ());
       first_iter_->substitute_outlet (shared_.report_to (), null_.report_to ());
-
+      kill_mmrest (one_.report_to ());
+      kill_mmrest (shared_.report_to ());
+      
       if (playing_state_ != SOLO2)
        {
          static Music* event;
index f6330fe102ae37e61b66fec4f9305433cdf57c53..01fc1abc40de65b74ef17faaaa5d989e173aa1e6 100644 (file)
@@ -79,17 +79,17 @@ Stem_engraver::acknowledge_grob (Grob_info i)
 
                the first and last (quarter) note bothe get one tremolo flag.
               */
-             int evuested_type = gh_scm2int (tremolo_ev_->get_mus_property ("tremolo-type"));
+             int requested_type = gh_scm2int (tremolo_ev_->get_mus_property ("tremolo-type"));
              SCM f = get_property ("tremoloFlags");
-             if (!evuested_type)
+             if (!requested_type)
                if (gh_number_p (f))
-                 evuested_type = gh_scm2int (f);
+                 requested_type = gh_scm2int (f);
                else
-                 evuested_type = 8; 
+                 requested_type = 8; 
              else
-               daddy_trans_->set_property ("tremoloFlags", gh_int2scm (evuested_type));
+               daddy_trans_->set_property ("tremoloFlags", gh_int2scm (requested_type));
 
-             int tremolo_flags = intlog2 (evuested_type) - 2
+             int tremolo_flags = intlog2 (requested_type) - 2
                - (duration_log > 2 ? duration_log - 2 : 0);
              if (tremolo_flags <= 0)
                {
index b664bd8578e4abb3fde587ba208b24111cca9d31..47de3c9cf03b5358770e729173c7f41e79402eea 100644 (file)
@@ -589,6 +589,11 @@ EasyNotation = \translator {
 \translator {
     \name "Devnull"
     \type "Engraver_group_engraver"
+
+    %% don't want to route anything out of here: 
+    \alias "Staff"
+    \alias "Timing"
+    \alias "Voice"
     \consists "Swallow_engraver"
     \description "Silently discards all musical information given to this context. "
     }
index 28e6be9018d2bdcee5af8d522b1030f745566edc..5730a7e005fed8912a6d3a306bcb05fd6d12fd10 100644 (file)
 (define-class <Voice-state> ()
   (event-list #:init-value '() #:accessor events #:init-keyword #:events)
   (when-moment #:accessor when #:init-keyword #:when)
-  (split-idx #:accessor split-idx)
+  (split-index #:accessor split-index)
   (vector-index)
   (state-vector)
+
+
+  ;;;
+  ; spanner-state is an alist
+  ; of (SYMBOL . RESULT-INDEX), which indicates where
+  ; said spanner was started.
   (spanner-state #:init-value '() #:accessor span-state)
   )
   
+(define-method (write (x <Voice-state> ) file)
+  (display (when x) file)
+  (display " evs = " file)
+  (display (events x) file)
+  (display " active = " file)
+  (display (span-state x) file)
+  (display "\n" file)
+  )
 
 (define-method (note-events (vs <Voice-state>))
   (define (f? x)
@@ -29,6 +43,8 @@
   (synced  #:init-keyword #:synced #:init-value  #f #:getter synced?)
   )
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 (define-method (previous-voice-state (vs <Voice-state>))
   (let* ((i (slot-ref vs 'vector-index))
         (v (slot-ref vs 'state-vector))
               '())
         ))
 
-(define-method (write (x <Voice-state> ) file)
-  (display (when x) file)
-  (display " evs = " file)
-  (display (events x) file)
-  (display " active = " file)
-  (display (span-state x) file)
-  (display "\n" file)
-  )
 
 (define-method (write (x <Split-state> ) f)
   (display (when x) f)
@@ -115,9 +123,9 @@ Voice-state objects
                ) #f))
         )
       (if s1
-         (set! (split-idx s1) ss-idx))
+         (set! (split-index s1) ss-idx))
       (if s2
-         (set! (split-idx s2) ss-idx))
+         (set! (split-index s2) ss-idx))
       
       (if min
          (helper (1+ ss-idx)
@@ -182,7 +190,9 @@ Voice-state objects
        (if (and (symbol? key) (ly:dir? sp))
            (if (= sp STOP)
                (assoc-remove! active key)
-               (acons key index active))
+               (acons key
+                      (split-index (vector-ref voice-state-vec index))
+                      active))
            active)
        ))
 
@@ -209,9 +219,12 @@ Voice-state objects
 
        ;; todo: use fold or somesuch.
        (run-analyzers
-       (list analyse-span-event
-             ;; note: tie-start comes after tie-end.
-             analyse-tie-end analyse-tie-start analyse-absdyn-end)
+       (list
+        analyse-absdyn-end
+        analyse-span-event
+             
+        ;; note: tie-start/span comes after tie-end/absdyn.
+        analyse-tie-end analyse-tie-start)
 
         active evs)
        
@@ -307,8 +320,7 @@ Only set if not set previously.
       (define (copy-one-state key-idx)
        (let*
            ((idx (cdr key-idx))
-            (start-vs (vector-ref state-vec idx))
-            (prev-ss (vector-ref result (split-idx start-vs)))
+            (prev-ss (vector-ref result idx))
             (prev (configuration prev-ss))
             )
          (if (symbol? prev)
@@ -448,7 +460,7 @@ Only set if not set previously.
     
      (define (previous-config vs)
        (let*  ((pvs (previous-voice-state vs))
-              (spi (if pvs (split-idx pvs) #f))
+              (spi (if pvs (split-index pvs) #f))
               (prev-split (if spi (vector-ref result spi) #f))
               )
         
@@ -499,9 +511,8 @@ Only set if not set previously.
           ((now-state (vector-ref result ri))
            (vs1 (car (voice-states now-state)))
            (vs2 (cdr (voice-states now-state)))
-           
-           (notes1 (note-events vs1))
-           (notes2 (note-events vs2))
+           (notes1 (if vs1 (note-events vs1) '()))
+           (notes2 (if vs2 (note-events vs2) '()))
            (n1 (length notes1))
            (n2 (length notes2))
            )