From: fred Date: Wed, 27 Mar 2002 02:03:42 +0000 (+0000) Subject: lilypond-1.5.18 X-Git-Tag: release/1.5.59~427 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=55833f12d5344e0040c617b089849c4a9c82ed69;p=lilypond.git lilypond-1.5.18 --- diff --git a/input/test/scales.ly b/input/test/scales.ly index 151c9e10ce..f2eb85fb4c 100644 --- a/input/test/scales.ly +++ b/input/test/scales.ly @@ -102,7 +102,8 @@ 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 { } diff --git a/lily/command-request.cc b/lily/command-request.cc index 51bb291202..13089e2743 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -56,7 +56,7 @@ Key_change_req::transpose (Pitch p) } } - set_mus_property ("pitch-alist", newlist); + set_mus_property ("pitch-alist", gh_reverse (newlist)); } diff --git a/lily/key-performer.cc b/lily/key-performer.cc index 22a3f2c84a..e1c335ca01 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -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); diff --git a/lily/parser.yy b/lily/parser.yy index 85278a58f7..27e3e1cdec 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -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; } ; diff --git a/modules/midi.c b/modules/midi.c index e1153f23d7..a5fab33c30 100644 --- a/modules/midi.c +++ b/modules/midi.c @@ -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)); diff --git a/scm/midi.scm b/scm/midi.scm index 46cb81c803..e4b57135ef 100644 --- a/scm/midi.scm +++ b/scm/midi.scm @@ -278,7 +278,12 @@ (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)))))