2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2010 Carl Sorensen <c_sorensen@byu.edu>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
19 #include "engraver.hh"
21 #include "articulations.hh"
22 #include "stream-event.hh"
27 Return an articulation list given a note_events vector and an
28 articulation_events vector.
30 This is necessary, because the articulations come as events if
31 they are entered outside of a chord structure, and as articulations
32 if they are inside the chord structure. So potentially we need to
33 combine the two types.
37 articulation_list (vector
<Stream_event
*> note_events
,
38 vector
<Stream_event
*> articulation_events
,
39 char const *articulation_name
)
41 vector
<Stream_event
*> string_events
;
42 SCM articulations
= SCM_EOL
;
45 for (vsize i
= 0; i
< note_events
.size (); i
++)
48 Stream_event
*event
= note_events
[i
];
50 Stream_event
*articulation_event
= 0;
53 For notes inside a chord construct, string indications are
54 stored as articulations on the note, so we check through
57 for (SCM s
= event
->get_property ("articulations");
58 !articulation_event
&& scm_is_pair (s
); s
= scm_cdr (s
))
60 Stream_event
*art
= unsmob_stream_event (scm_car (s
));
62 if (art
->in_event_class (articulation_name
))
63 articulation_event
= art
;
67 For string indications listed outside a chord construct,
68 a string_number_event is generated, so if there was no string
69 in the articulations, we check for string events outside
72 if (!articulation_event
&& j
< articulation_events
.size ())
74 articulation_event
= articulation_events
[j
];
75 if (j
+ 1 < articulation_events
.size ())
78 articulations
= scm_cons ((articulation_event
79 ? articulation_event
->self_scm ()
84 return (scm_reverse (articulations
));