2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2000--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
5 Erik Sandberg <mandolaerik@gmail.com>
7 LilyPond is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 LilyPond is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
21 #include "chord-tremolo-iterator.hh"
24 #include "international.hh"
26 #include "repeated-music.hh"
28 Chord_tremolo_iterator::Chord_tremolo_iterator ()
33 Chord_tremolo_iterator::get_music_list () const
35 Music
*mus
= get_music ();
36 Input
*origin
= mus
->origin ();
37 Moment l
= mus
->get_length ();
38 Music
*body
= Repeated_music::body (mus
);
39 bool body_is_sequential
= body
->is_mus_type ("sequential-music");
41 int elt_count
= body_is_sequential
? scm_ilength (body
->get_property ("elements")) : 1;
48 Music
*ev
= make_music_by_name (ly_symbol2scm ("TremoloEvent"));
49 ev
->set_spot (*origin
);
50 ev
->set_property ("repeat-count", mus
->get_property ("repeat-count"));
51 ev
->set_property ("tremolo-type", mus
->get_property ("tremolo-type"));
52 return scm_list_2 (ev
->unprotect (), body
->self_scm ());
56 SCM tremolo_symbol
= ly_symbol2scm ("TremoloSpanEvent");
57 SCM start_event_scm
= scm_call_2 (ly_lily_module_constant ("make-span-event"), tremolo_symbol
, scm_from_int (START
));
58 unsmob_music (start_event_scm
)->set_spot (*origin
);
59 SCM stop_event_scm
= scm_call_2 (ly_lily_module_constant ("make-span-event"), tremolo_symbol
, scm_from_int (STOP
));
61 Music
*start_event
= unsmob_music (start_event_scm
);
62 Music
*stop_event
= unsmob_music (stop_event_scm
);
63 start_event
->set_spot (*origin
);
64 stop_event
->set_spot (*origin
);
65 start_event
->set_property ("repeat-count", mus
->get_property ("repeat-count"));
66 start_event
->set_property ("tremolo-type", mus
->get_property ("tremolo-type"));
68 return scm_list_3 (start_event_scm
, body
->self_scm (), stop_event_scm
);
72 IMPLEMENT_CTOR_CALLBACK (Chord_tremolo_iterator
);