lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue 4403: Part_combine_iterator: stop tracking the last-playing part (


From: nine . fierce . ballads
Subject: Issue 4403: Part_combine_iterator: stop tracking the last-playing part (issue 235590044 by address@hidden)
Date: Mon, 18 May 2015 18:04:28 +0000

Reviewers: ,

Description:
Rely on the Scheme-computed split state to choose which voice to use
for unisono and unisilence passages.

Please review this at https://codereview.appspot.com/235590044/

Affected files (+4, -62 lines):
  M lily/part-combine-iterator.cc


Index: lily/part-combine-iterator.cc
diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc
index 065ee1bce24164553691e28407e27697d3bf2209..9c0aa4df3a23fe21541266c1a2be54fa28092fc6 100644
--- a/lily/part-combine-iterator.cc
+++ b/lily/part-combine-iterator.cc
@@ -53,13 +53,6 @@ protected:
   virtual bool ok () const;

 private:
-  /* used by try_process */
-  void set_busy (SCM);
-  bool busy_;
-  bool notice_busy_;
-
-  bool try_process (Music_iterator *i, Moment m);
-
   Music_iterator *first_iter_;
   Music_iterator *second_iter_;
   Moment start_moment_;
@@ -82,8 +75,6 @@ private:
   // e.g. 1 for Solo I, 2 for Solo II.
   int chosen_part_;

-  int last_playing_;
-
   /*
     TODO: this is getting off hand...
   */
@@ -108,15 +99,6 @@ Part_combine_iterator::do_quit ()
     first_iter_->quit ();
   if (second_iter_)
     second_iter_->quit ();
-
-  // Add listeners to all contexts except Devnull.
-  for (int i = 0; i < NUM_OUTLETS; i++)
-    {
-      Context *c = handles_[i].get_context ();
-      if (c->is_alias (ly_symbol2scm ("Voice")))
- c->event_source ()->remove_listener (GET_LISTENER (Part_combine_iterator, set_busy), ly_symbol2scm ("music-event"));
-      handles_[i].set_context (0);
-    }
 }

 Part_combine_iterator::Part_combine_iterator ()
@@ -128,10 +110,6 @@ Part_combine_iterator::Part_combine_iterator ()
   split_list_ = SCM_EOL;
   state_ = APART;
   chosen_part_ = 1;
-  last_playing_ = 0;
-
-  busy_ = false;
-  notice_busy_ = false;
 }

 void
@@ -297,8 +275,6 @@ Part_combine_iterator::construct_children ()
/* find context below c: otherwise we may create new staff for each voice */
       c = c->find_create_context (type, outlet_names_[i], SCM_EOL);
       handles_[i].set_context (c);
-      if (c->is_alias (ly_symbol2scm ("Voice")))
- c->event_source ()->add_listener (GET_LISTENER (Part_combine_iterator, set_busy), ly_symbol2scm ("music-event"));
     }

   SCM lst = get_music ()->get_property ("elements");
@@ -313,34 +289,6 @@ Part_combine_iterator::construct_children ()
 }

 void
-Part_combine_iterator::set_busy (SCM se)
-{
-  if (!notice_busy_)
-    return;
-
-  Stream_event *e = Stream_event::unsmob (se);
-
- if (e->in_event_class ("note-event") || e->in_event_class ("cluster-note-event"))
-    busy_ = true;
-}
-
-/*
-  Processes a moment in an iterator, and returns whether any new music
-  was reported.
-*/
-bool
-Part_combine_iterator::try_process (Music_iterator *i, Moment m)
-{
-  busy_ = false;
-  notice_busy_ = true;
-
-  i->process (m);
-
-  notice_busy_ = false;
-  return busy_;
-}
-
-void
 Part_combine_iterator::process (Moment m)
 {
   Moment now = get_outlet ()->now_mom ();
@@ -372,12 +320,12 @@ Part_combine_iterator::process (Moment m)
         {
// Continue to use the most recently used part because we might have
           // killed mmrests in the other part.
-          unisono (false, (last_playing_ == 2) ? 2 : 1);
+          unisono (false, (chosen_part_ == 2) ? 2 : 1);
         }
       else if (scm_is_eq (tag, ly_symbol2scm ("unisilence")))
         {
           // as for unisono
-          unisono (true, (last_playing_ == 2) ? 2 : 1);
+          unisono (true, (chosen_part_ == 2) ? 2 : 1);
         }
       else if (scm_is_eq (tag, ly_symbol2scm ("silence1")))
         unisono (true, 1);
@@ -400,16 +348,10 @@ Part_combine_iterator::process (Moment m)
     }

   if (first_iter_->ok ())
-    {
-      if (try_process (first_iter_, m))
-        last_playing_ = 1;
-    }
+    first_iter_->process (m);

   if (second_iter_->ok ())
-    {
-      if (try_process (second_iter_, m))
-        last_playing_ = 2;
-    }
+    second_iter_->process (m);
 }

 IMPLEMENT_CTOR_CALLBACK (Part_combine_iterator);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]