4
4
source file of the GNU LilyPond music typesetter
6
(c) 1997--2004 Jan Nieuwenhuizen <janneke@gnu.org>
6
(c) 1997--2006 Jan Nieuwenhuizen <janneke@gnu.org>
9
#include "lily-guile.hh"
9
#include "music-sequence.hh"
11
10
#include "audio-item.hh"
12
11
#include "performer.hh"
16
14
class Key_performer : public Performer
23
virtual bool try_music (Music* req);
24
virtual void create_audio_elements ();
25
virtual void stop_translation_timestep ();
21
virtual bool try_music (Music *ev);
22
void process_music ();
23
void stop_translation_timestep ();
28
Key_change_ev* key_req_;
32
30
Key_performer::Key_performer ()
43
Key_performer::create_audio_elements ()
41
Key_performer::process_music ()
47
SCM pitchlist = key_req_->get_property ("pitch-alist");
48
SCM proc = ly_scheme_function ("alterations-in-key");
50
SCM acc = gh_call1 (proc, pitchlist);
53
gh_scm2int (ly_caar (pitchlist)),
54
gh_scm2int (ly_cdar (pitchlist)));
45
SCM pitchlist = key_ev_->get_property ("pitch-alist");
46
SCM proc = ly_lily_module_constant ("alterations-in-key");
48
SCM acc = scm_call_1 (proc, pitchlist);
51
scm_to_int (scm_caar (pitchlist)),
52
scm_to_int (scm_cdar (pitchlist)));
56
54
Pitch c_do (0, 0, 0);
59
57
= ly_transpose_key_alist (pitchlist,
60
interval (key_do, c_do).smobbed_copy ());
58
pitch_interval (key_do, c_do).smobbed_copy ());
62
60
/* MIDI keys are too limited for lilypond scales.
63
61
We check for minor scale and assume major otherwise. */
64
SCM minor = scm_c_eval_string ("minor");
65
audio_ = new Audio_key (gh_scm2int (acc),
66
SCM_BOOL_T != scm_equal_p (minor, c_pitchlist));
68
Audio_element_info info (audio_, key_req_);
63
SCM third = scm_assoc (scm_from_int (2),
65
bool minor = (scm_is_pair (third)
66
&& scm_is_integer (scm_cdr (third))
67
&& scm_to_int (scm_cdr (third)) == FLAT);
69
audio_ = new Audio_key (scm_to_int (acc),
72
Audio_element_info info (audio_, key_ev_);
69
73
announce_element (info);
85
Key_performer::try_music (Music* req)
89
Key_performer::try_music (Music *ev)
87
if (Key_change_ev *kc = dynamic_cast <Key_change_ev *> (req))
90
warning (_ ("FIXME: key change merge"));
99
ENTER_DESCRIPTION (Key_performer,
97
#include "translator.icc"
99
ADD_TRANSLATOR (Key_performer,