+% this bug apparently caused by dvips + mf rounding.
+
+
\header {
texidoc="Run this through ly2dvi to show differerent brace sizes"
}
\header {
- texidoc = "Dots should remain close to the heads they belong to, but should not overlap.";
+ texidoc = "Dots should remain close to the heads they belong to, but should not overlap."
}
-
-\score { \notes {\grace {c'_\f} d e f g}}
+ % ?
+
+ \score { \notes \context Voice {\grace {c'_\f} d e f g}}
-
+ % ?
+
\score {
\notes \context Voice = VA \relative c'' {
\grace {[b8^1 c^2]} d4^3
-
-\score {
- \notes\relative c''{
- \grace g8 g'2 ( )g
- }
- \paper {
- linewidth=40.\mm;
- indent=0.;
- }
-}
-
--- /dev/null
+\header {
+texidoc = "grace code should not be confused by nested sequential musics, containing grace notes; practically speaking, this means that the end-bar and measure bar coincide in this example."
+
+}
+\score{
+\notes
+
+{ c''2 { \grace b'16 c''2 } \bar "|." }
+ \paper {
+}
+ }
+
}
\score {\notes \relative c' \context Staff {
\grace { [a'16 f] } g1
+ \bar "||" % test if | and || are synced.
\grace { [a16 bes] } c1
+ \bar "||" % test if | and || are synced.
}
\paper { linewidth = -1. }
}
}
\score {\notes < \context Staff { c2
- \ngrace c8
- c2 c4 }
+ \grace c8
+ c2 c4 }
\context Staff = SB { c2 \clef bass
- %\ngrace { [dis8 ( d8] }
+ \grace { [dis8 ( d8] }
) c2 c4 }
\context Staff = SC { c2 c2 c4 }
/*
ignore grace notes.
*/
- if (bool (beam_start_location_.grace_mom_) != bool (now_mom ().grace_mom_))
+ if (bool (beam_start_location_.grace_part_) != bool (now_mom ().grace_part_))
return ;
{
Moment now = now_mom();
- if(bool (now.grace_mom_ ) != bool (beam_start_mom_.grace_mom_))
+ if(bool (now.grace_part_ ) != bool (beam_start_mom_.grace_part_))
return ;
Item *stem_l = dynamic_cast<Item*> (info.elem_l_);
void
-Grace_iterator::process (Moment m )
+Grace_iterator::process (Moment m)
{
Moment main ;
- main.main_part_ = m.grace_mom_;
+ main.main_part_ = music_length_.grace_part_ + m.grace_part_;
Music_wrapper_iterator::process (main);
}
Moment cp =Music_wrapper_iterator::pending_moment();
Moment pending;
- pending.grace_mom_ = - music_length_.main_part_ + cp.main_part_;
+ pending.grace_part_ = cp.main_part_- music_length_.grace_part_ ;
return pending;
}
{
Moment l = Music_wrapper::length_mom ();
Moment gl;
- gl.grace_mom_ = l.main_part_ + l.grace_mom_ ;
+ gl.grace_part_ = l.main_part_ + l.grace_part_ ;
return gl;
}
Moment
Grace_music::start_mom () const
{
- return Music::start_mom ();
+ return - length_mom ();
}
Grace_music::Grace_music ()
#include "rational.hh"
/**
- Rationals with glue for Guilification;
+ Musical timing (Main-timing, grace-timing) with glue for
+ Guilification;
*/
class Moment
{
Moment (Rational m);
-
+ Moment operator - () const;
+
void operator += (Moment const &m);
void operator -= (Moment const &m);
void operator /= (Moment const &m);
Rational main_part_;
- Rational grace_mom_;
+ Rational grace_part_;
void set_infinite (int k);
#include "music-iterator.hh"
+/*
+
+ This is a lookahead list for grace notes.
+
+ { ... X \grace Y Z ... }
+
+ normally, the ending of X is the start of Z. In case of a grace
+ note, we take off a little at the end of X. What is stored: START
+ (start point of X), LENGTH (length of X), GRACE_START (start_music
+ of Y), and the next fixup element.
+
+ This is also done for nested musics, i.e.
+
+ voiceA = \notes { \grace b16 c'2 }
+ voiceB = \notes { c'2 \voiceA }
+
+ the iterator for voiceB will contain a fixup entry with (START=0/1,
+ LENGTH=2/1, GRACE_START=(0G-1/16) )
+
+ Graces at the start of a sequential music iterator are handled
+ by initting here_mom_ with Music::start_music (); no fixups are needed.
+
+*/
struct Grace_skip
{
Moment start_;
Rational length_;
- Rational grace_length_;
+
+ Rational grace_start_;
Grace_skip *next_;
};
Midi_event::str () const
{
Rational rat_dt = (delta_mom_.main_part_ * Rational (384) +
- delta_mom_.grace_mom_ * Rational (100))*Rational (4);
+ delta_mom_.grace_part_ * Rational (100))*Rational (4);
int delta_i = int (rat_dt);
String delta_str = Midi_item::i2varint_str (delta_i);
if (c)
return c;
- return Rational::compare (a.grace_mom_, b.grace_mom_);
+ return Rational::compare (a.grace_part_, b.grace_part_);
}
Moment::Moment ()
Moment::Moment (int m)
{
main_part_ = Rational(m);
- grace_mom_ = Rational( 0);
+ grace_part_ = Rational( 0);
}
Moment::Moment (int m, int n)
{
main_part_ = Rational (m,n);
- grace_mom_ = Rational (0);
+ grace_part_ = Rational (0);
}
Moment::Moment (Rational m)
{
main_part_ = m;
- grace_mom_ = Rational (0);
+ grace_part_ = Rational (0);
}
void
Moment::operator += (Moment const &src)
{
main_part_ +=src.main_part_ ;
- grace_mom_ += src.grace_mom_;
+ grace_part_ += src.grace_part_;
}
void
Moment::operator -= (Moment const &src)
{
main_part_ -= src.main_part_ ;
- grace_mom_ -= src.grace_mom_;
+ grace_part_ -= src.grace_part_;
}
/*
Moment::operator *= (Moment const &src)
{
main_part_ *= src.main_part_ ;
- grace_mom_ *= src.main_part_;
+ grace_part_ *= src.main_part_;
}
/*
Moment::operator /= (Moment const &src)
{
main_part_ /= src.main_part_ ;
- grace_mom_ /= src.main_part_;
+ grace_part_ /= src.main_part_;
}
Moment::operator bool ()
{
- return main_part_ || grace_mom_;
+ return main_part_ || grace_part_;
}
void
String
Moment::str () const
{
- return main_part_.str ();
+ String s = main_part_.str ();
+ if (grace_part_)
+ {
+ s += "G" + grace_part_.str ();
+ }
+ return s;
+}
+
+Moment
+Moment::operator - ( ) const
+{
+ Moment m;
+ m.grace_part_ = -grace_part_;
+ m.main_part_ = -main_part_;
+ return m;
}
for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s))
{
Moment l = unsmob_music (gh_car (s))->length_mom ();
- if (last_len.grace_mom_ && l.main_part_)
+ if (last_len.grace_part_ && l.main_part_)
{
- last_len.grace_mom_ = Rational (0);
+ last_len.grace_part_ = Rational (0);
}
cumulative += last_len;
last_len = l;
}
- last_len.grace_mom_ = Rational (0);
+ last_len.grace_part_ = Rational (0);
cumulative += last_len;
return cumulative;
if (l.main_part_)
return mus->start_mom ();
- else if (l.grace_mom_)
+ else if (l.grace_part_)
{
- m.grace_mom_ = - l.grace_mom_;
+ m.grace_part_ = - l.grace_part_;
return m;
}
}
Paper_stream::~Paper_stream ()
{
close_file_stream (os_);
- assert (nest_level == 0);
+ if (nest_level != 0)
+ programming_error ("Brace nesting in paper output doesn't match");
}
// print string. don't forget indent.
chm->set_spot (*$3->origin ());
}
| GRACE Music {
-#if 1
+#if 0
/*
The other version is for easier debugging of
Sequential_music_iterator in combination with grace notes.
}
if (Side_position_interface::get_axis (e) == X_AXIS
&& !e->parent_l (Y_AXIS))
- e->set_parent (inf.elem_l_, Y_AXIS);
-
+ {
+ e->set_parent (inf.elem_l_, Y_AXIS);
+ e->add_dependency (inf.elem_l_); // ??
+ }
Side_position_interface::add_support (e,inf.elem_l_);
}
}
}
}
+ SCM pad = me->get_grob_property ("padding");
+
+ if (gh_number_p (pad))
+ {
+ w[RIGHT] += gh_scm2double (pad)/2;
+ w[LEFT] -= gh_scm2double (pad)/2;
+ }
+
return w;
// add this->offset_ ? this-> relative_coordinate ()?
}
here_mom_ = sum (length (musiclist [start ... cursor>)) %)
*/
-
-
Sequential_music_iterator::Sequential_music_iterator ()
{
cursor_ = SCM_EOL;
get_grace_skips (SCM cursor)
{
Moment here (0);
- Moment last (here);
+ Moment last (-1);
Grace_skip *head = 0;
Grace_skip **tail = &head;
- bool first = true;
-
for (; gh_pair_p (cursor); cursor = gh_cdr (cursor))
{
Music * mus = unsmob_music (gh_car (cursor));
Moment l =mus->length_mom ();
- if (l.main_part_)
- {
- first = false;
- last = here;
- here += l;
- }
- else if(l.grace_mom_ && !first)
+ Moment s = mus->start_mom ();
+
+ if (s.grace_part_ && last >= Moment (0))
{
- assert (!l.main_part_);
Grace_skip *p =new Grace_skip;
p->start_ = last;
p->length_ = (here - last).main_part_;
- p->grace_length_ = l.grace_mom_;
+ p->grace_start_ = s.grace_part_;
p->next_ = 0;
*tail = p;
tail = &(*tail)->next_;
}
+
+ if (l.main_part_)
+ {
+ l.grace_part_ = Rational (0);
+ last = here;
+ here += l;
+ }
}
return head;
}
Moment len =iter_p_->music_length_mom ();
Moment start = iter_p_->music_start_mom ();
assert (!grace_skips_ || grace_skips_->start_ >= here_mom_);
-
+
if (len.main_part_ && grace_skips_ && grace_skips_->start_ == here_mom_)
{
Moment sk;
sk.main_part_ = grace_skips_->length_;
here_mom_ += sk;
- here_mom_.grace_mom_ = - grace_skips_->grace_length_;
+ here_mom_.grace_part_ = grace_skips_->grace_start_;
Grace_skip * n =grace_skips_->next_;
- delete grace_skips_;
+ delete grace_skips_;
grace_skips_ = n;
}
- else if (len.grace_mom_)
+ else if (len.grace_part_ && !len.main_part_)
{
- here_mom_.grace_mom_ =0;
+ here_mom_.grace_part_ =0;
}
else
{
+ /*
+ !len.grace_part_ || len.main_part_
+
+ We skip over a big chunk (mainpart != 0). Any starting graces
+ in that chunk are compensated by subtracting START.
+
+ */
here_mom_ += len - start;
}
move to context of child iterator if it is deeper down in the
hierarchy.
*/
-
void
Sequential_music_iterator::descend_to_child ()
{
do the stuff/note/rest preceding a grace.
*/
Moment u = until;
- u.grace_mom_ = 0;
+ u.grace_part_ = 0;
iter_p_->process (u - here_mom_);
}
else
{
Moment cp = iter_p_->pending_moment ();
- if (grace_skips_
- && here_mom_ == grace_skips_->start_
+ /*
+ Fix-up a grace note halfway in the music.
+ */
+ if (grace_skips_ && here_mom_ == grace_skips_->start_
&& cp.main_part_ >= grace_skips_->length_)
{
- cp += here_mom_ ;
- cp.grace_mom_ = - grace_skips_->grace_length_;
- return cp;
+ cp += here_mom_ ;
+ cp.grace_part_ = grace_skips_->grace_start_;
+ return cp;
+
}
- else
- return cp + here_mom_ - iter_p_->music_start_mom ();
+
+ /*
+ Fix-up a grace note at the start of the music.
+ */
+ return cp + here_mom_ - iter_p_->music_start_mom ();
}
{
Moment w = Paper_column::when_mom (cols[i]);
- if (!w.grace_mom_ && Paper_column::musical_b (cols[i]))
+ if (!w.grace_part_ && Paper_column::musical_b (cols[i]))
{
filter_cols.push (cols[i]);
col_moments.push (w);
/*
ignore grace notes for shortest notes.
*/
- if (when && when->grace_mom_)
+ if (when && when->grace_part_)
continue;
SCM st = cols[i]->get_grob_property ("shortest-starter-duration");
ugh: 0.1 is an arbitrary distance.
*/
dist *= (double) (delta_t.main_part_ / shortest_playing_len.main_part_)
- + 0.1 * (double) (delta_t.grace_mom_ / shortest_playing_len.main_part_);
+ + 0.1 * (double) (delta_t.grace_part_ / shortest_playing_len.main_part_);
if (lm && rm)
{
- if (lm->grace_mom_ && rm->grace_mom_)
+ if (lm->grace_part_ && rm->grace_part_)
dist *= 0.5;
- else if (!rm->grace_mom_ && lm->grace_mom_)
+ else if (!rm->grace_part_ && lm->grace_part_)
dist *= 0.7;
}
keyAccidentalOrder = #'(
(6 . -1) (2 . -1) (5 . -1 ) (1 . -1) (4 . -1) (0 . -1) (3 . -1)
(3 . 1) (0 . 1) (4 . 1) (1 . 1) (5 . 1) (2 . 1) (6 . 1)
- )
+ (6 . -2) (2 . -2) (5 . -2 ) (1 . -2) (4 . -2) (0 . -2) (3 . -2)
+ (3 . 2) (0 . 2) (4 . 2) (2 . 2) (5 . 2) (2 . 2) (6 . 2)
+ )
breakAlignOrder = #'(
Instrument_name
Left_edge_item
\property Voice.Beam \override #'space-function = #grace-beam-space-function
\property Voice.Beam \override #'thickness = #0.3
- % must use staff. Accidentals should also be smaller.
- \property Staff.fontSize = #-2
+ % Can't use Staff.fontSize, since time sigs, keys sigs, etc. will
+ % be smaller as well.
+
+ \property Voice.fontSize = #-2
+ \property Staff.LocalKeyItem \override #'font-relative-size = #-2
}
stopGraceMusic = {
\property Voice.Stem \revert #'length
\property Voice.Stem \revert #'direction
- \property Staff.fontSize \unset
+ % Can't use Staff.fontSize, since time sigs, keys sigs, etc. will
+ % be smaller as well.
+
+ \property Voice.fontSize \unset
+ \property Staff.LocalKeyItem \revert #'font-relative-size
}
(n, a) = tuple2
nn = chr ((n+ 2)%7 + ord ('a'))
- if a == -1:
- nn = nn + 'es'
- elif a == -2:
- nn = nn + 'eses'
- elif a == 1:
- nn = nn + 'is'
- elif a == 2:
- nn = nn + 'isis'
-
- return nn
+ return nn + {-2:'eses', -1:'es', 0:'', 1:'is', 2:'isis'}[a]
class Tuplet:
return list
def read_finale_value (str):
+ """
+Pry off one value from STR. The value may be $hex, decimal, or "string".
+Return: (value, rest-of-STR)
+ """
while str and str[0] in ' \t\n':
str = str[1:]
'''
if extra['pagenumber'] and extra['pagenumber'][-1] and extra['pagenumber'][-1] != 'no':
- s = s + '\\pagestyle{plain}\n'
+ s = s + '\setcounter{page}{%s}\n' % (extra['pagenumber'][-1])
+ s = s + '\\pagestyle{plain}\n'
else:
s = s + '\\pagestyle{empty}\n'