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 { }
}
}
- set_mus_property ("pitch-alist", newlist);
+ set_mus_property ("pitch-alist", gh_reverse (newlist));
}
#include "audio-item.hh"
#include "performer.hh"
+
class Key_performer : public Performer
{
public:
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);
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;
}
;
length = end - *track;
*track += length;
- return Py_BuildValue ("s", ((*track) -length));
+ return Py_BuildValue ("s#", ((*track) -length), length);
}
typedef PyObject* (*Read_midi_event)
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));
(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)))))