#include "music-sequence.hh"
#include "score.hh"
#include "warn.hh"
+#include "lily-imports.hh"
/*
Music is anything that has (possibly zero) duration and supports
SCM
Music::copy_mutable_properties () const
{
- return ly_music_deep_copy (mutable_property_alist_);
+ return music_deep_copy (mutable_property_alist_);
}
void
programming_error ("Not a music type");
Stream_event *e = new Stream_event
- (scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), class_name),
+ (Lily::ly_make_event_class (class_name),
mutable_property_alist_);
Moment length = get_length ();
if (length.to_bool ())
Music *
make_music_by_name (SCM sym)
{
- SCM make_music_proc = ly_lily_module_constant ("make-music");
- SCM rv = scm_call_1 (make_music_proc, sym);
+ SCM rv = Lily::make_music (sym);
/* UGH. */
Music *m = unsmob<Music> (rv);
mom = d->get_length ();
return mom.smobbed_copy ();
}
+
+SCM
+music_deep_copy (SCM m)
+{
+ if (Music *mus = unsmob<Music> (m))
+ return mus->clone ()->unprotect ();
+ if (scm_is_pair (m))
+ {
+ SCM copy = SCM_EOL;
+ do
+ {
+ copy = scm_cons (music_deep_copy (scm_car (m)), copy);
+ m = scm_cdr (m);
+ }
+ while (scm_is_pair (m));
+ // Oh, come on, GUILE. Why do you require the second argument
+ // of scm_reverse_x to be a proper list? That makes no sense.
+ // return scm_reverse_x (copy, music_deep_copy (m));
+ SCM last_cons = copy;
+ copy = scm_reverse_x (copy, SCM_EOL);
+ scm_set_cdr_x (last_cons, music_deep_copy (m));
+ return copy;
+ }
+ return m;
+}
+
+void
+set_origin (SCM m, SCM origin)
+{
+ while (scm_is_pair (m))
+ {
+ set_origin (scm_car (m), origin);
+ m = scm_cdr (m);
+ }
+ if (Music *mus = unsmob<Music> (m))
+ mus->set_property ("origin", origin);
+}