]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/music.cc
* lily/music.cc (name): bugfix
[lilypond.git] / lily / music.cc
index d95603ad81cb5f1241dd01820ddc260b479f84cb..ba6e8ce3c5f94393fe6f953a3125a710fdd6180c 100644 (file)
@@ -39,6 +39,20 @@ Music::internal_is_music_type (SCM k)const
   return scm_memq (k, ifs) != SCM_BOOL_F;
 }
 
+String
+Music::name () const
+{
+  SCM nm = get_mus_property ("name");
+  if (gh_symbol_p (nm))
+    {
+      return ly_symbol2string (nm);
+    }
+  else
+    {
+      return classname (this);
+    }
+}
+
 void
 Music::transpose (Pitch)
 {
@@ -90,7 +104,7 @@ Music::mark_smob (SCM m)
 }
 
 Moment
-Music::length_mom () const
+Music::get_length () const
 {
   SCM l = get_mus_property ("length");
   if (unsmob_moment (l))
@@ -154,7 +168,7 @@ Music::to_relative_octave (Pitch m)
 }
 
 
-IMPLEMENT_TYPE_P (Music, "music?");
+IMPLEMENT_TYPE_P (Music, "ly:music?");
 
 IMPLEMENT_SMOBS (Music);
 IMPLEMENT_DEFAULT_EQUAL_P (Music);
@@ -206,7 +220,7 @@ Music::~Music ()
 }
 
 LY_DEFINE(ly_get_mus_property,
-         "ly-get-mus-property", 2, 0, 0,  (SCM mus, SCM sym),
+         "ly:get-mus-property", 2, 0, 0,  (SCM mus, SCM sym),
          "Get the property @var{sym} of music expression @var{mus}.")
 {
   Music * sc = unsmob_music (mus);
@@ -217,7 +231,7 @@ LY_DEFINE(ly_get_mus_property,
 }
 
 LY_DEFINE(ly_set_mus_property,
-         "ly-set-mus-property!", 3, 0, 0,
+         "ly:set-mus-property!", 3, 0, 0,
          (SCM mus, SCM sym, SCM val),
          "Set property @var{sym} in music expression @var{mus} to @var{val}.")
 {
@@ -235,7 +249,7 @@ LY_DEFINE(ly_set_mus_property,
 }
 
 
-LY_DEFINE(ly_music_name, "ly-music-name", 1, 0, 0, 
+LY_DEFINE(ly_music_name, "ly:music-name", 1, 0, 0, 
   (SCM mus),
   "Return the name of @var{music}.")
 {
@@ -250,17 +264,16 @@ LY_DEFINE(ly_music_name, "ly-music-name", 1, 0, 0,
 
 // to do  property args 
 LY_DEFINE(ly_extended_make_music,
-         "ly-make-bare-music", 2, 0, 0,  (SCM type, SCM props),
-         "
-Make a music object/expression of type @var{type}, init with
-@var{props}. Warning: this interface will likely change in the near
-future.
-
-Music is the data type that music expressions are stored in. The data
-type does not yet offer many manipulations.
-
-WARNING: deprecated; use make-music-by-name. 
-")
+         "ly:make-bare-music", 2, 0, 0,  (SCM type, SCM props),
+         "Make a music object/expression of type @var{type}, init with\n"
+"@var{props}. Warning: this interface will likely change in the near\n"
+"future.\n"
+"\n"
+"Music is the data type that music expressions are stored in. The data\n"
+"type does not yet offer many manipulations.\n"
+"\n"
+"WARNING: only for internal use. Please use make-music-by-name. \n"
+)
 {
   SCM_ASSERT_TYPE(gh_string_p (type), type, SCM_ARG1, __FUNCTION__, "string");
 
@@ -270,6 +283,20 @@ WARNING: deprecated; use make-music-by-name.
   return s;
 }
 
+// to do  property args 
+LY_DEFINE(ly_get_mutable_properties,
+         "ly:get-mutable-properties", 1, 0, 0,  (SCM mus),
+"Return an alist signifying the mutable properties of @var{mus}.\n"
+"The immutable properties are not available; they should be initialized\n"
+"by the functions make-music-by-name function.\n"
+)
+{
+  Music *m = unsmob_music (mus);
+  SCM_ASSERT_TYPE(m, mus, SCM_ARG1, __FUNCTION__, "music");
+
+  return m->get_property_alist (true);
+}
+
 LY_DEFINE(ly_music_list_p,"music-list?", 1, 0, 0, 
   (SCM l),"Type predicate: return true if @var{l} is a list of music objects.")
 {