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");
49 if (gh_equal_p (s, ly_symbol2scm ("never")))
53 if (gh_equal_p (s, ly_symbol2scm ("always"))
55 && daddy_trans_->id_string_.left_string (3) == "two"
56 && (to_boolean (get_property ("unison"))
57 || to_boolean (get_property ("unisilence")))))
59 if (m->is_mus_type ("span-event"))
61 SCM t = m->get_mus_property ("span-type");
63 for (char const **p = eat_spanners; *p; p++)
65 if (t == scm_makfrom0str (*p))
69 /* Ugh. Should eat other events, script etc. too. */
70 else if (m->is_mus_type ("tie-event"))
76 static char const *junk_interfaces[] = {
80 "multi-measure-rest-interface",
84 "text-item-interface",
85 "text-script-interface",
86 "text-spanner-interface",
92 Voice_devnull_engraver::acknowledge_grob (Grob_info i)
94 SCM s = get_property ("devNullVoice");
96 /* No need, next if will never be true */
97 if (s == ly_symbol2scm ("never"))
101 #if 0 /* We used to have have this until 1.5.68. Not sure about
102 soloADue requirement */
103 if (s == ly_symbol2scm ("always")
105 && daddy_trans_->id_string_.left_string (3) == "two"
106 && (to_boolean (get_property ("unison"))
107 || to_boolean (get_property ("unisilence")))))
109 if (s == ly_symbol2scm ("always")
111 && to_boolean (get_property ("soloADue"))
112 && ((daddy_trans_->id_string_.left_string (3) == "two"
113 && (to_boolean (get_property ("unison"))
114 || to_boolean (get_property ("unisilence"))))
116 /* Maybe this should be optional? */
117 || to_boolean (get_property ("othersolo")))))
120 for (char const **p = junk_interfaces; *p; p++)
121 if (i.grob_->internal_has_interface (ly_symbol2scm (*p)))
128 Voice_devnull_engraver::Voice_devnull_engraver(){}
130 ENTER_DESCRIPTION(Voice_devnull_engraver,
131 /* descr */ "Kill off certain items and spanners if we're Voice `two' and unison or unisilence is set.",
133 /* accepts */ "general-music", /*UGH.*/
134 /* acks */ "grob-interface",