From: Han-Wen Nienhuys Date: Sun, 24 Dec 2006 02:39:07 +0000 (+0100) Subject: further pitch fixes. X-Git-Tag: release/2.11.5-1~26 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d548c339bc07e4a707c1092507afe2d672e0457d;p=lilypond.git further pitch fixes. --- diff --git a/lily/audio-item.cc b/lily/audio-item.cc index 67d34c6c92..4a3b9d4a41 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -21,7 +21,7 @@ Audio_item::Audio_item () audio_column_ = 0; } -Audio_note::Audio_note (Pitch p, Moment m, bool tie_event, int transposing) +Audio_note::Audio_note (Pitch p, Moment m, bool tie_event, Pitch transposing) { pitch_ = p; length_mom_ = m; diff --git a/lily/drum-note-performer.cc b/lily/drum-note-performer.cc index 7aa463b576..49a8d27001 100644 --- a/lily/drum-note-performer.cc +++ b/lily/drum-note-performer.cc @@ -65,7 +65,7 @@ Drum_note_performer::process_music () } Audio_note *p = new Audio_note (*pit, get_event_length (n), - tie_event, 0); + tie_event, Pitch (0, 0, 0)); Audio_element_info info (p, n); announce_element (info); notes_.push_back (p); diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh index 43009195c3..e6f0c9ad91 100644 --- a/lily/include/audio-item.hh +++ b/lily/include/audio-item.hh @@ -55,13 +55,14 @@ public: class Audio_note : public Audio_item { public: - Audio_note (Pitch p, Moment m, bool tie_event, int transposing); + Audio_note (Pitch p, Moment m, bool tie_event, Pitch transposition); void tie_to (Audio_note *); Pitch pitch_; Moment length_mom_; - int transposing_; + Pitch transposing_; + Audio_note *tied_; bool tie_event_; }; diff --git a/lily/include/pitch.hh b/lily/include/pitch.hh index 0e3be73917..65883d6345 100644 --- a/lily/include/pitch.hh +++ b/lily/include/pitch.hh @@ -53,7 +53,7 @@ public: Rational tone_pitch () const; int rounded_semitone_pitch () const; int rounded_quartertone_pitch () const; - + Pitch negated () const; string to_string () const; DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b)); diff --git a/lily/include/score.hh b/lily/include/score.hh index 71b2037efb..bcd967cda1 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -43,7 +43,6 @@ public: DECLARE_UNSMOB (Score, score); -void default_rendering (SCM, SCM, SCM, SCM, SCM, SCM); SCM ly_render_output (SCM, SCM); SCM ly_run_translator (SCM, SCM, SCM); diff --git a/lily/key-performer.cc b/lily/key-performer.cc index 9bb8b11a48..762e8c4808 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -52,7 +52,7 @@ Key_performer::process_music () Pitch key_do (0, scm_to_int (scm_caar (pitchlist)), - scm_to_int (scm_cdar (pitchlist))); + ly_scm2rational (scm_cdar (pitchlist))); Pitch c_do (0, 0, 0); diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index c1bd368c7f..d6513efd84 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -110,7 +110,7 @@ Key_signature_interface::print (SCM smob) c0p = scm_to_int (c0s); bool is_cancellation = me->internal_has_interface - (ly_symbol2scm ("key-cancelation-interface")); + (ly_symbol2scm ("key-cancellation-interface")); /* SCM lists are stacks, so we work from right to left, ending with diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 10b7f2715c..3fcdb4ca22 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -258,7 +258,8 @@ Midi_note::get_length () const int Midi_note::get_fine_tuning () const { - Rational tune = audio_->pitch_.tone_pitch () * Rational (2); + Rational tune = (audio_->pitch_.tone_pitch () + + audio_->transposing_.tone_pitch ()) * Rational (2); tune -= Rational (get_semitone_pitch ()); tune *= 100; @@ -268,8 +269,8 @@ Midi_note::get_fine_tuning () const int Midi_note::get_semitone_pitch () const { - return int (rint (double (audio_->pitch_.tone_pitch () * Rational (2, 1)))) - + audio_->transposing_; + return int (double ((audio_->pitch_.tone_pitch () + + audio_->transposing_.tone_pitch ()) * Rational (2))); } string diff --git a/lily/note-performer.cc b/lily/note-performer.cc index e5c2ef9e05..a5b4afce87 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -38,11 +38,10 @@ Note_performer::process_music () { if (note_evs_.size ()) { - int transposing = 0; - + Pitch transposing; SCM prop = get_property ("instrumentTransposition"); if (unsmob_pitch (prop)) - transposing = unsmob_pitch (prop)->rounded_semitone_pitch (); + transposing = *unsmob_pitch (prop); while (note_evs_.size ()) { @@ -67,7 +66,7 @@ Note_performer::process_music () } Audio_note *p = new Audio_note (*pitp, get_event_length (n), - tie_event, - transposing); + tie_event, transposing); Audio_element_info info (p, n); announce_element (info); notes_.push_back (p); diff --git a/lily/pitch-scheme.cc b/lily/pitch-scheme.cc index 16b78e9420..e45cd841b7 100644 --- a/lily/pitch-scheme.cc +++ b/lily/pitch-scheme.cc @@ -40,6 +40,15 @@ LY_DEFINE (ly_make_pitch, "ly:make-pitch", return p.smobbed_copy (); } +LY_DEFINE (ly_pitch_negate, "ly:pitch-negate", 1, 0, 0, + (SCM p), + "Negate @var{p}.") +{ + Pitch *pp = unsmob_pitch (p); + SCM_ASSERT_TYPE (pp, p, SCM_ARG1, __FUNCTION__, "Pitch"); + return pp->negated ().smobbed_copy (); +} + 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}.") diff --git a/lily/pitch.cc b/lily/pitch.cc index 4d983ab6d5..880dc79edf 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -304,3 +304,9 @@ Pitch::transposed (Pitch d) const Rational FLAT_ALTERATION (-1, 2); Rational SHARP_ALTERATION (1, 2); + +Pitch +Pitch::negated () const +{ + return pitch_interval (*this, Pitch ()); +} diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc index 849472c329..272f0808ad 100644 --- a/lily/quote-iterator.cc +++ b/lily/quote-iterator.cc @@ -219,7 +219,7 @@ Quote_iterator::process (Moment m) Pitch *quote_pitch = unsmob_pitch (scm_cdar (entry)); /* - The pitch that sounds like central C + The pitch that sounds when written central C is played. */ Pitch *me_pitch = unsmob_pitch (get_music ()->get_property ("quoted-transposition")); if (!me_pitch) @@ -243,7 +243,7 @@ Quote_iterator::process (Moment m) if (me_pitch) mp = *me_pitch; - Pitch diff = pitch_interval (qp, mp); + Pitch diff = pitch_interval (mp, qp); SCM props = transpose_mutable (ev->get_property_alist (true), diff); ev = new Stream_event (ev->get_property ("class"), props); diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 077c965bd5..9baec24ae3 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -599,7 +599,7 @@ as a first or second voice." 'quoted-context-id "cue" 'quoted-music-name what 'quoted-voice-direction dir - 'quoted-transposition (pitch-of-note pitch-note) + 'quoted-transposition (ly:pitch-negate (pitch-of-note pitch-note)) 'origin location)) @@ -610,7 +610,7 @@ transposition = (context-spec-music (make-property-set 'instrumentTransposition - (ly:pitch-diff (ly:make-pitch 0 0 0) (pitch-of-note pitch-note))) + (pitch-of-note pitch-note)) 'Staff )) diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index fe32b4ecd9..16dddf3e7e 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -261,8 +261,9 @@ the @code{instr} property labels following lines.") Function taking a string (instrument name), and returning a (@var{min} . @var{max}) pair of numbers for the loudness range of the instrument. ") (instrumentTransposition ,ly:pitch? "Defines the transposition of -the instrument. Its value is the pitch that sounds like middle C. This -is used to transpose the MIDI output, and @code{\\quote}s.") +the instrument. Its value is the pitch that sounds when the instrument +plays written middle C. This is used to transpose the MIDI output, +and @code{\\quote}s.") (internalBarNumber ,integer? "Contains the current barnumber. This property is used for internal timekeeping, among others by the @code{Accidental_engraver}.") diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm index 7cb6c736e6..f88a7f1159 100644 --- a/scm/define-grob-interfaces.scm +++ b/scm/define-grob-interfaces.scm @@ -62,8 +62,8 @@ '()) (ly:add-interface - 'key-cancelation-interface - "A key cancelation" + 'key-cancellation-interface + "A key cancellation" '()) (ly:add-interface