+1.3.78.jcn1
+===========
+
+* Fixed a2-devnull-engraver, a2-engraver.
+
+* Renamed part combiner music names to "one", "two".
+
+* Cleaned up property setting of part combiner, renamed to "solo"/"unison"
+
+
1.3.77.jcn5
===========
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=78
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=jcn1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
\score{
- \context Staff = first <
- \context Voice=first { \skip 1; }
- \context Voice=second { \skip 1; }
+ \context Staff = one <
+ \context Voice=one { \skip 1; }
+ \context Voice=two { \skip 1; }
- \context Voice=first \partcombine Voice
- \context Thread=first \notes\relative c''
+ \context Voice=one \partcombine Voice
+ \context Thread=one \notes\relative c''
{
c4 d e f
b,4 d c d
r2 e4 f
c4 d e f
}
- \context Thread=second \notes\relative c''
+ \context Thread=two \notes\relative c''
{
- a b c d
+ g b d f
r2 c4 d
a c c d
a4. b8 c4 d
VIRTUAL_COPY_CONS (Translator);
protected:
- virtual bool do_try_music (Music*);
+ virtual void acknowledge_element (Score_element_info);
};
ADD_THIS_TRANSLATOR (A2_devnull_engraver);
-bool
-A2_devnull_engraver::do_try_music (Music *m)
+void
+A2_devnull_engraver::acknowledge_element (Score_element_info i)
{
- if (Note_req * n = dynamic_cast <Note_req *> (m))
- {
- SCM a2 = get_property ("a2");
- // should be able to read id_str_, no?
- SCM second = get_property ("second");
-
- if (a2 == SCM_BOOL_T && second == SCM_BOOL_T)
- {
- return true;
- }
- }
- return false;
+ if (daddy_trans_l_->id_str_ == "two"
+ && to_boolean (get_property ("unison")))
+ i.elem_l_->suicide ();
}
-
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_;
+ enum State { NORMAL, UNISON, SOLO } state_;
};
ADD_THIS_TRANSLATOR (A2_engraver);
A2_engraver::A2_engraver ()
{
text_p_ = 0;
+ state_ = NORMAL;
}
void
A2_engraver::do_process_music ()
+{
+}
+
+
+void
+A2_engraver::acknowledge_element (Score_element_info i)
{
if (!text_p_)
{
- SCM a2 = get_property ("a2");
+ SCM unison = get_property ("unison");
SCM solo = get_property ("solo");
- SCM solo2 = get_property ("solo2");
- if (solo == SCM_BOOL_T || a2 == SCM_BOOL_T || solo2 == SCM_BOOL_T)
+ if ((solo == SCM_BOOL_T && state_ != SOLO)
+ || (unison == SCM_BOOL_T && state_ != UNISON))
{
text_p_ = new Item (get_property ("basicTextScriptProperties"));
Side_position::set_axis (text_p_, Y_AXIS);
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;
+ state_ = SOLO;
+ if (daddy_trans_l_->id_str_ == "one")
+ text = ly_str02scm ("Solo");
+ else
+ {
+ text = ly_str02scm ("Solo II");
+ dir = DOWN;
+ }
}
- else if (a2 == SCM_BOOL_T)
+ else if (unison == SCM_BOOL_T)
{
text = ly_str02scm ("\\`a 2");
+ state_ = UNISON;
}
-
+
Side_position::set_direction (text_p_, dir);
text_p_->set_elt_property ("text", text);
}
}
+#if 0
}
void
A2_engraver::acknowledge_element (Score_element_info i)
{
+#endif
if (text_p_)
{
if (Note_head::has_interface (i.elem_l_))
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 (Stem::has_interface (i.elem_l_))
+ {
+ SCM unirhythm = get_property ("unirhythm");
+ SCM unison = get_property ("unison");
+ SCM solo = get_property ("solo");
+ SCM interval = get_property ("interval");
+
+ /*
+ This still needs some work.
+ */
+ if ((unirhythm != SCM_BOOL_T && solo != SCM_BOOL_T))
+#if 0
+ /*
+ Apart from the uglyness of this, we can't do this yet
+ because to get up/down stems for small intervals, we
+ need Part_combine_music_iterator to uncombine the
+ voices (while still setting unison).
+ */
+ || (unirhythm == SCM_BOOL_T
+ && gh_number_p (interval) && gh_scm2int (interval) < 3))
+#endif
+ {
+ if (daddy_trans_l_->id_str_ == "one")
{
- 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);
- }
+ Directional_element_interface (i.elem_l_).set (UP);
+ }
+ else if (daddy_trans_l_->id_str_ == "two")
+ {
+ Directional_element_interface (i.elem_l_).set (DOWN);
}
}
}
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);
}
#include "molecule.hh"
#include "paper-def.hh"
#include "lookup.hh"
+#include "lookup.hh"
int
compare (Chord* left, Chord* right)
assert (left);
assert (right);
- if (left->inversion_b_ == right->inversion_b_
- && left->bass_b_ == right->bass_b_
- && left->pitch_arr_.size () == right->pitch_arr_.size ())
- {
- for (int i = 0; i < left->pitch_arr_.size (); i++)
- if (left->pitch_arr_[i] != right->pitch_arr_[i])
- return 1;
- return 0;
- }
-
- return 1;
+ return !(left->inversion_b_ == right->inversion_b_
+ && left->bass_b_ == right->bass_b_
+ && !compare (&left->pitch_arr_, &right->pitch_arr_));
}
/*
#include "compare.hh"
INSTANTIATE_COMPARE(Musical_pitch, Musical_pitch::compare);
+int compare (Array<Musical_pitch>*, Array<Musical_pitch>*);
+
#endif /* MUSICAL_PITCH_HH */
Music_iterator * first_iter_p_;
Music_iterator * second_iter_p_;
- bool combined_b_;
+ bool unirhythm_b_;
};
#endif /* PART_COMBINE_MUSIC_ITERATOR_HH */
#include "debug.hh"
#include "main.hh"
+int
+compare (Array<Musical_pitch>* left, Array<Musical_pitch>* right)
+{
+ assert (left);
+ assert (right);
+
+ if (left->size () == right->size ())
+ {
+ for (int i = 0; i < left->size (); i++)
+ if ((*left)[i] != (*right)[i])
+ return 1;
+ }
+ return 0;
+}
+
SCM
Musical_pitch::to_scm ()const
{
Part_combine_music_iterator::Part_combine_music_iterator ()
{
- combined_b_ = false;
+ unirhythm_b_ = false;
first_iter_p_ = 0;
second_iter_p_ = 0;
Moment first_next = first_iter_p_->next_moment ();
Moment second_next = second_iter_p_->next_moment ();
- bool changed_b = false;
Part_combine_music const * p = dynamic_cast<Part_combine_music const* > (music_l_);
- String to_id = combined_b_ ? "first" : "second";
+ String to_id = unirhythm_b_ ? "one" : "two";
/*
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 != second_next && combined_b_)
- || (first_next == second_next && !combined_b_))
+ if ((first_next != second_next && unirhythm_b_)
+ || (first_next == second_next && !unirhythm_b_))
{
- combined_b_ = !combined_b_;
- to_id = combined_b_ ? "first" : "second";
+ unirhythm_b_ = !unirhythm_b_;
+ to_id = unirhythm_b_ ? "one" : "two";
change_to (second_iter_p_, p->what_str_, to_id);
- changed_b = true;
}
Translator_group * fd =
first_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_,
- "first");
+ "one");
Translator_group * sd =
second_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_,
to_id);
- fd->set_property ("first", SCM_BOOL_T);
- sd->set_property ("second", SCM_BOOL_T);
+ fd->set_property ("unirhythm", unirhythm_b_ ? SCM_BOOL_T : SCM_BOOL_F);
+ sd->set_property ("unirhythm", unirhythm_b_ ? SCM_BOOL_T : SCM_BOOL_F);
+ first_iter_p_->report_to_l ()->set_property ("unirhythm", unirhythm_b_ ? SCM_BOOL_T : SCM_BOOL_F);
+ second_iter_p_->report_to_l ()->set_property ("unirhythm", unirhythm_b_ ? SCM_BOOL_T : SCM_BOOL_F);
if (first_next <= m)
first_iter_p_->process_and_next (m);
/*
TODO:
- * "a2" string is fine, but "Soli" strings are one request late,
- second a2 requests are junked one requst late...
+ * "a2" string is fine, but "Soli" strings are one request late??
The problem seems to be: we need to do_try_music for the
spanish_inquisition to work; but the properties that we set
need to be set *before* we do_try_music?
* setting of stem directions by a2-engraver don't work
-
- * move much as possible code (changed?) to engravers: just notify
- them of status: unison/solo. Engravers should be able to find
- out whether something changed and if so, what to do.
-
- * who should reset the properties, it's a mess now?
-
- Later (because currently,we only handle thread swiching, really):
+ * 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);
-
- // URG, moveme: just set properties
- 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]))
+ if ((first_next == second_next)
+ && !compare (&first_spanish_inquisition->pitch_arr_,
+ &second_spanish_inquisition->pitch_arr_))
{
- if (changed_b)
- {
- fd->set_property ("a2", SCM_BOOL_T);
- sd->set_property ("a2", SCM_BOOL_T);
- }
- second_iter_p_->report_to_l ()->set_property ("a2", SCM_BOOL_T);
+ fd->set_property ("unison", SCM_BOOL_T);
+ sd->set_property ("unison", SCM_BOOL_T);
+ first_iter_p_->report_to_l ()->set_property ("unison", SCM_BOOL_T);
+ second_iter_p_->report_to_l ()->set_property ("unison", SCM_BOOL_T);
}
else
- second_iter_p_->report_to_l ()->set_property ("a2", SCM_BOOL_F);
-
- if (changed_b
- && first_spanish_inquisition->pitch_arr_.size ()
+ {
+ fd->set_property ("unison", SCM_BOOL_F);
+ sd->set_property ("unison", SCM_BOOL_F);
+ first_iter_p_->report_to_l ()->set_property ("unison", SCM_BOOL_F);
+ second_iter_p_->report_to_l ()->set_property ("unison", SCM_BOOL_F);
+ }
+
+ if (first_spanish_inquisition->pitch_arr_.size () &&
+ second_spanish_inquisition->pitch_arr_.size ())
+ {
+ first_spanish_inquisition->pitch_arr_.sort (Musical_pitch::compare);
+ second_spanish_inquisition->pitch_arr_.sort (Musical_pitch::compare);
+ SCM interval = gh_int2scm (first_spanish_inquisition->pitch_arr_.top ().semitone_pitch ()
+ - second_spanish_inquisition->pitch_arr_[0].semitone_pitch ());
+ fd->set_property ("interval", interval);
+ sd->set_property ("interval", interval);
+ first_iter_p_->report_to_l ()->set_property ("interval", interval);
+ second_iter_p_->report_to_l ()->set_property ("interval", interval);
+ }
+
+ if (first_spanish_inquisition->pitch_arr_.size ()
&& !second_spanish_inquisition->pitch_arr_.size ())
{
fd->set_property ("solo", SCM_BOOL_T);
+ first_iter_p_->report_to_l ()->set_property ("solo", SCM_BOOL_T);
}
+ else
+ {
+ fd->set_property ("solo", SCM_BOOL_F);
+ first_iter_p_->report_to_l ()->set_property ("solo", SCM_BOOL_F);
+ }
+
- if (changed_b
- && !first_spanish_inquisition->pitch_arr_.size ()
+ if (!first_spanish_inquisition->pitch_arr_.size ()
&& second_spanish_inquisition->pitch_arr_.size ())
{
- sd->set_property ("solo2", SCM_BOOL_T);
+ sd->set_property ("solo", SCM_BOOL_T);
+ second_iter_p_->report_to_l ()->set_property ("solo", SCM_BOOL_T);
+ }
+ else
+ {
+ sd->set_property ("solo", SCM_BOOL_F);
+ second_iter_p_->report_to_l ()->set_property ("solo", SCM_BOOL_F);
}
first_spanish_inquisition->pitch_arr_.clear ();
Part_combine_music::Part_combine_music (String what, Music * f, Music * s)
{
what_str_ = what;
- set_mus_property ("first", f->self_scm ());
- set_mus_property ("second", s->self_scm ());
+ set_mus_property ("one", f->self_scm ());
+ set_mus_property ("two", s->self_scm ());
}
Music*
Part_combine_music::first_l () const
{
- return unsmob_music (get_mus_property ("first"));
+ return unsmob_music (get_mus_property ("one"));
}
Music*
Part_combine_music::second_l () const
{
- return unsmob_music (get_mus_property ("second"));
+ return unsmob_music (get_mus_property ("two"));
}