]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/duration-scheme.cc
Merge branch 'master' of git://git.sv.gnu.org/lilypond
[lilypond.git] / lily / duration-scheme.cc
index 6f1ea4ef908b5336be9ade2c059b38d95363ce5d..361036256d3642d70328db3614eda2f471f43615 100644 (file)
@@ -53,13 +53,13 @@ LY_DEFINE (ly_make_duration, "ly:make-duration",
           "(whole, half, quarter, etc.) and a number of augmentation\n"
           "dots. \n")
 {
-  SCM_ASSERT_TYPE (scm_integer_p (length) == SCM_BOOL_T,
+  SCM_ASSERT_TYPE (scm_is_integer (length),
                   length, SCM_ARG1, __FUNCTION__, "integer");
 
   int dots = 0;
   if (dotcount != SCM_UNDEFINED)
     {
-      SCM_ASSERT_TYPE (scm_integer_p (dotcount) == SCM_BOOL_T,
+      SCM_ASSERT_TYPE (scm_is_integer (dotcount),
                       dotcount, SCM_ARG2, __FUNCTION__, "integer");
       dots = scm_to_int (dotcount);
     }
@@ -113,6 +113,14 @@ LY_DEFINE (ly_intlog2, "ly:intlog2",
   return scm_from_int (log);
 }
 
+LY_DEFINE (ly_duration_length, "ly:duration-length",
+          1, 0, 0, (SCM dur),
+          "The length of the duration as a Moment.")
+{
+  SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration");
+  return Moment (unsmob_duration (dur)->get_length ()).smobbed_copy ();
+}
+
 LY_DEFINE (ly_duration_factor, "ly:duration-factor",
           1, 0, 0, (SCM dur),
           "Extract the compression factor from @var{dur}. Return as a pair.")