2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2010--2014 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 SCM articulations = SCM_EOL;
44 for (vsize i = 0; i < note_events.size (); i++)
47 Stream_event *event = note_events[i];
49 Stream_event *articulation_event = 0;
52 For notes inside a chord construct, string indications are
53 stored as articulations on the note, so we check through
56 for (SCM s = event->get_property ("articulations");
57 !articulation_event && scm_is_pair (s); s = scm_cdr (s))
59 Stream_event *art = unsmob_stream_event (scm_car (s));
61 if (art->in_event_class (articulation_name))
62 articulation_event = art;
66 For string indications listed outside a chord construct,
67 a string_number_event is generated, so if there was no string
68 in the articulations, we check for string events outside
71 if (!articulation_event && j < articulation_events.size ())
73 articulation_event = articulation_events[j];
74 if (j + 1 < articulation_events.size ())
77 articulations = scm_cons ((articulation_event
78 ? articulation_event->self_scm ()
83 return scm_reverse_x (articulations, SCM_EOL);