]> git.donarmstrong.com Git - lilypond.git/commitdiff
(determine-split-list): analysis has
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 24 Jan 2004 00:38:44 +0000 (00:38 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 24 Jan 2004 00:38:44 +0000 (00:38 +0000)
global effect: a difference halfway a phrase makes the entire
phrase be typeset as apart.

ChangeLog
Documentation/user/refman.itely
THANKS
input/regression/new-part-combine.ly
input/regression/part-combine-global.ly [new file with mode: 0644]
lily/new-part-combine-iterator.cc
ly/performer-init.ly
scm/music-functions.scm

index 6448ea29e56595df68c7a76048c218d34665dbc7..2d8e13a48d35c550fdaeb24333498973841cfdd9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2004-01-24  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * scm/music-functions.scm (determine-split-list): analysis has
+       global effect: a difference halfway a phrase makes the entire
+       phrase be typeset as apart.
+
+2004-01-23  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * ly/performer-init.ly: add Devnull.
+
+       * Documentation/user/refman.itely (Font selection): remove paper20
+       ref.
+       
 2004-01-22  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * scripts/convert-ly.py (1.9.0): Handle phrasing slur.
index 2dafbd0c0f48f04edae095d227ee18e76ca61bcc..88eeef73cf003baa057a301072b76c95c271b377 100644 (file)
@@ -7769,22 +7769,22 @@ A property tweak of modifies a local copy of the object definition.
 After such a tweak, the definition is independent of the objects in
 enclosing contexts. For example
 
-@lilypond
-  \property Voice.Stem \set #'neutral-direction = #1
-  b'8
+@lilypond[verbatim,fragment]
+  \property Voice.Stem \set #'direction = #1
+  a'4
   \property Staff.Stem \set #'thickness = #4.0
-  b'16
-  \new Voice { b'32 }
+  a'8
+  \new Voice { a'32 }
 @end lilypond
 
-In this fragment, @code{neutral-direction} is tweaked. As a result,
-the current @internalsref{Voice} gets a private version of the
+In this fragment, @code{direction} is tweaked. As a result, the
+current @internalsref{Voice} gets a private version of the
 @internalsref{Stem} object. The following tweak modifies the
 definition at @internalsref{Staff} level. Since it a different
-definition, the thickness of the @code{b'16} is unaffected.  For the
-third note, a new Voice is created, which inherits the new definition,
-including the changed thickness, but excluding the new neutral
-direction.
+definition, the thickness of the first @code{b'16} is unaffected.  For
+the third note, a new Voice is created, which inherits the new
+definition, including the changed thickness, but excluding the new
+neutral direction.
 
 
 
@@ -8095,8 +8095,8 @@ The following commands set @code{fontSize} for the current voice.
 
 @seealso
 
-Init files: @file{ly/paper20.ly} contains hints how new fonts may be
-added to LilyPond.
+Init files: @file{ly/declarations-init.ly} contains hints how new
+fonts may be added to LilyPond.
 
 @refbugs
 
diff --git a/THANKS b/THANKS
index 45cc9324c167c2c38fffbdb9edd16158fa9a72a8..a34e55b3f6ef8912722bf0e7847de944d931699c 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -11,6 +11,8 @@ Reuben Thomas
 Thomas Willhalm
 Werner Lemberg
 Nicolas Sceaux 
+Nick Busigin
+
 
 Release 2.0
 ***********
index f258691e60ea6df3555967a6c743ad7ebe3a7f53..1e315e6e36ad736be15e3d4c85bc8834448f9fc1 100644 (file)
@@ -14,8 +14,8 @@ theMusic = \context Staff \notes { c4 d8-. }
 
 
 
-vone = \notes \relative a' { g2 g    g  g4 g f' c c( c)  }
-vtwo = \notes \relative a' { f2 f4 f f2 g4 g c, f f  f   }
+vone = \notes \relative a' { g2 g    g  g4 g f' c c( c) c c  c ~ c }
+vtwo = \notes \relative a' { f2 f4 f f2 g4 g c, f f  f  f f~ f ~ f }
 
 \score {
    \newpartcombine \vone \vtwo
diff --git a/input/regression/part-combine-global.ly b/input/regression/part-combine-global.ly
new file mode 100644 (file)
index 0000000..b39d9e0
--- /dev/null
@@ -0,0 +1,34 @@
+
+
+\header { texidoc=
+
+         "The analysis of the part combiner is non-local:
+in the following example, the decision for using separate voices in
+the 1st measure is made on the 2nd note, but influences the 1st note.
+
+In the 2nd measure, the pattern without the tie, leads to combined
+voices.
+  
+"
+    }
+\version "1.9.8"
+
+vone =\notes
+
+%%%%%%%%%%%%%%  0   1   2   3  
+\relative c'' {
+    \time 2/4
+    a8[ a]  a8[ a] |
+    a8[ a]  a8[ a]
+}
+
+vtwo =\notes
+\relative c' {
+    \time 2/4
+    f8[ f]~ f8[ f] |
+    f8[ f]  f8[ f]
+}
+
+\score {
+    \newpartcombine \vone \vtwo
+    }
index 3bfcb5dcaa5ac37030fd162401a9ecdbd50d1c6e..48a8039e35cc03faf4f1d353b87a4280cc60fbcb 100644 (file)
@@ -261,7 +261,8 @@ New_pc_iterator::process (Moment m)
        solo2 ();
       else
        {
-         String s =  "Unknown split directive: " + ly_symbol2string (tag);
+         String s =  "Unknown split directive: "
+           + (gh_symbol_p (tag) ? ly_symbol2string (tag) : String ("not a symbol")); 
          programming_error (s);
        }
     }
index 0d21c2d45fba43646ebd80ba42ef6fb63d8942a2..e35ecdf74fc4340806e1264594fb938df8905fe7 100644 (file)
@@ -73,6 +73,7 @@
        \accepts TabStaff
        \accepts Lyrics 
        \accepts StaffGroup
+       \accepts Devnull
        \accepts ChoirStaff
        \accepts RhythmicStaff
        \accepts ChordNames
index 4ee6dcd4a9468d3b801276d80a7c6bdd26564f64..74f42bc1f061e30c65870a049c5ba7207322a64c 100644 (file)
@@ -835,6 +835,10 @@ Rest can contain a list of beat groupings
 ;; stack traces result in core dumps.
 ;; therefore we retain debugging code.
 ;;
+
+;;
+;; todo: this is too hairy.
+;;
 (define-public (determine-split-list evl1 evl2)
   "EVL1 and EVL2 should be ascending"
   
@@ -854,41 +858,77 @@ Rest can contain a list of beat groupings
          (uniq-list
          (merge (map car evl1) (map car evl2) ly:moment<?)))))
 
