]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/pitch.cc
release commit
[lilypond.git] / lily / pitch.cc
index 04d7d6c127a00f191f4466ad00d709ff6a67138b..5dc46f97e6770f3a68b687418dc08a0d88951656 100644 (file)
@@ -20,6 +20,7 @@ Pitch::Pitch (int o, int n, int a)
   normalise ();
 }
 
+/* FIXME: why is octave == 0 and default not middleC ? */
 Pitch::Pitch ()
 {
   notename_ = 0;
@@ -235,7 +236,7 @@ Pitch::down_to (int notename)
 LY_DEFINE (ly_pitch_transpose, "ly:pitch-transpose",
           2, 0, 0, (SCM p, SCM delta),
           "Transpose @var{p} by the amount @var{delta}, "
-          "where @var{delta} is the pitch that middle C is transposed to.")
+          "where @var{delta} is relative to middle C.")
 {
   Pitch* t = unsmob_pitch (p);
   Pitch *d = unsmob_pitch (delta);
@@ -290,7 +291,7 @@ Pitch::less_p (SCM p1, SCM p2)
 }
 
 /* Should add optional args.  */
-LY_DEFINE (make_pitch, "ly:make-pitch",
+LY_DEFINE (ly_make_pitch, "ly:make-pitch",
           3, 0, 0, (SCM octave, SCM note, SCM alter),
           "@var{octave} is specified by an integer, "
           "zero for the octave containing middle C.  "
@@ -303,74 +304,73 @@ LY_DEFINE (make_pitch, "ly:make-pitch",
   SCM_ASSERT_TYPE (scm_integer_p (note)== SCM_BOOL_T, note, SCM_ARG2, __FUNCTION__, "integer");
   SCM_ASSERT_TYPE (scm_integer_p (alter)== SCM_BOOL_T, alter, SCM_ARG3, __FUNCTION__, "integer");
 
-  Pitch p (gh_scm2int (octave), gh_scm2int (note), gh_scm2int (alter));
+  Pitch p (scm_to_int (octave), scm_to_int (note), scm_to_int (alter));
   return p.smobbed_copy ();
 }
 
-LY_DEFINE (pitch_steps, "ly:pitch-steps", 1, 0, 0,
+LY_DEFINE (ly_pitch_steps, "ly:pitch-steps", 1, 0, 0,
           (SCM p),
           "Number of steps counted from middle C of the pitch @var{p}.")
 {
   Pitch *pp = unsmob_pitch (p);
   SCM_ASSERT_TYPE (pp, p, SCM_ARG1, __FUNCTION__, "Pitch");
-  return gh_int2scm (pp->steps ());
+  return scm_int2num (pp->steps ());
 }
 
-LY_DEFINE (pitch_octave, "ly:pitch-octave",
+LY_DEFINE (ly_pitch_octave, "ly:pitch-octave",
           1, 0, 0, (SCM pp),
-          "extract the octave from pitch @var{p}.")
+          "Extract the octave from pitch @var{p}.")
 {
   Pitch *p = unsmob_pitch (pp);
   SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
   int q = p->get_octave ();
-  return gh_int2scm (q);
+  return scm_int2num (q);
 }
 
-LY_DEFINE (pitch_alteration, "ly:pitch-alteration",
+LY_DEFINE (ly_pitch_alteration, "ly:pitch-alteration",
           1, 0, 0, (SCM pp),
-          "extract the alteration from pitch  @var{p}.")
+          "Extract the alteration from pitch  @var{p}.")
 {
   Pitch *p = unsmob_pitch (pp);
   SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
   int q = p->get_alteration ();
 
-  return gh_int2scm (q);
+  return scm_int2num (q);
 }
 
 LY_DEFINE (pitch_notename, "ly:pitch-notename",
           1, 0, 0, (SCM pp),
-          "extract the note name from pitch  @var{pp}.")
+          "Extract the note name from pitch  @var{pp}.")
 {
   Pitch *p = unsmob_pitch (pp);
   SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
   int q = p->get_notename ();
-  return gh_int2scm (q);
+  return scm_int2num (q);
 }
 
-LY_DEFINE (ly_pitch_quartertones,  "ly:pitch-quartertones",
+LY_DEFINE (ly_pitch_quartertones, "ly:pitch-quartertones",
           1, 0, 0, (SCM pp),
-          "calculate the number of semitones of @var{p} from middle C.")
+          "Calculate the number of quarter tones of @var{p} from middle C.")
 {
   Pitch *p = unsmob_pitch (pp);
   SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
   int q = p->quartertone_pitch ();
-  return gh_int2scm (q);
+  return scm_int2num (q);
 }
 
-LY_DEFINE (ly_pitch_semitones,  "ly:pitch-semitones",
+LY_DEFINE (ly_pitch_semitones, "ly:pitch-semitones",
           1, 0, 0, (SCM pp),
           "calculate the number of semitones of @var{p} from middle C.")
 {
   Pitch *p = unsmob_pitch (pp);
   SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
   int q = p->semitone_pitch ();
-  return gh_int2scm (q);
+  return scm_int2num (q);
 }
 
-LY_DEFINE (pitch_less, "ly:pitch<?",
+LY_DEFINE (ly_pitch_less_p, "ly:pitch<?",
           2, 0, 0, (SCM p1, SCM p2),
-          "Is @var{p1} lower than @var{p2}? "
-          "This uses lexicographic ordening.")
+          "Is @var{p1} lexicographically smaller than @var{p2}?")
 {
   Pitch *a = unsmob_pitch (p1);
   Pitch *b = unsmob_pitch (p2);
@@ -397,15 +397,8 @@ LY_DEFINE (ly_pitch_diff, "ly:pitch-diff",
   return interval (*r, *p).smobbed_copy ();
 }
 
-SCM
-Pitch::smobbed_copy ()const
-{
-  Pitch *p = new Pitch (*this);
-  return p->smobbed_self ();
-}
-
 int
-Pitch::get_octave ()const
+Pitch::get_octave () const
 {
   return octave_;
 }