X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpitch.cc;h=bc8a9e45a6cd9b8467ecc3af1344deed84da3998;hb=f46ef55979a0f3eabb877f7405376d5ee9192331;hp=880dc79edfdb4339ab99dba99d54d11338a32f92;hpb=8f5cd22af76fcb5c77853a5ede8b94ebef97caef;p=lilypond.git diff --git a/lily/pitch.cc b/lily/pitch.cc index 880dc79edf..bc8a9e45a6 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998--2006 Han-Wen Nienhuys + (c) 1998--2007 Han-Wen Nienhuys */ #include "pitch.hh" @@ -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 ()]; @@ -119,7 +123,7 @@ Pitch::normalize () alteration_ = Rational (0); alteration_ -= tone_pitch () - pitch; } - while (alteration_ < Rational(-1)) + while (alteration_ < Rational (-1)) { if (notename_ == 0) { @@ -168,10 +172,10 @@ Pitch::to_string () const { int n = (notename_ + 2) % scale_->step_tones_.size (); string s = ::to_string (char (n + 'a')); - Rational qtones = alteration_ * Rational (4,1); - int qt = int (rint (Real (qtones))); + Rational qtones = alteration_ * Rational (4,1); + int qt = int (rint (Real (qtones))); - s += string (accname[qt + 4]); + s += string (accname[qt + 4]); if (octave_ >= 0) { int o = octave_ + 1; @@ -245,7 +249,7 @@ Pitch::print_smob (SCM s, SCM port, scm_print_state *) { Pitch *r = (Pitch *) SCM_CELL_WORD_1 (s); scm_puts ("#to_string ().c_str ()), port); + scm_display (ly_string2scm (r->to_string ()), port); scm_puts (" >", port); return 1; } @@ -302,7 +306,9 @@ Pitch::transposed (Pitch d) const return p; } +Rational NATURAL_ALTERATION (0); Rational FLAT_ALTERATION (-1, 2); +Rational DOUBLE_FLAT_ALTERATION (-1); Rational SHARP_ALTERATION (1, 2); Pitch