2 voice-devnull-engraver.cc -- implement Voice_devnull_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2003 Jan Nieuwenhuizen <janneke@gnu.org>
12 #include "translator-group.hh"
14 class Voice_devnull_engraver : public Engraver
17 TRANSLATOR_DECLARATIONS(Voice_devnull_engraver);
20 virtual bool try_music (Music *m);
21 virtual void acknowledge_grob (Grob_info);
33 static char const *eat_spanners[] = {
43 Voice_devnull_engraver::try_music (Music *m)
45 SCM s = get_property ("devNullVoice");
47 if (gh_equal_p (s, ly_symbol2scm ("always"))
49 && daddy_trans_->id_string_.left_string (3) == "two"
50 && (to_boolean (get_property ("unison"))
51 || to_boolean (get_property ("unisilence")))))
53 if (m->is_mus_type ("span-event"))
55 SCM t = m->get_mus_property ("span-type");
57 for (char const **p = eat_spanners; *p; p++)
59 if (t == scm_makfrom0str (*p))
63 /* Ugh. Should eat other events, script etc. too. */
64 else if (m->is_mus_type ("tie-event"))
70 static char const *junk_interfaces[] = {
74 "multi-measure-rest-interface",
78 "text-item-interface",
79 "text-script-interface",
80 "text-spanner-interface",
86 Voice_devnull_engraver::acknowledge_grob (Grob_info i)
88 SCM s = get_property ("devNullVoice");
90 if (s == ly_symbol2scm ("always")
92 && to_boolean (get_property ("soloADue"))
93 && ((daddy_trans_->id_string_.left_string (3) == "two"
94 && (to_boolean (get_property ("unison"))
95 || to_boolean (get_property ("unisilence"))))
97 /* Maybe this should be optional? */
98 || to_boolean (get_property ("othersolo")))))
100 for (char const **p = junk_interfaces; *p; p++)
101 if (i.grob_->internal_has_interface (ly_symbol2scm (*p)))
108 Voice_devnull_engraver::Voice_devnull_engraver(){}
110 ENTER_DESCRIPTION(Voice_devnull_engraver,
111 /* descr */ "Kill off certain items and spanners if we're Voice `two' and unison or unisilence is set.",
113 /* accepts */ "general-music", /*UGH.*/
114 /* acks */ "grob-interface",