lilypond-user
[Top][All Lists]
Advanced

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

Rebroadcasting events from a single timestep


From: address@hidden
Subject: Rebroadcasting events from a single timestep
Date: Thu, 16 Jun 2011 11:01:18 +0200

Hey all,

I am working on a piece now where I need certain events to transmogrify into 
other events.  Specifically, whole-measure rests need to turn into 
multi-measure rests, and given the way that the piece is algorithmically 
generated, it would take a lot of time for me to change all of the `r' to `R' 
when this is the case.  I'd like to add a bit to rest-engraver.cc in the spirit 
of :

  if (to_boolean (get_property ("lazyMultiMeasureRests"))
      && (unsmob_moment (get_property ("measurePosition"))->main_part_ == 
Rational(0,0))
      && (unsmob_moment (get_property ("measureLength"))->main_part_ == 
unsmob_moment (rest_event_->get_property ("length"))->main_part_))
    {
      Stream_event *mmrest_event_ = new Stream_event (ly_symbol2scm 
("multi-measure-rest-event"));
      mmrest_event_->set_property ("duration", rest_event_->get_property 
("duration"));
      mmrest_event_->set_property ("length", rest_event_->get_property 
("length"));
      mmrest_event_->set_property ("duration-log", rest_event_->get_property 
("duration-log"));
      mmrest_event_->unprotect ();
      context ()->event_source ()->broadcast (mmrest_event_);
      return;
    }

However, when I do this, it does not seem that the multi-measure-rest-engraver 
hears the broadcast info.
I'm guessing this has something to do with how/when/where events are broadcasts 
in the grand scheme of things, but I'm not sure.  I see things called iterators 
in the source that may be valuable for this type of hack, but I have no clue 
how they work.  Any ideas on how to accomplish this sorta thing?

Cheers,
MS




reply via email to

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