]> git.donarmstrong.com Git - lilypond.git/commitdiff
nested grace beams
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 2 Jun 2002 23:13:27 +0000 (23:13 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 2 Jun 2002 23:13:27 +0000 (23:13 +0000)
ChangeLog
Documentation/regression-test.tely
input/bugs/nested-grace-beam.ly [deleted file]
input/regression/beam-manual.ly [new file with mode: 0644]
input/regression/grace-beam.ly [new file with mode: 0644]
lily/beam-engraver.cc
lily/beam.cc
ly/engraver-init.ly
make/lilypond.redhat.spec.in
scm/grob-description.scm

index ad3eab610885a913338fb404d591eab045c67185..3a2213babbc1c25b3b1b3eb05f8050d9ee85ad0a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-06-03  Han-Wen  <hanwen@cs.uu.nl>
+
+       * lily/beam-engraver.cc (class Grace_beam_engraver): derive from
+       beam-engraver: use different engraver so we can mix normal and
+       grace beams.
+
 2002-06-01  Han-Wen  <hanwen@cs.uu.nl>
 
        * lily/beam.cc (shift_region_to_valid): Try to shift positions
@@ -17,7 +23,7 @@
 2002-05-31  Han-Wen  <hanwen@cs.uu.nl>
 
        * scripts/musedata2ly.py (Parser.parse_note_line): add dots. Add
-       note that missing features are excercise for user.
+       notice that missing features are exercise for user.
 
 2002-05-30  Jan Nieuwenhuizen  <janneke@gnu.org>
 
index c67484417885ca86b0e4f83cbe5ad95d9200c59d..b7ad78bc7dbc8bc0298f4d20d9c2a518d7d22929 100644 (file)
@@ -121,6 +121,8 @@ Grace note do weird things with timing. Fragile.
 
 @lilypondfile[printfilename]{grace.ly}
 
+@lilypondfile[printfilename]{grace-beam.ly}
+
 @lilypondfile[printfilename]{grace-bar-line.ly}
 
 @lilypondfile[printfilename]{grace-nest2.ly}
@@ -146,13 +148,14 @@ Grace note do weird things with timing. Fragile.
 
 @lilypondfile[printfilename]{beam-concave.ly}
 
+@lilypondfile[printfilename]{beam-manual.ly}
+
 @lilypondfile[printfilename]{beam-extreme.ly}
 
 @lilypondfile[printfilename]{beam-position.ly}
 
 @lilypondfile[printfilename]{beam-center-slope.ly}
 
-
 @lilypondfile[printfilename]{auto-beam-bar.ly}
 
 @lilypondfile[printfilename]{beam-over-barline.ly}
diff --git a/input/bugs/nested-grace-beam.ly b/input/bugs/nested-grace-beam.ly
deleted file mode 100644 (file)
index f7683a2..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-\header{
-texidoc = "Grace notes may separate beams, underneath normal beams." 
-}
-
-%
-% TODO: add this to standard lilypond
-%
-
-\score{
-\notes\context Voice{
-        \time 6/8
-        \clef violin
-       \key es \major
-        [a'8 ( \context GraceVoice \grace { [bes'16 a'16] }  g'8 ) a'8] d''4 c''8 |
-}
-\paper { \translator { \VoiceContext
-                      \accepts GraceVoice
-        }
-        \translator { \VoiceContext \name GraceVoice }
-        linewidth = -1. 
-    }
-}
-
diff --git a/input/regression/beam-manual.ly b/input/regression/beam-manual.ly
new file mode 100644 (file)
index 0000000..5aa6ed6
--- /dev/null
@@ -0,0 +1,22 @@
+
+\header {
+
+    texidoc = "Beam positions may be set by hand by overriding
+    positions.  No processing (quanting, damping) whatsoever is done "
+
+}
+
+\score {
+  \context Staff = up {
+   \notes\relative c'{
+    \property Voice.Beam \override #'auto-knee-gap = ##f
+    \property Voice.Beam \override #'positions = #'(-10 . 10)
+       \stemUp
+  [c16 c'' a f]
+
+   }
+  }
+  \paper{
+    linewidth = -1
+  }
+}
diff --git a/input/regression/grace-beam.ly b/input/regression/grace-beam.ly
new file mode 100644 (file)
index 0000000..2a680b3
--- /dev/null
@@ -0,0 +1,9 @@
+\header
+{
+texidoc = "Grace beams and normal beams may occur simultaneously.
+Unbeamed grace notes are not put into normal beams.
+"
+}
+
+\version "1.5.59"
+\score { \notes\relative c'' { c4 [d8 \grace { [e32  d c d] } e8] [e  e \grace { f16 } e8 e]   }}
index 904945439700aeeee98b35240d6daeaa20838ccb..d389789d3a7629ccfd7debe9ae6be4ac54cd7d93 100644 (file)
@@ -21,6 +21,7 @@
 
 class Beam_engraver : public Engraver
 {
+protected:  
   Drul_array<Span_req*> reqs_drul_;
   
   Spanner *finished_beam_p_;
@@ -40,7 +41,11 @@ class Beam_engraver : public Engraver
 
   void typeset_beam ();
   void set_melisma (bool);
-protected:
+
+  Moment last_stem_added_at_;
+  
+
+
   virtual void stop_translation_timestep ();
   virtual void start_translation_timestep ();
   virtual void finalize ();
@@ -49,11 +54,30 @@ protected:
   virtual bool try_music (Music*);
   virtual void process_music ();
 
+  virtual bool valid_start_moment();
+  virtual bool valid_end_moment ();
+  
 public:
   TRANSLATOR_DECLARATIONS(  Beam_engraver );
 };
 
 
