X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmusic.cc;h=fb272aae0372af067db72aeef159af97d50271dd;hb=d074a270e77c60df45914e7442bcc89d68119cdc;hp=4d71d99d98e6bfd8069936ccd88600834d563d3b;hpb=0fee6eb672cef04454e02856412f9bcea3f4115b;p=lilypond.git diff --git a/lily/music.cc b/lily/music.cc index 4d71d99d98..fb272aae03 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -16,7 +16,6 @@ #include "ly-smobs.icc" #include "main.hh" #include "music-sequence.hh" -#include "pitch.hh" #include "score.hh" #include "warn.hh" @@ -253,23 +252,9 @@ Music::origin () const Stream_event * Music::to_event () const { - /* UGH. Temp hack */ - SCM orig_sym = get_property ("name"); - char out[200]; - string in = ly_symbol2string (orig_sym); - /* don't add '-' before first character */ - out[0] = tolower (in[0]); - size_t outpos = 1; - for (size_t inpos = 1; inpos < in.size () && outpos < 190; inpos++) - { - if (isupper (in[inpos])) - out[outpos++] = '-'; - out[outpos++] = tolower (in[inpos]); - } - out[outpos] = 0; - SCM class_name = ly_symbol2scm (out); + SCM class_name = ly_camel_case_to_lisp_identifier (get_property ("name")); - // catch mistakes. + // catch programming mistakes. if (!internal_is_music_type (class_name)) { programming_error ("Not a music type"); @@ -280,24 +265,32 @@ Music::to_event () const if (length.to_bool ()) e->set_property ("length", length.smobbed_copy ()); + // articulations as events. + SCM art_mus = e->get_property ("articulations"); + if (scm_is_pair (art_mus)) + { + SCM art_ev = SCM_EOL; + for (; scm_is_pair (art_mus); art_mus = scm_cdr (art_mus)) + { + Music *m = unsmob_music (scm_car (art_mus)); + SCM ev = m ? m->to_event ()->unprotect () : scm_car (art_mus); + art_ev = scm_cons (ev, art_ev); + } + e->set_property ("articulations", scm_reverse_x (art_ev, SCM_EOL)); + } + /* ES TODO: This is a temporary fix. Stream_events should not be aware of music. */ e->set_property ("music-cause", self_scm ()); + return e; } void Music::send_to_context (Context *c) { - /* - TODO: This is a work-in-progress solution. Send the event so it - can be read both by old-style translators and the new ones. - */ - send_stream_event (c, "OldMusicEvent", origin (), - ly_symbol2scm("music"), self_scm (), 0); - Stream_event *ev = to_event (); c->event_source ()->broadcast (ev); ev->unprotect ();