]> git.donarmstrong.com Git - lilypond.git/commitdiff
further pitch fixes.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 24 Dec 2006 02:39:07 +0000 (03:39 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 24 Dec 2006 02:39:07 +0000 (03:39 +0100)
15 files changed:
lily/audio-item.cc
lily/drum-note-performer.cc
lily/include/audio-item.hh
lily/include/pitch.hh
lily/include/score.hh
lily/key-performer.cc
lily/key-signature-interface.cc
lily/midi-item.cc
lily/note-performer.cc
lily/pitch-scheme.cc
lily/pitch.cc
lily/quote-iterator.cc
ly/music-functions-init.ly
scm/define-context-properties.scm
scm/define-grob-interfaces.scm

index 67d34c6c923d695b9e18c94c0d2dd7b495dce5eb..4a3b9d4a41d3405d2de8e9c28f205bf23a726661 100644 (file)
@@ -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;
index 7aa463b5767f6af2aad4193fccc26a356dcef13c..49a8d270018a4b08cc5c80916b7a05769b0a3395 100644 (file)
@@ -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);
index 43009195c3cf1db2608bcea5f918df9727a339ff..e6f0c9ad91615b9d93a46f5e6977f4067a031468 100644 (file)
@@ -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_;
 };
index 0e3be73917886a59c632908038478616b6c1f78f..65883d6345052096b9b17f595b0c6986dbcd5a7e 100644 (file)
@@ -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));
index 71b2037efb6e8035fee2a906baf9b957ea26be2c..bcd967cda108991715b6bb21b6ad8a6aec0b0860 100644 (file)
@@ -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);
 
index 9bb8b11a48edcabdfbb3330ebb24d85a2f60bee0..762e8c48086269c86739ef92db2c878ee012c1ea 100644 (file)
@@ -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);
 
index c1bd368c7f498d92352ea7a34d8671881c6bf972..d6513efd84b1b6ad96ea0bb83d3c305c46f23e23 100644 (file)
@@ -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
index 10b7f2715c0c1674c322fd795056367c489db336..3fcdb4ca223d6c7ebea4a3b6e983cfc6cab6001d 100644 (file)
@@ -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
index e5c2ef9e050d83b60b5338d21dbfb5f5aab2addf..a5b4afce87f35d2d430ab8dd85722ef1a5bc471e 100644 (file)
@@ -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);
index 16b78e9420348422935fb6cba17ed3a505389de2..e45cd841b7d5bf5666a99b29eb0dc9e3087becbc 100644 (file)
@@ -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}.")
index 4d983ab6d5e4e6a729e0440c51d9e6e302426285..880dc79edfdb4339ab99dba99d54d11338a32f92 100644 (file)
@@ -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 ());
+}
index 849472c329a34a52ca1e594740231e6281cb34a9..272f0808adda098fbf35cb32d055e1ae47a5ec73 100644 (file)
@@ -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);
index 077c965bd545137645fd35ce7c6c771816f6bae3..9baec24ae30dc97bed4ac97183438ebc448ba155 100644 (file)
@@ -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
 ))
 
index fe32b4ecd96cd923114968a4f19f440e073921e8..16dddf3e7e121eca16f48d68cf0fe660b7f89e9c 100644 (file)
@@ -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}.")
      
index 7cb6c736e610a464bcb71e697067a04c83f226c5..f88a7f11590cfde7a9e2db00e671be7d19a89ce8 100644 (file)
@@ -62,8 +62,8 @@
  '())
 
 (ly:add-interface
- 'key-cancelation-interface
- "A key cancelation"
+ 'key-cancellation-interface
+ "A key cancellation"
  '())
 
 (ly:add-interface