Well, having gotten a build environment put together, I've spent the day
working over the part combiner. In specific, I changed:
1) When soloADue is off, the stems of part "two" in split intervals now get
pointed down, they didn't before.
2) When one part has a long rest and the other has note during it (for
example, an r4 in part "one" and r8 d16 r16 in part "two"), the smaller
rests were getting cut, leaving the note up against a long rest. The
patch makes UNISILENCE the equivalent of UNIRHYTHM (that is, not only do
both parts have to have silence, they must have it in the same rhythm). I
had to decide between doing that and making changes to the -devnull
engravers to check for UNISILENCE and UNIRHYTHM both being set. The docs
I found didn't indicate which was better and this makes for a smaller
patch and, I think, a more useful definition of UNISILENCE.
3) I also did considerable cleanup to make things work when changeMoment is
set to something other than the default. This work is still not complete.
Under known bugs should go that if you set it to 1/8,1/8 and you have,
for example, four 16ths barred together, weird things can happen including
losing notes. Fixing that is beyond my currently available time and
knowledge. It does work exceedingly well if you set it to 1/4,1/4, though
and, so far as I can tell, still works as before (with the exception of
fix 2 above) when set to the default.
I would be happy to help write docs/regression tests/samples on the changes,
but need guidance as to format/location/etc.
I'll attach the patch which is against the stable release source (the cygwin
lilypond source package). Three files are affected. The changes to
a2-engraver are just to get the stems pointed correctly.
Ted
--
Ted Ashton ([EMAIL PROTECTED]) | From the Tom Swifty collection:
UGA Graduate Mathematics | "We need a 10-gauge needle", Tom
Deep thought to be found at | hypothesized.
http://math.uga.edu/~ashted |
--- lily/a2-engraver.cc 2003/03/18 04:55:24 1.1
+++ lily/a2-engraver.cc 2003/03/19 23:07:50
@@ -160,7 +160,7 @@
other thread gets annihilated, so we don't set dir.
Maybe that should be optional? */
- if ((solo != SCM_BOOL_T && solo_adue == SCM_BOOL_T)
+ if (!(solo == SCM_BOOL_T && solo_adue == SCM_BOOL_T)
/* When not same rhythm, we set dir */
&& (unirhythm != SCM_BOOL_T
--- lily/part-combine-music-iterator.cc 2003/03/19 15:00:42 1.1
+++ lily/part-combine-music-iterator.cc 2003/03/20 00:16:23
@@ -20,6 +20,8 @@
second_iter_ = 0;
first_until_ = 0;
second_until_ = 0;
+ first_was_resting_ = false;
+ second_was_resting_ = false;
state_ = 0;
}
@@ -55,6 +57,8 @@
first_until_ = src.first_until_;
second_until_ = src.second_until_;
+ first_was_resting_ = src.first_was_resting_;
+ second_was_resting_ = src.second_was_resting_;
state_ = src.state_;
suffix_ = src.suffix_;
@@ -200,27 +204,19 @@
Moment second_mom = second_until_;
Moment diff_until = diff_mom + now;
-
- bool first = true;
Music_iterator *first_iter = first_iter_->clone ();
Music_iterator *second_iter = second_iter_->clone ();
- Moment last_pending (-1);
Moment pending = now;
- while (now < diff_until
- && (first_iter->ok () || second_iter->ok ())
- // urg, this is a hack, haven't caught this case yet
- && (pending != last_pending))
- {
- if (!second_iter->ok ())
- pending = first_iter->pending_moment ();
- else if (!first_iter->ok ())
- pending = second_iter->pending_moment ();
- else
- pending = first_iter->pending_moment () <? second_iter->pending_moment ();
- last_pending = pending;
+ /* Assume numerous things and turn them off when they prove not to be
+ * true.
+ */
+ state = SOLO1 | SOLO2 | UNIRHYTHM | UNISON | UNISILENCE;
+ while (now < diff_until
+ && (first_iter->ok () || second_iter->ok ()))
+ {
SCM first_pitches = SCM_EOL;
SCM first_durations = SCM_EOL;
get_music_info (pending, first_iter,
@@ -241,6 +237,8 @@
interval = gh_int2scm (unsmob_pitch (ly_car (first_pitches))->steps ()
- unsmob_pitch (ly_car (scm_last_pair
(second_pitches)))->steps ());
}
+ else
+ interval = SCM_BOOL_F;
if (first_durations != SCM_EOL)
{
@@ -256,24 +254,22 @@
second_mom += unsmob_duration (ly_car (second_durations))->length_mom ();
}
- if (first_pitches != SCM_EOL && second_pitches == SCM_EOL
- && ! (second_until_ > now))
+ if (first_pitches != SCM_EOL &&
+ ((second_until_ > now && second_was_resting_) ||
+ (second_until_ <= now && second_pitches == SCM_EOL)))
{
state |= UNRELATED;
state &= ~UNISILENCE;
- if (! (state & ~ (UNRELATED | SOLO1 | UNISILENCE)))
- state |= SOLO1;
}
else
state &= ~SOLO1;
- if (first_pitches == SCM_EOL && second_pitches != SCM_EOL
- && ! (first_until_ > now))
+ if (second_pitches != SCM_EOL &&
+ ((first_until_ > now && first_was_resting_) ||
+ (first_until_ <= now && first_pitches == SCM_EOL)))
{
state |= UNRELATED;
state &= ~UNISILENCE;
- if (! (state & ~ (UNRELATED | SOLO2 | UNISILENCE)))
- state |= SOLO2;
}
else
state &= ~SOLO2;
@@ -281,8 +277,6 @@
if (gh_equal_p (first_durations, second_durations))
{
state &= ~UNISILENCE;
- if (! (state & ~ (UNIRHYTHM | UNISON)))
- state |= UNIRHYTHM;
}
else
state &= ~ (UNIRHYTHM | UNISILENCE);
@@ -291,18 +285,11 @@
&& gh_equal_p (first_pitches, second_pitches))
{
state &= ~UNISILENCE;
- if (! (state & ~ (UNIRHYTHM | UNISON)))
- state |= UNISON;
}
else
state &= ~ (UNISON);
- if (first_pitches == SCM_EOL && second_pitches == SCM_EOL)
- {
- if (! (state & ~ (UNIRHYTHM | UNISILENCE)))
- state |= UNISILENCE;
- }
- else if (!state)
+ if (!state)
state |= UNRELATED;
else
state &= ~ (UNISILENCE);
@@ -320,20 +307,28 @@
if (! (state & ~ (SPLIT_INTERVAL | UNIRHYTHM | UNISON)))
state |= SPLIT_INTERVAL;
}
- else
- state &= ~ (SPLIT_INTERVAL);
}
- if (first && first_pitches != SCM_EOL)
- first_until_ = first_mom;
- if (first && second_pitches != SCM_EOL)
- second_until_ = second_mom;
- first = false;
+ first_was_resting_ = (first_pitches == SCM_EOL);
+ second_was_resting_ = (second_pitches == SCM_EOL);
+ first_until_ = first_mom;
+ second_until_ = second_mom;
if (first_iter->ok ())
first_iter->skip (pending);
if (second_iter->ok ())
second_iter->skip (pending);
+
+ if (first_iter->ok ()) {
+ if (second_iter->ok ()) {
+ pending = first_iter->pending_moment () <? second_iter->pending_moment
();
+ } else {
+ pending = first_iter->pending_moment ();
+ }
+ } else if (second_iter->ok ()) {
+ pending = second_iter->pending_moment ();
+ }
+
now = pending;
}
scm_gc_unprotect_object (first_iter->self_scm ());
--- lily/include/part-combine-music-iterator.hh 2003/03/19 22:49:27 1.1
+++ lily/include/part-combine-music-iterator.hh 2003/03/19 22:51:59
@@ -39,6 +39,8 @@
Music_iterator * second_iter_;
Moment first_until_;
Moment second_until_;
+ bool first_was_resting_;
+ bool second_was_resting_;
int state_;
String suffix_;
};
_______________________________________________
Bug-lilypond mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-lilypond