--- /dev/null
+\version "2.13.34"
+
+\header {
+ texidoc = "Context modification via @code{\\with} filters translators
+of the wrong type: performers for an @code{Engraver_group} and engravers
+for a @code{Performer_group}. In this test, the
+@code{Instrument_name_engraver} is added to a @code{StaffGroup}, but
+does not affect midi output, since it is filtered out."
+}
+
+\score {
+ \new StaffGroup \with {
+ \consists "Instrument_name_engraver"
+ instrumentName = #"StaffGroup"
+ }
+ {
+ a'1
+ }
+ \layout { }
+ \midi { }
+}
*/
#include "context.hh"
+#include "performer.hh"
#include "performer-group.hh"
#include "warn.hh"
get_daddy_performer ()->announce_element (i);
}
+
+Performer *
+unsmob_performer (SCM perf)
+{
+ return dynamic_cast<Performer *> (unsmob_translator (perf));
+}
#include "context-def.hh"
#include "context.hh"
#include "dispatcher.hh"
+#include "engraver.hh"
#include "engraver-group.hh"
#include "international.hh"
#include "main.hh"
#include "music.hh"
#include "output-def.hh"
+#include "performer.hh"
#include "performer-group.hh"
#include "scheme-engraver.hh"
#include "scm-hash.hh"
if (context_)
{
programming_error ("translator group is already connected to context "
- + context_->context_name ());
+ + context_->context_name ());
}
context_ = c;
{
}
+/*
+ Both filter_performers and filter_engravers used to use a direct dynamic_cast
+ on the unsmobbed translator to be filtered, i.e.,
+
+ if (dynamic_cast<Performer *> (unsmob_translator (scm_car (*tail))))
+
+ but this caused mysterious optimisation issues in several GUB builds. See
+ issue #818 for the background to this change.
+*/
SCM
filter_performers (SCM ell)
{
SCM *tail = ℓ
for (SCM p = ell; scm_is_pair (p); p = scm_cdr (p))
{
- if (dynamic_cast<Performer *> (unsmob_translator (scm_car (*tail))))
+ if (unsmob_performer (scm_car (*tail)))
*tail = scm_cdr (*tail);
else
tail = SCM_CDRLOC (*tail);
SCM *tail = ℓ
for (SCM p = ell; scm_is_pair (p); p = scm_cdr (p))
{
- if (dynamic_cast<Engraver *> (unsmob_translator (scm_car (*tail))))
+ if (unsmob_engraver (scm_car (*tail)))
*tail = scm_cdr (*tail);
else
tail = SCM_CDRLOC (*tail);