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 */
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;
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 ()];