bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Part combiner & Stem direction


From: Ted Ashton
Subject: Part combiner & Stem direction
Date: Sun, 16 Mar 2003 18:02:01 -0500
User-agent: Mutt/1.3.28i

Greetings,
  While I know that most bugs tend to be located between the keyboard and the
chair, I'm going to go out on a limb and claim that this will require a code
change :-).  I'd be grateful if you could reply directly, as I'm not on the
list (being far from being a maintainer, it didn't look like one I should
join).  
  Here's the situation.  I'm typesetting the hymn "I Sing the Mighty Power of
God" and want to (as is done in the hymnbook) set the soprano and alto on the
same line.  However, I'm having some frustration out of the combiner.  Here's
sample code: 

% Sample showing stem-direction problem

Key = \notes \key c \major
soprano = \notes\relative c' {
  c8. c16 c4 d 
}
alto = \notes\relative c' {
  c8. a16 a4 b 
}

\score {
  {
    <
      \time 3/4
      \context Staff = First <
        \property Staff.soloADue = ##f
        \property Staff.changeMoment = #`(,(make-moment 1 4) . ,(make-moment 1 
4))
        \Key
        \context Voice=one \partcombine Voice
        \context Thread=one { \soprano }
        \context Thread=two { \alto }
      >
      \context Staff = Second <
        \property Staff.soloADue = ##f
        \property Staff.changeMoment = #`(,(make-moment 1 4) . ,(make-moment 1 
4))
        \Key
        \context Voice=one \partcombine Voice
        \context Thread=one { \alto }
        \context Thread=two { \stemDown \soprano }
      >
    >
  }
  \paper { 
    raggedright = ##t
  }
}

The "First" staff shows the problem.  When the parts combine with soloADue off
and they need two stems (as the first dotted-eighth should, and, thanks to the
changeMoment setting, so with the sixteenth following it), the stem direction
of voice "two" needs to be set to "down", but is not.  Some kludging gives me
what I'm looking for at the beginning of staff "Second", but at the expense of
having all the stems point downward for the combined parts--not marvelous.

I'm completely new to the code and haven't spent much time with it, but my best
guess is that the problem lies in a2-engraver.cc.  There's a spot which says:

{
  /* When in solo a due mode, and we have solo, every grob in
     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)

      /* When not same rhythm, we set dir */
      && (unirhythm != SCM_BOOL_T
          /* When both have rests, but previously played something
             different, we set dir */
          || ((unisilence == SCM_BOOL_T && previous_state != UNISON))
          /* When same rhythm, and split stems, but not same pitch
             or not solo a du mode, we set dir */
          || (unirhythm == SCM_BOOL_T && split_interval == SCM_BOOL_T
              && (unison != SCM_BOOL_T || solo_adue != SCM_BOOL_T))))
    {

      /* Blunt axe method: every grob gets a propertysetting. */
      i.grob_->set_grob_property ("direction", scm_int2num (d));
    }
}

I'm not certain, but I think that that last business was intended to deal with
this situation.  However, since the very first term is true only if solo_adue
is true and the major conjuction is &&, that final-line "solo_adue !=
SCM_BOOL_T" isn't doing anything.  I'd recommend something along these lines:

Rather than this:
  if ((solo != SCM_BOOL_T && solo_adue == SCM_BOOL_T)
 
This seems to match the comments:
  if ((solo != SCM_BOOL_T || solo_adue != SCM_BOOL_T)

Anywho, that's my best guess.  Unfortunately, I don't currently have a ready 
development platform on which I can test my guess.  

Thanks,
Ted

P.S.  What does the second moment value in changeMoment do?
-- 
Ted Ashton (address@hidden) | From the Tom Swifty collection:
UGA Graduate Mathematics         | "These boxing gloves are too big", said Tom
Deep thought to be found at      | heavy-handedly.
http://math.uga.edu/~ashted      |




reply via email to

[Prev in Thread] Current Thread [Next in Thread]