private:
Item* text_p_;
- enum State { NORMAL, UNISON, SOLO } state_;
+ enum State { NORMAL, SOLO, SPLIT_INTERVAL, UNISON } state_;
};
ADD_THIS_TRANSLATOR (A2_engraver);
void
A2_engraver::do_process_music ()
-{
-}
-
-
-void
-A2_engraver::acknowledge_element (Score_element_info i)
{
if (!text_p_)
{
SCM unison = get_property ("unison");
+ SCM unirhythm = get_property ("unirhythm");
SCM solo = get_property ("solo");
+ SCM split_interval = get_property ("split-interval");
+ SCM solo_adue = get_property ("soloADue");
- if ((solo == SCM_BOOL_T && state_ != SOLO)
- || (unison == SCM_BOOL_T && state_ != UNISON))
+ if (solo_adue == SCM_BOOL_T
+ && ((solo == SCM_BOOL_T && state_ != SOLO)
+ || (unison == SCM_BOOL_T && state_ != UNISON
+ && daddy_trans_l_->id_str_ == "one")))
{
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;
+ SCM text;
if (solo == SCM_BOOL_T)
{
state_ = SOLO;
if (daddy_trans_l_->id_str_ == "one")
- text = ly_str02scm ("Solo");
+ {
+ text = get_property ("soloText");
+ }
else
{
- text = ly_str02scm ("Solo II");
+ text = get_property ("soloIIText");
dir = DOWN;
}
}
else if (unison == SCM_BOOL_T)
{
- text = ly_str02scm ("\\`a 2");
state_ = UNISON;
+ if (daddy_trans_l_->id_str_ == "one")
+ text = get_property ("aDueText");
}
Side_position::set_direction (text_p_, dir);
text_p_->set_elt_property ("text", text);
-
}
+ else if (unison == SCM_BOOL_T)
+ state_ = UNISON;
+ else if (unirhythm == SCM_BOOL_T && split_interval == SCM_BOOL_T)
+ state_ = SPLIT_INTERVAL;
}
-#if 0
}
void
A2_engraver::acknowledge_element (Score_element_info i)
{
-#endif
if (text_p_)
{
if (Note_head::has_interface (i.elem_l_))
{
Item *stem_l = dynamic_cast<Item*> (i.elem_l_);
- SCM unirhythm = get_property ("unirhythm");
SCM unison = get_property ("unison");
+ SCM unirhythm = get_property ("unirhythm");
SCM solo = get_property ("solo");
- SCM interval = get_property ("interval");
+ SCM split_interval = get_property ("split-interval");
+ SCM solo_adue = get_property ("soloADue");
- /*
- This still needs some work.
- */
if ((unirhythm != SCM_BOOL_T && solo != SCM_BOOL_T)
- || (unirhythm == SCM_BOOL_T
- && gh_number_p (interval) && gh_scm2int (interval) < 3))
+ || (unirhythm == SCM_BOOL_T && split_interval == SCM_BOOL_T
+ && (unison != SCM_BOOL_T || solo_adue != SCM_BOOL_T)))
{
if (daddy_trans_l_->id_str_ == "one")
{
- //Directional_element_interface (stem_l).set (UP);
stem_l->set_elt_property ("direction", gh_int2scm (1));
}
else if (daddy_trans_l_->id_str_ == "two")
{
- //Directional_element_interface (stem_l).set (DOWN);
stem_l->set_elt_property ("direction", gh_int2scm (-1));
}
}
Part_combine_music_iterator::Part_combine_music_iterator ()
{
- combined_b_ = false;
+ combined_b_ = true;
first_iter_p_ = 0;
second_iter_p_ = 0;
Part_combine_music const * p = dynamic_cast<Part_combine_music const* > (music_l_);
- /*
- different rhythm for combined voices: separate
- same rhythm for separated voices: combine
-
- Arg. Voices should be separated for small intervals, eg < 3.
- This should be \property settable, and, we need the outcome
- of the spanish_inquisition's...
-
- Can't we first do a process_and_next go into a fake/tmp tree,
- use + junk the result, and then do the real process_and_next...?
-
- */
-
-
if (first_next <= m)
first_iter_p_->process_and_next (m);
/*
TODO:
- * setting of stem directions by a2-engraver don't work !!
+ * fix rhythm check
* check setting/resetting of properties
- * use some unexpectedly handy abrvs.
-
- (customise) * separate for small ( <3 ?) intervals too
-
Later (because currently, we only handle thread switching, really):
Maybe different modes exist?
second_spanish_inquisition = new Pitch_interrogate_req;
Music_iterator* sit = second_iter_p_->try_music (second_spanish_inquisition);
+ Array<Musical_pitch>* first_arr_l = &first_spanish_inquisition->pitch_arr_;
+ Array<Musical_pitch>* second_arr_l = &second_spanish_inquisition->pitch_arr_;
+
SCM interval = SCM_BOOL_F;
- if (first_spanish_inquisition->pitch_arr_.size ()
- && second_spanish_inquisition->pitch_arr_.size ())
+ if (first_arr_l->size () && second_arr_l->size ())
{
- first_spanish_inquisition->pitch_arr_.sort (Musical_pitch::compare);
- second_spanish_inquisition->pitch_arr_.sort (Musical_pitch::compare);
- interval = gh_int2scm (first_spanish_inquisition->pitch_arr_.top ().semitone_pitch ());
+ first_arr_l->sort (Musical_pitch::compare);
+ second_arr_l->sort (Musical_pitch::compare);
+ interval = gh_int2scm (first_arr_l->top ().steps ()
+ - (*second_arr_l)[0].steps ());
}
-
Translator_group * fir = first_iter_p_->report_to_l ();
Translator_group * sir = second_iter_p_->report_to_l ();
- bool solo = (first_spanish_inquisition->pitch_arr_.empty ()
- != second_spanish_inquisition->pitch_arr_.empty ());
+ bool solo_b = (first_arr_l->empty () != second_arr_l->empty ());
- bool unirhythm_b = (first_next == second_next) && !solo;
+ /*
+ Urg, this doesn't work at all. Do we need to send out another inquisition?
+ */
+ bool unirhythm_b = (first_next == second_next) && !solo_b;
- bool too_close_b = false;
- if (gh_number_p (interval) && gh_scm2int (interval) < 3)
- too_close_b = true;
+ Translator_group * fd = fir->find_create_translator_l (p->what_str_, "one");
+ Translator_group * sd = sir->find_create_translator_l (p->what_str_, "two");
+
+ bool split_interval_b = false;
+ if (gh_number_p (interval))
+ {
+ SCM s = fd->get_property (ly_symbol2scm ("splitInterval"));
+ int i = gh_scm2int (interval);
+ if (gh_pair_p (s)
+ && gh_number_p (gh_car (s))
+ && gh_number_p (gh_cdr (s))
+ && i >= gh_scm2int (gh_car (s))
+ && i <= gh_scm2int (gh_cdr (s)))
+ split_interval_b = true;
+ }
+
+ /*
+ Hmm, maybe we should set/check combined_b_ against
+
+ first_iter_p_->report_to_l () == second_iter_p_->report_to_l ()
+
+ ?
+ */
String to_id = combined_b_ ? "one" : "two";
if ((!unirhythm_b && combined_b_)
- || (unirhythm_b && !combined_b_)
- || (too_close_b && combined_b_)
- || (solo && combined_b_))
+ || (split_interval_b && combined_b_)
+ || (solo_b && combined_b_)
+ || (unirhythm_b && !combined_b_ && !split_interval_b && !solo_b))
{
combined_b_ = !combined_b_;
to_id = combined_b_ ? "one" : "two";
if (!combined_b_)
sir = second_iter_p_->report_to_l ();
- Translator_group * fd = fir->find_create_translator_l (p->what_str_, "one");
- Translator_group * sd = sir->find_create_translator_l (p->what_str_, "two");
+ SCM b = unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F;
+ fd->set_property ("unirhythm", b);
+ sd->set_property ("unirhythm", b);
- fd->set_property ("unirhythm", unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F);
- sd->set_property ("unirhythm", unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F);
- fir->set_property ("unirhythm", unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F);
- sir->set_property ("unirhythm", unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F);
+ b = split_interval_b ? SCM_BOOL_T : SCM_BOOL_F;
+ fd->set_property ("split-interval", b);
+ sd->set_property ("split-interval", b);
- if (unirhythm_b
- && !compare (&first_spanish_inquisition->pitch_arr_,
- &second_spanish_inquisition->pitch_arr_))
- {
- fd->set_property ("unison", SCM_BOOL_T);
- sd->set_property ("unison", SCM_BOOL_T);
- fir->set_property ("unison", SCM_BOOL_T);
- sir->set_property ("unison", SCM_BOOL_T);
- }
- else
- {
- fd->set_property ("unison", SCM_BOOL_F);
- sd->set_property ("unison", SCM_BOOL_F);
- fir->set_property ("unison", SCM_BOOL_F);
- sir->set_property ("unison", SCM_BOOL_F);
- }
+ b = gh_bool2scm (unirhythm_b && !compare (first_arr_l, second_arr_l));
+ fd->set_property ("unison", b);
+ sd->set_property ("unison", b);
- fd->set_property ("interval", interval);
- sd->set_property ("interval", interval);
- fir->set_property ("interval", interval);
- sir->set_property ("interval", interval);
-
- if (first_spanish_inquisition->pitch_arr_.size ()
- && !second_spanish_inquisition->pitch_arr_.size ())
- {
- fd->set_property ("solo", SCM_BOOL_T);
- fir->set_property ("solo", SCM_BOOL_T);
- }
- else
+ b = solo_b ? SCM_BOOL_T : SCM_BOOL_F;
+ if (first_arr_l->size ())
{
- fd->set_property ("solo", SCM_BOOL_F);
- fir->set_property ("solo", SCM_BOOL_F);
+ fd->set_property ("solo", b);
+ sd->set_property ("solo", SCM_BOOL_F);
}
-
- if (!first_spanish_inquisition->pitch_arr_.size ()
- && second_spanish_inquisition->pitch_arr_.size ())
+ if (second_arr_l->size ())
{
- sd->set_property ("solo", SCM_BOOL_T);
- sir->set_property ("solo", SCM_BOOL_T);
- }
- else
- {
- sd->set_property ("solo", SCM_BOOL_F);
- sir->set_property ("solo", SCM_BOOL_F);
+ fd->set_property ("solo", SCM_BOOL_F);
+ sd->set_property ("solo", b);
}
-
- first_spanish_inquisition->pitch_arr_.clear ();
- second_spanish_inquisition->pitch_arr_.clear ();
+ first_arr_l->clear ();
+ second_arr_l->clear ();
}
Music_iterator*