]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #368
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 8 Jun 2007 02:14:04 +0000 (23:14 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 8 Jun 2007 02:14:04 +0000 (23:14 -0300)
Use tone_pitch() for ordering pitches.

input/regression/ambitus-pitch-ordering.ly [new file with mode: 0644]
lily/include/pitch-interval.hh
lily/pitch-interval.cc
lily/pitch.cc

diff --git a/input/regression/ambitus-pitch-ordering.ly b/input/regression/ambitus-pitch-ordering.ly
new file mode 100644 (file)
index 0000000..d56c533
--- /dev/null
@@ -0,0 +1,13 @@
+\header {
+  texidoc = "Ambituses use actual pitch not lexicographic ordering."
+  }
+
+\version "2.10.25"
+
+\paper {
+  ragged-right=##t
+}
+
+\new Voice \with { \consists "Ambitus_engraver" } {
+  \clef F c eis fes
+}
index ab8b51eddea35ec20853c5b4c2df9a89144eee67..947e418ea0f10bfeccc7b83dcab614706f642284 100644 (file)
@@ -20,4 +20,13 @@ public:
   bool is_empty () const;
 };
 
+class Pitch_lexicographic_interval : public Drul_array<Pitch>
+{
+public:
+  Pitch_lexicographic_interval ();
+  Pitch_lexicographic_interval (Pitch, Pitch);
+  void add_point (Pitch);
+  bool is_empty () const;
+};
+
 #endif /* PITCH_INTERVAL_HH */
index 064c6343275974e0fafbd790e1fc30f9a36d8b0a..f871e7e185b000df6cb1dfd8f6010a3e2c1fbfaa 100644 (file)
@@ -30,6 +30,34 @@ Pitch_interval::is_empty () const
 
 void
 Pitch_interval::add_point (Pitch p)
+{
+  if (at (LEFT).tone_pitch () > p.tone_pitch ())
+    at (LEFT) = p;
+  if (at (RIGHT).tone_pitch () < p.tone_pitch ())
+    at (RIGHT) = p;
+}
+
+
+Pitch_lexicographic_interval::Pitch_lexicographic_interval (Pitch p1, Pitch p2)
+{
+  at (LEFT) = p1;
+  at (RIGHT) = p2;
+}
+
+Pitch_lexicographic_interval::Pitch_lexicographic_interval ()
+{
+  at (LEFT) = Pitch (100, 0, 0);
+  at (RIGHT) = Pitch (-100, 0, 0);
+}
+
+bool
+Pitch_lexicographic_interval::is_empty () const
+{
+  return at (LEFT) > at (RIGHT);
+}
+
+void
+Pitch_lexicographic_interval::add_point (Pitch p)
 {
   if (at (LEFT) > p)
     at (LEFT) = p;
index fa68b2d1bab2a4041653d2148648b4bc5dd00658..bc8a9e45a6cd9b8467ecc3af1344deed84da3998 100644 (file)
@@ -67,6 +67,10 @@ Pitch::tone_pitch () const
       o--;
     }
 
+  /*
+    we're effictively hardcoding the octave to 6 whole-tones,
+    which is as arbitrary as coding it to 1200 cents
+  */
   Rational tones ((o + n / scale_->step_tones_.size ()) * 6, 1);
   tones += scale_->step_tones_[n % scale_->step_tones_.size ()];