]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.5.18
authorfred <fred>
Wed, 27 Mar 2002 02:03:42 +0000 (02:03 +0000)
committerfred <fred>
Wed, 27 Mar 2002 02:03:42 +0000 (02:03 +0000)
input/test/scales.ly
lily/command-request.cc
lily/key-performer.cc
lily/parser.yy
modules/midi.c
scm/midi.scm

index 151c9e10cebbd091067e31d07017d5816f783934..f2eb85fb4cbc6eac96d48e9b137b4943f129e2eb 100644 (file)
        es,, f ges as bes ces d es
        
        \key as\minor
-       as, bes ces des es fes g as}
+       as, bes ces des es fes g as
+}
 
   \paper { }  
   \midi { }
index 51bb291202d72ee479ce4bd2fdb590da13a014af..13089e274377c011f99f4766cba8b2ddbf0fd760 100644 (file)
@@ -56,7 +56,7 @@ Key_change_req::transpose (Pitch p)
        }
     }
 
-  set_mus_property ("pitch-alist", newlist);
+  set_mus_property ("pitch-alist", gh_reverse (newlist));
 }
 
 
index 22a3f2c84a014719db2638ec9a412e68f8bc47cb..e1c335ca0136687c09bf6e16af6cbbbb3f142925 100644 (file)
@@ -11,6 +11,7 @@
 #include "audio-item.hh"
 #include "performer.hh"
 
+
 class Key_performer : public Performer
 {
 public:
@@ -46,7 +47,24 @@ Key_performer::create_audio_elements ()
       SCM proc = scm_primitive_eval (ly_symbol2scm ("accidentals-in-key")); 
       SCM acc = gh_call1 (proc, pitchlist);
       proc = scm_primitive_eval (ly_symbol2scm ("major-key"));
-      SCM major = gh_call1 (proc, pitchlist);
+      Pitch my_do (0, 
+                  gh_scm2int (ly_caar (pitchlist)),
+                  gh_scm2int (ly_cdar (pitchlist)));
+                 
+      Pitch to_c (-1,
+                  (7 - gh_scm2int (ly_caar (pitchlist))) % 7,
+                  -gh_scm2int (ly_cdar (pitchlist)));
+
+      my_do.transpose (to_c);
+      to_c.alteration_i_ -= my_do.alteration_i_;
+
+      Key_change_req *key = new Key_change_req;
+      key->set_mus_property ("pitch-alist", scm_list_copy (pitchlist));
+      ((Music*)key)->transpose (to_c);
+      SCM c_pitchlist = key->get_mus_property ("pitch-alist");
+      SCM major = gh_call1 (proc, c_pitchlist);
+
       audio_p_ = new Audio_key (gh_scm2int (acc), major == SCM_BOOL_T); 
       Audio_element_info info (audio_p_, key_req_l_);
       announce_element (info);
index 85278a58f7daaab764e7511f8afde08b613f4ebd..27e3e1cdec00f57a6153194d9776602c4ed8b4eb 100644 (file)
@@ -1278,7 +1278,7 @@ verbose_command_req:
                Key_change_req *key_p= new Key_change_req;
                
                key_p->set_mus_property ("pitch-alist", $3);
((Music* )key_p)->transpose (* unsmob_pitch ($2));
              ((Music*)key_p)->transpose (* unsmob_pitch ($2));
                $$ = key_p; 
        }
        ;
index e1153f23d79ab2621c1bbe991de33432765d96b7..a5fab33c309aeaa9c816657d09c439851d6f8415 100644 (file)
@@ -196,7 +196,7 @@ read_string (unsigned char **track, unsigned char *end)
     length = end - *track;
 
   *track += length;
-  return Py_BuildValue ("s", ((*track) -length));
+  return Py_BuildValue ("s#", ((*track) -length), length);
 }
 
 typedef PyObject* (*Read_midi_event)
@@ -215,14 +215,8 @@ read_f0_byte (unsigned char **track, unsigned char *end,
       unsigned char z = (*track)[0 ];
       *track += 1;
       debug_print ("%x:%s", z, "f0-event\n");
-      
-      if (z == 0x2f && (*track)[0] == 0x00) /* end of track */
-       {
-         *track += 1;
-         return 0;
-       }
-      else
-       return Py_BuildValue ("(iiO)", x, z, read_string (track, end));
+
+      return Py_BuildValue ("(iiO)", x, z, read_string (track, end));
     }
 
   return Py_BuildValue ("(iO)", x, read_string (track, end));
index 46cb81c803e412000f430a46c454a2ff53356c24..e4b57135efcf2cd653c0d7a59674aee3804d7361 100644 (file)
   (apply + (map cdr pitch-list)))
 
 ;; Characterise the key as major if the alteration of the 
-;; third scale note is the same as that of the main note
+;; third scale note is the same as that of the main note.
 ;; Note: MIDI cannot handle other tonalities than major/minor.
 (define (major-key pitch-list)
-  (eq? (cdr (list-ref pitch-list 4)) (cdr (list-ref pitch-list 6))))
+  ;; This charactersition is only true for a scale that starts at `c'.
+  (if (not (equal? (car pitch-list) '(0 . 0)))
+      (begin
+       (ly-warn "Attempt to determine tonality of transposed scale")
+       #t)
+  (eq? (cdr (list-ref pitch-list 4)) (cdr (list-ref pitch-list 6)))))