X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fquote-iterator.cc;h=dead1d503e25466cf3e6dbe541f74662a11e244f;hb=6f664e0e318a1651f6fe9317a842bf9c7f476f08;hp=f0a2d46e6b1c9d92e8601394a48dde20b6825182;hpb=83a7a46410c472fadec6ec8eac6de170fef6288b;p=lilypond.git diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc index f0a2d46e6b..dead1d503e 100644 --- a/lily/quote-iterator.cc +++ b/lily/quote-iterator.cc @@ -9,11 +9,13 @@ #include "music-wrapper-iterator.hh" #include "context.hh" +#include "dispatcher.hh" #include "input.hh" #include "international.hh" #include "lily-guile.hh" #include "music-sequence.hh" #include "music.hh" +#include "stream-event.hh" #include "warn.hh" class Quote_iterator : public Music_wrapper_iterator @@ -33,7 +35,7 @@ public: DECLARE_SCHEME_CALLBACK (constructor, ()); bool quote_ok () const; - bool accept_music_type (Music *) const; + bool accept_music_type (Stream_event *) const; protected: virtual void derived_mark () const; @@ -52,16 +54,14 @@ Quote_iterator::do_quit () } bool -Quote_iterator::accept_music_type (Music *mus) const +Quote_iterator::accept_music_type (Stream_event *ev) const { - SCM accept = get_outlet ()->get_property ("quotedEventTypes"); - for (SCM s = mus->get_property ("types"); - scm_is_pair (s); s = scm_cdr (s)) + for (SCM accept = get_outlet ()->get_property ("quotedEventTypes"); + scm_is_pair (accept); accept = scm_cdr (accept)) { - if (scm_memq (scm_car (s), accept) != SCM_BOOL_F) + if (ev->internal_in_event_class (scm_car (accept))) return true; } - return false; } @@ -222,17 +222,20 @@ Quote_iterator::process (Moment m) /* The pitch that sounds like central C */ - Pitch *me_pitch = unsmob_pitch (get_outlet ()->get_property ("instrumentTransposition")); + Pitch *me_pitch = unsmob_pitch (get_music ()->get_property ("quoted-transposition")); + if (!me_pitch) + me_pitch = unsmob_pitch (get_outlet ()->get_property ("instrumentTransposition")); for (SCM s = scm_cdr (entry); scm_is_pair (s); s = scm_cdr (s)) { SCM ev_acc = scm_car (s); - Music *mus = unsmob_music (scm_car (ev_acc)); - if (!mus) + Stream_event *ev = unsmob_stream_event (scm_car (ev_acc)); + if (!ev) programming_error ("no music found in quote"); - else if (accept_music_type (mus)) + else if (accept_music_type (ev)) { + /* create a transposed copy if necessary */ if (quote_pitch || me_pitch) { Pitch qp, mp; @@ -243,17 +246,11 @@ Quote_iterator::process (Moment m) Pitch diff = pitch_interval (qp, mp); - SCM copy = ly_music_deep_copy (mus->self_scm ()); - mus = unsmob_music (copy); - - transposed_musics_ = scm_cons (copy, transposed_musics_); - mus->transpose (diff); + SCM props = transpose_mutable (ev->get_property_alist (true), diff); + ev = new Stream_event (ev->get_property ("class"), props); + transposed_musics_ = scm_cons (ev->unprotect (), transposed_musics_); } - - bool b = quote_outlet_.get_outlet ()->try_music (mus); - if (!b) - mus->origin ()->warning (_f ("in quotation: junking event %s", - mus->name ())); + quote_outlet_.get_outlet ()->event_source ()->broadcast (ev); } }