+
+bool
+Beam_engraver::valid_start_moment()
+{
+  Moment n = now_mom ();
+
+  return n.grace_part_ == Rational (0);
+}
+
+bool
+Beam_engraver::valid_end_moment()
+{
+  return last_stem_added_at_.grace_part_ == Rational(0);
+}
+
+
 Beam_engraver::Beam_engraver ()
 {
   beam_p_ = 0;
@@ -80,11 +104,17 @@ Beam_engraver::try_music (Music *m)
          beam_p_ = 0;
        }
       else if (scm_equal_p (c->get_mus_property ("span-type"),
-                      ly_str02scm ("beam")) == SCM_BOOL_T)
+                           ly_str02scm ("beam")) == SCM_BOOL_T)
        {
-      
          Direction d =c->get_span_dir ();
 
+
+         if (d == STOP && !valid_end_moment())
+           return false;
+
+         if (d == START && !valid_start_moment ())
+           return false;
+         
          if (d == STOP)
            {
              SCM m = get_property ("automaticMelismata");
@@ -113,8 +143,6 @@ Beam_engraver::process_music ()
 {
   if (reqs_drul_[STOP])
     {
-      if (!beam_p_)
-       reqs_drul_[STOP]->origin ()->warning (_ ("can't find start of beam"));
       prev_start_req_ =0;
       finished_beam_p_ = beam_p_;
       finished_beam_info_p_ = beam_info_p_;
@@ -223,7 +251,7 @@ Beam_engraver::acknowledge_grob (Grob_info info)
        {
          Moment now = now_mom();
 
-         if(bool (now.grace_part_ ) != bool (beam_start_mom_.grace_part_))
+         if (!valid_start_moment ())
            return ;
          
          Item *stem_l = dynamic_cast<Item*> (info.grob_l_);
@@ -242,7 +270,9 @@ Beam_engraver::acknowledge_grob (Grob_info info)
              return;
            }
 
-      int durlog  = unsmob_duration (rhythmic_req->get_mus_property ("duration"))-> duration_log ();
+
+         last_stem_added_at_ = now;
+         int durlog  = unsmob_duration (rhythmic_req->get_mus_property ("duration"))-> duration_log ();
          if (durlog <= 2)
            {
              rhythmic_req->origin ()->warning (_ ("stem doesn't fit in beam"));
@@ -275,3 +305,46 @@ printed with flags instead of beams.",
 /* acks  */       "stem-interface rest-interface",
 /* reads */       "beamMelismaBusy subdivideBeams",
 /* write */       "");
+
+
+class Grace_beam_engraver : public Beam_engraver
+{
+public:
+  TRANSLATOR_DECLARATIONS(Grace_beam_engraver);  
+
+protected:
+  virtual bool valid_start_moment();
+  virtual bool valid_end_moment ();
+};
+
+Grace_beam_engraver::Grace_beam_engraver()
+{
+}
+
+bool
+Grace_beam_engraver::valid_start_moment()
+{
+  Moment n = now_mom ();
+
+  return n.grace_part_ != Rational (0);
+}
+
+
+bool
+Grace_beam_engraver::valid_end_moment ()
+{
+  return beam_p_ && last_stem_added_at_.grace_part_ != Rational(0);
+}
+
+
+
+ENTER_DESCRIPTION(Grace_beam_engraver,
+/* descr */       "Handles Beam_requests by engraving Beams.  If omitted, then notes will
+be printed with flags instead of beams. Only engraves beams when we
+are at grace points in time.
+",
+/* creats*/       "Beam",
+/* acks  */       "stem-interface rest-interface",
+/* reads */       "beamMelismaBusy subdivideBeams",
+/* write */       "");
+
index c24d348c00052db936e7a44b2013e1154c9e3de2..eba9e63373097c63e399d56ed6c54213342e757a 100644 (file)
@@ -347,13 +347,9 @@ Beam::set_stem_shorten (Grob *m)
 }
 
 /*  Call list of y-dy-callbacks, that handle setting of
-    grob-properties y, dy.
-    
-    User may set grob-properties: y-position-hs and height-hs
- (to be fixed) that override the calculated y and dy.
-    
-    Because y and dy cannot be calculated and quanted separately, we
-    always calculate both, then check for user override. */
+    grob-properties
+
+*/
 MAKE_SCHEME_CALLBACK (Beam, after_line_breaking, 1);
 SCM
 Beam::after_line_breaking (SCM smob)
index aeed2f96e55f6193f06d3d2915ca81e6611a5b55..c4781277e719e934446b9bcc746e647415cd4be7 100644 (file)
@@ -137,6 +137,7 @@ VoiceContext = \translator {
        % \consists "Rest_engraver"
        \consists "Stem_engraver"
        \consists "Beam_engraver"
+       \consists "Grace_beam_engraver"
        \consists "Auto_beam_engraver"
 
        \consists "Chord_tremolo_engraver"
index 26ce07e4c864087a1becd470b6915940bc214371..df3de73e08f79d4f5fd94e0c8f71a82e498525ec 100644 (file)
@@ -13,8 +13,10 @@ URL: http://www.lilypond.org/
 BuildRoot: /tmp/lilypond-install
 
 # add lots of Buildreq: flex, bison, tetex, tetex-devel, tetex-latex, texinfo
-# better prereqs: tetex-latex, python, (mpost?) etc.
-Prereq: tetex t1utils bison flex pktrace texinfo tetex-latex gcc-c++ python 
+Prereq: tetex  tetex-latex gcc-c++ python 
+
+#
+Buildreq:  t1utils bison flex pktrace texinfo
 
 %description
 LilyPond lets you create music notation.  It produces
index dae0d5d8a207d8d6b3c4efaf9c9e574fee800e8a..0b64c026c3466e5dbc7c44210a072d6edac920bb 100644 (file)
        (position-callbacks . (,Beam::least_squares
                               ,Beam::check_concave
                               ,Beam::slope_damping
-                              ,Beam::shift_region_to_valid
                               ,Beam::quanting
                              ))