---- ../lilypond-1.3.77.jcn2/CHANGES Sun Aug 13 15:50:59 2000
+--- ../lilypond-1.3.77.jcn3/CHANGES Sun Aug 13 20:05:00 2000
+++ b/CHANGES Sun Aug 13 23:23:46 2000
+@@ -1,3 +1,14 @@
+1.3.77.jcn4
+===========
+
+* Part-combine iterator identifies Soli and A2 parts in threads by
+ looking at rhythm and pitches. It switches Voice context automagically,
+ and communicates current state using a2/solo/solo2 properties.
+
+* Simple A2_engraver (`a due) prints `a2/Solo/Solo II. Soli seem to
+ arrive one request late.
+
+
+ 1.3.77.jcn3
+ ===========
+ --- ../lilypond-1.3.77.jcn2/CHANGES Sun Aug 13 15:50:59 2000
++ b/CHANGES Sun Aug 13 20:05:00 2000
@@ -1,3 +1,9 @@
1.3.77.jcn3
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=77
-MY_PATCH_LEVEL=jcn3
+MY_PATCH_LEVEL=jcn4
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
\context Voice=second { \skip 1; }
\context Voice=first \partcombine Voice
- \context Thread \notes\relative c''
+ \context Thread=first \notes\relative c''
{
c4 d e f
+ b,4 d c d
+ r2 e4 f
c4 d e f
}
- \context Thread \notes\relative c''
+ \context Thread=second \notes\relative c''
{
a b c d
+ r2 c4 d
+ a c c d
a4. b8 c4 d
}
>
--- /dev/null
+/*
+ a2-engraver.cc -- implement A2_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "engraver.hh"
+#include "item.hh"
+#include "note-head.hh"
+#include "stem.hh"
+#include "translator-group.hh"
+#include "side-position-interface.hh"
+#include "directional-element-interface.hh"
+
+class A2_engraver : public Engraver
+{
+public:
+ A2_engraver ();
+ VIRTUAL_COPY_CONS (Translator);
+
+protected:
+ virtual void do_process_music ();
+ virtual void acknowledge_element (Score_element_info);
+ //virtual void process_acknowledged ();
+
+ virtual void do_pre_move_processing ();
+
+private:
+ Item* text_p_;
+};
+
+ADD_THIS_TRANSLATOR (A2_engraver);
+
+A2_engraver::A2_engraver ()
+{
+ text_p_ = 0;
+}
+
+void
+A2_engraver::do_process_music ()
+{
+ if (!text_p_)
+ {
+ SCM a2 = get_property ("a2");
+ SCM solo = get_property ("solo");
+ SCM solo2 = get_property ("solo2");
+
+ if (solo == SCM_BOOL_T || a2 == SCM_BOOL_T || solo2 == SCM_BOOL_T)
+ {
+ text_p_ = new Item (get_property ("basicTextScriptProperties"));
+ Side_position::set_axis (text_p_, Y_AXIS);
+ announce_element (text_p_, 0);
+
+ /*
+ Urg, read prop
+ */
+ SCM text;
+ Direction dir = UP;
+ if (solo == SCM_BOOL_T)
+ {
+ text = ly_str02scm ("Solo");
+ }
+ else if (solo2 == SCM_BOOL_T)
+ {
+ text = ly_str02scm ("Solo II");
+ dir = DOWN;
+ }
+ else if (a2 == SCM_BOOL_T)
+ {
+ text = ly_str02scm ("\\`a 2");
+ }
+
+ Side_position::set_direction (text_p_, dir);
+ text_p_->set_elt_property ("text", text);
+
+ }
+ }
+}
+
+void
+A2_engraver::acknowledge_element (Score_element_info i)
+{
+ if (text_p_)
+ {
+ if (Note_head::has_interface (i.elem_l_))
+ {
+ Score_element*t = text_p_;
+ Side_position::add_support (t, i.elem_l_);
+ if (Side_position::get_axis (t) == X_AXIS
+ && !t->parent_l (Y_AXIS))
+ t->set_parent (i.elem_l_, Y_AXIS);
+ }
+ if (Stem::has_interface (i.elem_l_))
+ {
+ Side_position::add_support (text_p_, i.elem_l_);
+
+ SCM a2 = get_property ("a2");
+ SCM solo = get_property ("solo");
+ SCM solo2 = get_property ("solo2");
+
+ SCM first = get_property ("first");
+ SCM second = get_property ("second");
+
+ if (solo != SCM_BOOL_T
+ && solo2 != SCM_BOOL_T
+ && a2 != SCM_BOOL_T)
+ {
+ if (first == SCM_BOOL_T)
+ {
+ Directional_element_interface (i.elem_l_).set (UP);
+ }
+ else if (second == SCM_BOOL_T)
+ {
+ Directional_element_interface (i.elem_l_).set (DOWN);
+ }
+ }
+ }
+ }
+}
+
+void
+A2_engraver::do_pre_move_processing ()
+{
+ if (text_p_)
+ {
+ Side_position::add_staff_support (text_p_);
+ typeset_element (text_p_);
+ text_p_ = 0;
+ }
+ // burp: reset properties
+ daddy_trans_l_->set_property ("a2", SCM_BOOL_F);
+ daddy_trans_l_->set_property ("solo", SCM_BOOL_F);
+ daddy_trans_l_->set_property ("solo2", SCM_BOOL_F);
+}
+
Moment first_next = first_iter_p_->next_moment ();
Moment second_next = second_iter_p_->next_moment ();
-#if 0
- if (first_next > m || second_next > m)
- return;
-#endif
+ bool changed_b = false;
+ Part_combine_music const * p = dynamic_cast<Part_combine_music const* > (music_l_);
+ String to_id = combined_b_ ? "first" : "second";
/*
different rhythm for combined voices: separate
same rhythm for separated voices: combine
|| (first_next == second_next && !combined_b_))
{
combined_b_ = !combined_b_;
- String to_id = combined_b_ ? "first" : "second";
-
- Part_combine_music const * p = dynamic_cast<Part_combine_music const* > (music_l_);
-
+ to_id = combined_b_ ? "first" : "second";
change_to (second_iter_p_, p->what_str_, to_id);
-
- /*
- A quick ugly hack to see if it works..
- */
-#if 0
- Translator_group * fd =
- first_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_,
- "first");
- Translator_group * sd =
- second_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_,
- to_id);
-#else
- Translator_group * fd = first_iter_p_->report_to_l ();
- Translator_group * sd = second_iter_p_->report_to_l ();
-#endif
-
- if (combined_b_)
- {
- fd->set_property ("verticalDirection", gh_int2scm (0));
- fd->set_property ("noteHeadStyle", ly_symbol2scm ("default"));
- }
- else
- {
- fd->set_property ("verticalDirection", gh_int2scm (1));
- fd->set_property ("noteHeadStyle", ly_symbol2scm ("diamond"));
- sd->set_property ("verticalDirection", gh_int2scm (-1));
- }
+ changed_b = true;
}
- first_iter_p_->process_and_next (m);
- second_iter_p_->process_and_next (m);
+ Translator_group * fd =
+ first_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_,
+ "first");
+ Translator_group * sd =
+ second_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_,
+ to_id);
- Music_iterator::do_process_and_next (m);
+ fd->set_property ("first", SCM_BOOL_T);
+ if (!combined_b_)
+ sd->set_property ("second", SCM_BOOL_T);
+ if (first_next <= m)
+ first_iter_p_->process_and_next (m);
-#if 0
+ if (second_next <= m)
+ second_iter_p_->process_and_next (m);
+
+ Music_iterator::do_process_and_next (m);
/*
TODO:
second_spanish_inquisition = new Pitch_interrogate_req;
Music_iterator* sit = second_iter_p_->try_music (second_spanish_inquisition);
- if (fit && first_spanish_inquisition->pitch_arr_.size ())
+ /*
+ Hmm. In the case of a2, the second identical set of requests must
+ be junked: that's the whole point of detecting a2. Howto/whereto
+ junk these requests?
+ */
+ if (changed_b
+ && (first_next == second_next)
+ && first_spanish_inquisition->pitch_arr_.size ()
+ && (first_spanish_inquisition->pitch_arr_.size ()
+ == second_spanish_inquisition->pitch_arr_.size ())
+ && (first_spanish_inquisition->pitch_arr_[0] ==
+ second_spanish_inquisition->pitch_arr_[0]))
+ {
+ fd->set_property ("a2", SCM_BOOL_T);
+ sd->set_property ("a2", SCM_BOOL_T);
+ }
+
+ if (changed_b
+ && first_spanish_inquisition->pitch_arr_.size ()
+ && !second_spanish_inquisition->pitch_arr_.size ())
+ {
+ fd->set_property ("solo", SCM_BOOL_T);
+ }
+
+ if (changed_b
+ && !first_spanish_inquisition->pitch_arr_.size ()
+ && second_spanish_inquisition->pitch_arr_.size ())
{
- Musical_pitch p = spanish_inquisition->pitch_arr_[0];
- Direction s = Direction (sign(p.steps ()));
- if (s != where_dir_)
- {
- where_dir_ = s;
- String to_id = (s >= 0) ? "up" : "down";
- Part_combine_music const * auto_mus = dynamic_cast<Part_combine_music const* > (music_l_);
-
- change_to (it, auto_mus->what_str_, to_id);
- }
+ sd->set_property ("solo2", SCM_BOOL_T);
}
first_spanish_inquisition->pitch_arr_.clear ();
second_spanish_inquisition->pitch_arr_.clear ();
-#endif
}
Music_iterator*
\consists "Melisma_engraver";
textScriptPadding = #3.0
\consists "Text_engraver";
+ \consists "A2_engraver";
startSustain = #"Ped."
ThreadContext = \translator{
\type Engraver_group_engraver;
- \consists "Note_heads_engraver" ;
+ \consists "Note_heads_engraver";
\consists "Output_property_engraver";
Generic_property_list = #generic-thread-properties
\consists "Property_engraver";