#include "music.hh"
#include "music-list.hh"
#include "debug.hh"
-#include "musical-pitch.hh"
+#include "pitch.hh"
#include "ly-smobs.icc"
SCM
{
if (unsmob_music (m))
{
- return unsmob_music (m)->clone ()->self_scm_;
+ SCM ss = unsmob_music (m)->clone ()->self_scm ();
+ scm_unprotect_object (ss);
+ return ss;
}
else if (gh_pair_p (m))
{
- return gh_cons (ly_deep_copy (gh_car (m)), ly_deep_copy (gh_cdr (m)));
+ return gh_cons (ly_deep_mus_copy (gh_car (m)), ly_deep_mus_copy (gh_cdr (m)));
}
else
return m;
Music::Music (Music const &m)
{
- self_scm_ = SCM_EOL;
immutable_property_alist_ = m.immutable_property_alist_;
SCM c =ly_deep_mus_copy (m.mutable_property_alist_);
mutable_property_alist_ = c;
Music::Music()
{
- self_scm_ = SCM_EOL;
immutable_property_alist_ = SCM_EOL;
mutable_property_alist_ = SCM_EOL;
smobify_self ();
SCM
Music::mark_smob (SCM m)
{
- Music * mus = SMOB_TO_TYPE (Music, m);
+ Music * mus = (Music *)SCM_CELL_WORD_1(m);
scm_gc_mark (mus->immutable_property_alist_);
scm_gc_mark (mus->mutable_property_alist_);
- return mus->do_derived_mark ();
+ return SCM_EOL;
}
void
{
}
-void
-Music::do_print() const
-{
-}
+
Moment
Music::length_mom () const
{
+ SCM l = get_mus_property ("length");
+ if (unsmob_moment (l))
+ return *unsmob_moment(l);
+ else if (gh_procedure_p (l))
+ {
+ SCM res = gh_call1(l, self_scm( ));
+ return *unsmob_moment(res);
+ }
+
return 0;
}
return 1;
}
-Musical_pitch
-Music::to_relative_octave (Musical_pitch m)
+Pitch
+Music::to_relative_octave (Pitch m)
{
return m;
}
void
-Music::transpose (Musical_pitch )
+Music::transpose (Pitch )
{
}
IMPLEMENT_UNSMOB(Music,music);
IMPLEMENT_SMOBS(Music);
+IMPLEMENT_DEFAULT_EQUAL_P(Music);
/****************************/
return ip ? ip : & dummy_input_global;
}
-SCM
-Music::do_derived_mark ()
+
+
+
+
+Music::~Music ()
{
- return SCM_EOL;
+
}
-void
-Music::print ()const
+SCM
+ly_get_mus_property (SCM mus, SCM sym)
{
+ Music * sc = unsmob_music (mus);
+
+ if (sc)
+ {
+ return sc->get_mus_property (sym);
+ }
+ else
+ {
+ warning (_("ly_get_mus_property (): Not a Music"));
+ scm_write (mus, scm_current_error_port ());
+ }
+ return SCM_EOL;
}
-void
-Music::do_smobify_self ()
+
+SCM
+ly_set_mus_property (SCM mus, SCM sym, SCM val)
{
+ Music * sc = unsmob_music (mus);
+
+ if (!gh_symbol_p (sym))
+ {
+ warning (_("ly_set_mus_property (): Not a symbol"));
+ scm_write (mus, scm_current_error_port ());
+
+ return SCM_UNSPECIFIED;
+ }
+
+ if (sc)
+ {
+ sc->set_mus_property (sym, val);
+ }
+ else
+ {
+ warning (_("ly_set_mus_property (): not of type Music"));
+ scm_write (mus, scm_current_error_port ());
+ }
+
+ return SCM_UNSPECIFIED;
}
-Music::~Music ()
+static void
+init_functions ()
{
-
+ scm_make_gsubr ("ly-get-mus-property", 2, 0, 0, (Scheme_function_unknown)ly_get_mus_property);
+ scm_make_gsubr ("ly-set-mus-property", 3, 0, 0, (Scheme_function_unknown)ly_set_mus_property);
}
+ADD_SCM_INIT_FUNC(musicscm,init_functions);