}
}
-Music::Music ()
+Music::Music (SCM init)
{
self_scm_ = SCM_EOL;
- immutable_property_alist_ = SCM_EOL;
+ immutable_property_alist_ = init;
mutable_property_alist_ = SCM_EOL;
smobify_self ();
+
+ length_callback_ = get_property ("length-callback");
+ start_callback_ = get_property ("start-callback");
}
Music::Music (Music const &m)
that they won't be protected from GC. */
smobify_self ();
mutable_property_alist_ = ly_music_deep_copy (m.mutable_property_alist_);
+ length_callback_ = m.length_callback_;
+ start_callback_ = m.start_callback_;
set_spot (*m.origin ());
}
SCM lst = get_property ("length");
if (unsmob_moment (lst))
return *unsmob_moment (lst);
- else if (ly_c_procedure_p (lst))
+
+ if (ly_c_procedure_p (length_callback_))
{
- SCM res = scm_call_1 (lst, self_scm ());
+ SCM res = scm_call_1 (length_callback_, self_scm ());
return *unsmob_moment (res);
}
- return 0;
+ return Moment(0);
}
Moment
Music::start_mom () const
{
- SCM lst = get_property ("start-moment-function");
+ SCM lst = get_property ("start-callback");
if (ly_c_procedure_p (lst))
{
SCM res = scm_call_1 (lst, self_scm ());
m->compress (factor);
compress_music_list (get_property ("elements"), factor);
+ Duration *d = unsmob_duration (get_property ("duration"));
+ if (d)
+ set_property ("duration", d ->compressed (factor.main_part_).smobbed_copy ());
}
void
Music::transpose (Pitch delta)
{
+ if (to_boolean (get_property ("untransposable")))
+ return ;
+
for (SCM s = this->get_property_alist (true); scm_is_pair (s); s = scm_cdr (s))
{
SCM entry = scm_car (s);
if (abs (transposed.get_alteration ()) > DOUBLE_SHARP)
{
- warning (_f ("Transposition by %s makes alteration larger than two",
+ warning (_f ("Transposition by %s makes alteration larger than double",
delta.to_string ()));
}
}
void
Music::internal_set_property (SCM s, SCM v)
{
- if (internal_type_checking_global_b)
+ if (do_internal_type_checking_global)
if (!type_check_assignment (s, v, ly_symbol2scm ("music-type?")))
abort ();