]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/beam.scm (check-slope-callbacks): check sign of slope.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 9 Jul 2004 11:06:29 +0000 (11:06 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 9 Jul 2004 11:06:29 +0000 (11:06 +0000)
* input/regression/beam-concave.ly (rossFourBeams): add cases from Ross

* scm/script.scm (default-script-alist): marcato should follow
into staff

ChangeLog
Documentation/bibliography/engraving.bib
SConstruct
input/regression/beam-concave.ly
input/regression/beam-quant-standard.ly
lily/beam.cc
lily/includable-lexer.cc
ly/spanners-init.ly
scm/beam.scm
scm/define-grob-properties.scm
scm/script.scm

index c65e6877ff68a139c76ec3328fb2be461ed48db2..efd487436fd0d0f5b1246b1804ed973888d28d45 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-07-09  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * scm/beam.scm (check-slope-callbacks): check sign of slope. 
+
+       * input/regression/beam-concave.ly (rossFourBeams): add cases from Ross
+
+       * scm/script.scm (default-script-alist): marcato should follow
+       into staff
+       
 2004-07-09  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * buildscripts/builder.py:
index 0209a87ffdbdba42c737cddf21a63ac2f5f14f41..7f15f4449430bd19051069ec84aaaf67ba56af3c 100644 (file)
@@ -195,6 +195,7 @@ of print. }
 @Book {donemus1982,
   year =  {1982},
   title = {Uitgeven van muziek},
+subtitle = {Handleiding voor componisten en copiisten},
   author = {Donemus},
   publisher= {Donemus Amsterdam},
 
index 12d07fcf16ac2e9bf9bcffad14f66fcf1599a219..8c6f0edd94353fa14419040ede9813f83e5307f3 100644 (file)
@@ -200,9 +200,11 @@ for i in functions:
                        key = re.sub ('[./]', '_', 'HAVE_' + string.upper (i))
                 defines[key] = '1'
 
-
 key = 'HAVE_FLEXLEXER_YY_CURRENT_BUFFER'
-defines[key] = conf.TryCompile ("""using namespace std;
+
+sys.stdout.write('Checking for yy_current_buffer ... ')
+sys.stdout.flush()
+res = conf.TryCompile ("""using namespace std;
 #include <FlexLexer.h>
 class yy_flex_lexer: public yyFlexLexer
 {
@@ -211,7 +213,13 @@ class yy_flex_lexer: public yyFlexLexer
     {
       yy_current_buffer = 0;
     }
-};""", 'cc')
+};""", '.cc')
+if res:
+       defines[key] = '1'
+       sys.stdout.write('yes\n')
+else:
+       sys.stdout.write('no\n')
+
 
 if conf.CheckLib ('dl'):
        pass
index b7c607b40bcb1ad602d95d6385deb92a038dbd87..50131ff88329c32cf4ff75fbcbe2acdb1eda83c0 100644 (file)
 texidoc = "Concave beams should be horizontal. Informally spoken,
   concave refers to the shape of the notes that are opposite a
   beam. If an up-beam has high notes on its center stems, then we call
-  it concave.  This example shows borderline cases. Only the beams
-  that are marked `horiz' should be printed horizontally.  "
+  it concave. If a beam is fails a test, the desired slope is printed
+  next to it."
 
 
 }
 
 
-%{
- However, what exactly
-it is that makes a beam concave is still unclear.
-
-Beams 1 and 3 should be sloped, 2 and 4 should be horizontal.  Two
-sane attempts of calculating concaveness of a beam fail to distinguish
-beams this way."
-%}
-
-
-\score{
-  \relative c'{
-
-%% This case seems easy: second beam should be horizontal.
-    
-    %% SCS-I Menuet I, m15
-    %% sloped
-    %% slope = -0.5ss
-    %% concaveness: 0.06
-    \clef bass
-    \time 3/4
-    \key g\major
-    a8 g fis e b dis
-    
-    %% SCS-I Menuet II, m20
-    %% horizontal
-    %% slope = 0
-    %% concaveness: 0.09
-    \key f\major
-    fis,^"horiz." a c es d c
-
-%%% Sarabande: the first beam, obviously more concave, is not horizontal,
-%%% but is matched with the next beam in the piece: context.
-    
-    %% Sarabande: m24
-    %% sloped
-    %% concaveness: 0.00
-    \stemUp
-     d,16[ a' b cis]
-
-    %% Sarabande: m25
-    %% horizontal
-    %% concaveness:a: 0.12
-     a'16[^"horiz." b c b]
-    
-% Hmm.  Concaveness of both: 1.75
-%     %% SCS-VI Prelude, m81
-%     %% slope = 0.0
-%     \stemBoth
-%     \key d\major
-%      e,8[ cis a']
-    
-%     %% SCS-VI Prelude, m82
-%     %% slope = 0.1ss (possibly b.o. context?)
-%      g,[ e' cis]
-
-    
-%%% Han-Wen: this should be concave
-       \break
-     a,16[^"horiz." a' a a]
-    \clef treble
-
-%%%% This should not be concave (hwn)
-    \stemUp bes8[  \stemDown d'8 bes8]  
-
-
-       \stemBoth
-%% morgenlied:
-       f16[^"horiz" b dis b f b]
+#(ly:set-option 'debug-beam #t)
+resetMeasure = \set Score.measurePosition = #(ly:make-moment 0 1)
+
+% examples from 
+rossFourBeams =\relative c'' {
+  \time 2/4
+  c8[ e b c]
+  b[ c d b]
+  c[ f b, c]
+
+  a[ f a f] a[ a' a, a']
+  a[ d, e g] a[ f f g]
+  c,[ b f' e]
+  b[ e g, e']
+  g[ d a' b]
+  c[ c, c c]
+  c[ c c c']
+  f,,[ b a g]
+  f[g g e]
+  a[ d, b' g]
+  }
+rossThreeBeams = \relative c'' {
+  \time 6/8
+  e[ a, c] f[ d g]
+  f,[ b g] a[ b f]
+  d'[ c b a b e]
+  c[ b a c b a]
+  d,[ g a g f e ]
+  a[ g f a g f]
+  d'[ g, a b c d]
+  f[ e d c b f']
+}
 
+rossBeams = \relative c'' {
+  \rossFourBeams
+  \rossThreeBeams
+  }
 
-%% sarabande m 25
-%{
-       this beam is horiz. in baerenreiter, but it is not really concave IMO.
+nonHorizBeams = \relative c'' {
+   \time 3/4
+   f[ e d c g b]
+   b,16[ f' g a]
+   \stemUp b,8[  \stemDown d'8 bes8]  
+}
 
 
-       \clef bass
-       \key f \major
-       \stemUp
-       a,16[ b c b ]
-       \stemBoth
-%}
 
-}
+#(define (<> x y) (not (= x  y)))
+\score{
+   \new Voice {
+     \override Beam #'position-callbacks = #(check-slope-callbacks =)
+     \rossBeams
+     \override Beam #'position-callbacks = #(check-slope-callbacks <>)
+  \resetMeasure
+     \nonHorizBeams
+     
+   }
   \paper{
     raggedright = ##t
   }
 }
 
-%% Local variables:
-%% LilyPond-indent-level:2
-%% End:
+#(ly:set-option 'debug-beam #f)
+
index 930163781d253659c1d7fb138aee13624b8a4300..3c627d3af6349643060e74082c751710b1bbdf34 100644 (file)
@@ -16,44 +16,33 @@ filler = \relative { e4 e }
 % 
 #(ly:set-option 'debug-beam #t)
 
-assertquant =
-#(def-music-function (location l r) (pair? pair?)
-  (let* ((f (check-quant-callbacks l r)))
-   
-   #{
-   \override Beam #'position-callbacks = $f
-   #}
-   
-))
-
-
 
 
 primes = \relative {
-    \assertquant #'(0 . 0)  #'(0 . 0)
+    \assertBeamQuant #'(0 . 0)  #'(0 . 0)
     c8[ c]
     \filler
-    \assertquant #'(1 . -1)  #'(1 . -1)
+    \assertBeamQuant #'(1 . -1)  #'(1 . -1)
     d8[ d]
      
     \filler
      
-    \assertquant #'(1 . 0)  #'(1 . 0)
+    \assertBeamQuant #'(1 . 0)  #'(1 . 0)
     e8[ e]
     \filler
      
      
-    \assertquant #'(2 . -1)  #'(2 . -1)
+    \assertBeamQuant #'(2 . -1)  #'(2 . -1)
     f8[ f]
     \filler
      
      
-    \assertquant #'(2 . 0)  #'(2 . 0)
+    \assertBeamQuant #'(2 . 0)  #'(2 . 0)
     g8[ g]
     \filler
      
      
-    \assertquant #'(2 . 1)  #'(2 . 1)
+    \assertBeamQuant #'(2 . 1)  #'(2 . 1)
     a8[ a]
     \filler
       
@@ -63,30 +52,30 @@ primes = \relative {
 }
 
 seconds = \relative {
-    \assertquant #'(0 . 1)  #'(0 . 1)
+    \assertBeamQuant #'(0 . 1)  #'(0 . 1)
     c8[ d]
     \filler
      
-    \assertquant #'(1 . -1)  #'(1 . 0)
+    \assertBeamQuant #'(1 . -1)  #'(1 . 0)
     d8[ e]
     \filler
      
      
-    \assertquant #'(1 . 0)  #'(1 . 1)
+    \assertBeamQuant #'(1 . 0)  #'(1 . 1)
     e8[ f]
     \filler
      
      
-    \assertquant #'(2 . -1)  #'(2 . 0)
+    \assertBeamQuant #'(2 . -1)  #'(2 . 0)
     f8[ g]
     \filler
      
      
-    \assertquant #'(2 . 0)  #'(2 . 1)
+    \assertBeamQuant #'(2 . 0)  #'(2 . 1)
     g8[ a]
     \filler
 
-    \assertquant #'(3 . -1)  #'(3 . 0)
+    \assertBeamQuant #'(3 . -1)  #'(3 . 0)
     a8[ b]
     \filler
 }
index 7b7c3d9cc39620476613627c9620ab590a25caf7..29b692ff272bfd9b20344752f4ffa489cc04dae6 100644 (file)
@@ -522,13 +522,13 @@ Beam::print (SCM grob)
       String str;
       SCM properties = Font_interface::text_font_alist_chain (me);
 
+      Direction stem_dir = stems.size() ? to_dir (stems[0]->get_property ("direction")) : UP;
+    
       Stencil tm = *unsmob_stencil (Text_item::interpret_markup
         (me->get_paper ()->self_scm (), properties, quant_score));
-      the_beam.add_at_edge (Y_AXIS, UP, tm, 5.0, 0);
+      the_beam.add_at_edge (Y_AXIS, stem_dir, tm, 1.0, 0);
     }
 #endif
-    
-  
   
   return the_beam.smobbed_copy ();
 }
index a757385a1d1a29ec9909c53148415ff22765eb6d..f6d277440021b54aec82b77841ca368429bc1cb5 100644 (file)
@@ -7,6 +7,7 @@
 */
 
 #include <sstream>
+
 #include "config.h"
 
 #include "includable-lexer.hh"
index 9c4e53db80f9e65e32b6ee8134ee2f8b9b68ce93..6e6ffe1e34fe857915227de53590f5ee81d0819b 100644 (file)
@@ -76,3 +76,27 @@ sostenutoUp = #(make-span-event 'SostenutoEvent STOP)
 %crescpoco = \set crescendoText = "cresc. poco a poco"
 %decresc = \set crescendoText = "decr."
 %dim = \set crescendoText = "dim."
+
+
+% for regression testing purposes.
+assertBeamQuant =
+#(def-music-function (location l r) (pair? pair?)
+  (let* ((f (check-quant-callbacks l r)))
+   
+   #{
+   \once \override Beam #'position-callbacks = $f
+   #}
+   
+))
+
+% for regression testing purposes.
+assertBeamSlope =
+#(def-music-function (location comp) (procedure?)
+  (let* ((f (check-slope-callbacks comp)))
+   
+   #{
+   \once \override Beam #'position-callbacks = $f
+   #}
+   
+))
+
index 858053fdc86c31d4e8c20200674007b73c06807e..874e0423d584c69944799daf0b909a9bcf60623e 100644 (file)
        (set! (ly:grob-property beam 'quant-score) "")
 
        
+         )))
+(define ((check-beam-slope-sign comparison) beam)
+  "Check whether the slope of BEAM is correct wrt. COMPARISON."
+  (let*
+      ((posns (ly:grob-property beam 'positions))
+       (slope-sign (- (cdr posns) (car posns)))
+       (correct (comparison slope-sign 0)))
+
+    
+    (if (not correct)
+       (begin
+         (ly:warn
+          (format "Error in beam quanting found. Want ~S 0 found ~S."
+                  (procedure-name comparison) slope-sign
+                  ))
+         (set! (ly:grob-property beam 'quant-score)
+               (format "~S 0" (procedure-name comparison) )))
+       (set! (ly:grob-property beam 'quant-score) "")
+
+       
          )))
                 
 (define-public (check-quant-callbacks l r)
     (check-beam-quant l r)
     ))
 
+                
+(define-public (check-slope-callbacks comparison)
+  (list Beam::least_squares
+    Beam::check_concave
+    Beam::slope_damping
+    Beam::shift_region_to_valid
+    Beam::quanting
+    (check-beam-slope-sign comparison)
+    ))
+
   
index 77e3202d9025c8894df995f0d54ae828072bb6c8..4c3261e7b0a14ae15a580bf7c8a8dd5fa49a1ed5 100644 (file)
@@ -157,7 +157,7 @@ square of the inner notes involved.")
 
      (control-points ,list? "List of 4 offsets (number-pairs) that form control points for the  tie/slur shape.")
 
-     (damping ,integer? "Amount of beam slope damping. 0: no, 1: yes,
+     (damping ,number? "Amount of beam slope damping. 0: no, 1: yes,
 100000: horizontal beams.")
      (dash-period ,number? "the length of one dash + white space. If
 negative, no line is drawn at all.")
index 29f93cba30469766b6a403b19da2a3cb2d405f23..0c57f21b5a95eb2822b578a3dceeb219ed59516c 100644 (file)
@@ -18,6 +18,7 @@
         ("marcato" .
          (
           (script-stencil . (feta . ("dmarcato" . "umarcato")))
+          (follow-into-staff . #t)
           (side-relative-direction .  -1)))
         ("staccatissimo" .
          (