-  (define (analyse-events i1 i2 ri
-                         active1
-                         active2)
-
-    (define (analyse-span-events active evs)
-      (define (analyse-span-event active ev)
-       (let*
-           ((name (ly:get-mus-property ev 'name))
-            (key (cond
-                  ((equal? name 'SlurEvent) 'slur)
-                  ((equal? name 'PhrasingSlurEvent) 'tie)
-                  ((equal? name 'Beam) 'beam)
-                  (else #f)))
-            (sp (ly:get-mus-property ev 'span-direction)))
-
-          (if (and (symbol? key) (ly:dir? sp))
-              ((if (= sp STOP) delete! cons) key active)
-              active))
-       )
+  (define (analyse-time-step i1 i2 ri
+                            active1
+                            active2)
 
-      (if (pair? evs)
-         (analyse-span-events
-          (analyse-span-event active (car evs))
-          (cdr evs))
+    (define (analyse-tie-start active ev)
+      (if (equal? (ly:get-mus-property ev 'name) 'TieEvent)
+         (acons 'tie ri active)
          active
          ))
     
+    (define (analyse-tie-end active ev)
+      (if (equal? (ly:get-mus-property ev 'name) 'NoteEvent)
+         (assoc-remove!  active 'tie)
+         active) )
+    (define (active<? a b)
+      (cond
+       ((symbol<? (car a) (car b)) #t)
+       ((symbol<? (car b) (car b)) #f)
+       (else
+       (< (cdr a) (cdr b)))
+       ))
+    
+    (define (analyse-span-event active ev)
+      (let*
+         ((name (ly:get-mus-property ev 'name))
+          (key (cond
+                      ((equal? name 'SlurEvent) 'slur)
+                      ((equal? name 'PhrasingSlurEvent) 'tie)
+                      ((equal? name 'BeamEvent) 'beam)
+                      ((equal? name 'CrescendoEvent) 'cresc)
+                      ((equal? name 'DecrescendoEvent) 'decr)
+                      (else #f)) )
+          (sp (ly:get-mus-property ev 'span-direction))
+          )
+
+       (if (and (symbol? key) (ly:dir? sp))
+           (if (= sp STOP)
+               (assoc-remove! active key)
+               (acons key ri active))
+           active)
+       ))
+
+    (define (analyse-events active evs)
+      (define (helper analyzer active evs)
+       (if (pair? evs)
+           (helper analyzer (analyzer active (car evs)) (cdr evs))
+           active
+           ))
+      (sort
+       (helper analyse-span-event
+              (helper analyse-tie-start
+                      (helper analyse-tie-end active evs) evs) evs)
+       active<?))
+    
     (define (get-note-evs v i)
       (define (f? x)
        (equal? (ly:get-mus-property  x 'name) 'NoteEvent))
       (filter f? (map car (what v i))))
     
     (define (put x . index)
-      (set-cdr! (vector-ref result (if (pair? index)
-                                      (car index) ri)) x) )
+      "Put the result to X, starting from INDEX backwards."
+      (let
+         ((i (if (pair? index) (car index) ri)))
+
+       (if (and (<= 0 i) (not (symbol? (what result i))))
+           (begin
+             (set-cdr! (vector-ref result i) x)
+             (put x (1- i))
+           ))
+       ))
+       
 
 ;    (display (list i1 i2 ri active1 active2 (vector-length ev1) (vector-length ev2) (vector-length result)  "\n"))
     (cond
@@ -902,13 +942,12 @@ Rest can contain a list of beat groupings
           (m1 (when ev1 i1))
           (m2 (when ev2 i2))
 ;         (x (display "oked"))
-          (new-active1
-           (sort
-            (analyse-span-events active1 (map car (what ev1 i1)))
-            symbol<?))
-          (new-active2
-           (sort (analyse-span-events active2 (map car (what ev2 i2)))
-                 symbol<?)))
+          (evs1 (map car (what ev1 i1)))
+          (evs2 (map car (what ev2 i2)))
+          
+          (new-active1 (analyse-events active1 evs1))
+          (new-active2 (analyse-events active2 evs2))
+          )
        
        (if (not (or (equal? m1 (when result ri))
                     (equal? m2 (when result ri))))
@@ -917,20 +956,18 @@ Rest can contain a list of beat groupings
               (list "<? M1,M2 != result :"
                     m1 m2 (when result ri)))
              (scm-error "boem")))
-       
+
        (cond
         ((ly:moment<? m1 m2)
          (put 'apart)
          (if (> ri 0) (put 'apart (1- ri)))
-         (analyse-events (1+ i1) i2 (1+ ri) new-active1 new-active2))
+         (analyse-time-step (1+ i1) i2 (1+ ri) new-active1 new-active2))
         ((ly:moment<? m2 m1)
          (put 'apart)
          (if (> ri 0) (put 'apart (1- ri)))
-         (analyse-events i1 (1+ i2) (1+ ri) new-active1 new-active2))
+         (analyse-time-step i1 (1+ i2) (1+ ri) new-active1 new-active2))
         (else
-         (if (or (not (equal? active1 active2)) (not (equal? new-active2 new-active1)))
-             (put 'apart)
-
+         (if (and (equal? active1 active2) (equal? new-active2 new-active1))
              (let*
                  ((notes1 (get-note-evs ev1 i1))
                   (pitches1 (sort
@@ -940,27 +977,36 @@ Rest can contain a list of beat groupings
                              (map (lambda (x) (ly:get-mus-property x 'pitch)) notes2) ly:pitch<?))
                   )
                (cond
-                ((equal? pitches1 pitches2) (put 'unisono))
                 ((= (length notes1) 0) (put 'solo2))
                 ((= (length notes2) 0) (put 'solo1))
                 ((> (length notes1) 1) (put 'apart))
                 ((> (length notes2) 1) (put 'apart))
                 (else
-                 (let* (
-;                       (bla (display (list (length pitches1) (length pitches2))))
-                        (diff (ly:pitch-diff (car pitches1) (car pitches2))))
-                   (if (< (ly:pitch-steps diff) chord-threshold)
-                       (put 'chords)
-                       (put 'apart))
-                   ))))
-             )
-         (analyse-events (1+ i1) (1+ i2) (1+ ri) new-active1 new-active2))
+                 (if (< chord-threshold (ly:pitch-steps
+                         (ly:pitch-diff (car pitches1) (car pitches2))))
+                       (put 'apart)
+
+
+                       ;; copy previous split state from spanner state
+                       (begin
+                         (map (lambda (key-idx)
+                                (let*
+                                    ((idx (cdr key-idx))
+                                     (prev (what result  idx))
+                                     )
+                                  (if (symbol? prev)
+                                      (put prev))
+                                  )) (append active1 active2))
+                         (if (and (null? new-active1) (null? new-active2))
+                             (put 'chords ri)))
+                   
+                   ))) )
+             ;; active states different: 
+             (put 'apart) )
+         (analyse-time-step (1+ i1) (1+ i2) (1+ ri) new-active1 new-active2))
         )))))
 
 
-   (analyse-events 0 0  0 '() '())
+   (analyse-time-step 0 0  0 '() '())
+;   (display result)
    (vector->list result))
-
-
-
-; (determine-split-list '((1 . 2) (3 . 4)) '((1 . 2) (3 . 4)))