From 11e48c5a2cd4525b0783552d2f05153550335be0 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 4 Feb 2004 12:31:20 +0000 Subject: [PATCH] * 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. * scm/part-combiner.scm: rewrite. --- ChangeLog | 9 +++++ lily/multi-measure-rest-engraver.cc | 3 +- lily/new-part-combine-iterator.cc | 22 +++++++++++- lily/stem-engraver.cc | 12 +++---- ly/engraver-init.ly | 5 +++ scm/part-combiner.scm | 53 +++++++++++++++++------------ 6 files changed, 75 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index c26e637747..527d4fdc26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2004-02-04 Han-Wen Nienhuys + + + * 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. diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index b645c18f2f..5a2b86a5a9 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -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"); diff --git a/lily/new-part-combine-iterator.cc b/lily/new-part-combine-iterator.cc index 9c096a628a..37a978030a 100644 --- a/lily/new-part-combine-iterator.cc +++ b/lily/new-part-combine-iterator.cc @@ -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; diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index f6330fe102..01fc1abc40 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -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) { diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index b664bd8578..47de3c9cf0 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -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. " } diff --git a/scm/part-combiner.scm b/scm/part-combiner.scm index 28e6be9018..5730a7e005 100644 --- a/scm/part-combiner.scm +++ b/scm/part-combiner.scm @@ -10,12 +10,26 @@ (define-class () (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 ) 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 )) (define (f? x) @@ -29,6 +43,8 @@ (synced #:init-keyword #:synced #:init-value #f #:getter synced?) ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (define-method (previous-voice-state (vs )) (let* ((i (slot-ref vs 'vector-index)) (v (slot-ref vs 'state-vector)) @@ -46,14 +62,6 @@ '()) )) -(define-method (write (x ) 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 ) 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)) ) -- 2.39.2