]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/pitch-scheme.cc
Fix define-markup error messages
[lilypond.git] / lily / pitch-scheme.cc
index 12ddddf10a1c9b71e729622fc0be5c64a5feda5d..1ecc247ed13911110dfccf21463d739a718d0fe3 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "pitch.hh"
@@ -25,10 +25,11 @@ LY_DEFINE (ly_pitch_transpose, "ly:pitch-transpose",
 LY_DEFINE (ly_make_pitch, "ly:make-pitch",
           2, 1, 0, (SCM octave, SCM note, SCM alter),
           "@var{octave} is specified by an integer, zero for the octave"
-          " containing middle@tie{}C.  @var{note} is a number from 0"
-          " to@tie{}6, with 0 corresponding to pitch@tie{}C and 6"
-          " corresponding to pitch@tie{}B.  @var{alter} is a rational"
-          " number of whole tones for alteration.")
+          " containing middle@tie{}C. @var{note} is a number indexing the"
+          " global default scale, with 0 corresponding to pitch@tie{}C"
+          " and 6 usually corresponding to pitch@tie{}B. @var{alter} is" 
+          " a rational number of 200-cent whole tones for alteration.")
+
 {
   LY_ASSERT_TYPE (scm_is_integer, octave, 1);
   LY_ASSERT_TYPE (scm_is_integer, note, 2);
@@ -142,3 +143,21 @@ LY_DEFINE (ly_pitch_diff, "ly:pitch-diff",
 
   return pitch_interval (*r, *p).smobbed_copy ();
 }
+
+/* FIXME: probably isn't the right place for this function */
+#include "context.hh"
+LY_DEFINE (ly_set_middle_C_x, "ly:set-middle-C!",
+          1, 0, 0, (SCM context),
+          "Set the @code{middleCPosition} variable in @var{context}"
+          " based on the variables @code{middleCClefPosition} and"
+          " middleCOffset.")
+{
+  LY_ASSERT_SMOB (Context, context, 1);
+
+  Context *c = unsmob_context (context);
+  int clef_pos = robust_scm2int (c->get_property ("middleCClefPosition"), 0);
+  int offset = robust_scm2int (c->get_property ("middleCOffset"), 0);
+
+  c->set_property (ly_symbol2scm ("middleCPosition"), scm_from_int (clef_pos + offset));
+  return SCM_UNDEFINED;
+}