]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.15.jcn4
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 21 Dec 1999 20:55:32 +0000 (21:55 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 21 Dec 1999 20:55:32 +0000 (21:55 +0100)
pl 15.jcn4
- removed old notename2scm conversion
- beam-dir-algorithm through scm
- bfs paper-scm
- bf: knee-stemlengths

pl 15.jcn3

14 files changed:
CHANGES
VERSION
input/test/banter-chords.ly
input/test/knee-mult.ly [new file with mode: 0644]
lily/beam.cc
lily/chord-name-engraver.cc
lily/chord-name.cc
lily/include/beam.hh
lily/include/chord-name.hh
lily/stem.cc
ly/params.ly
scm/chord-names.scm
scm/generic-property.scm
scm/paper.scm

diff --git a/CHANGES b/CHANGES
index cc642f8d83a74fb3a7c698782eb798e3ca52ca2d..2821f437c013970447002bb53e420b667eb22c18 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,10 @@
-pl 15.jcn2
+pl 15.jcn4
+       - removed old notename2scm conversion
+       - beam-dir-algorithm through scm
+       - bfs paper-scm
+       - bf: knee-stemlengths
+
+pl 15.jcn3
        - moved poor man's stem arrays to scm
        
 pl 15.jcn2
diff --git a/VERSION b/VERSION
index 4a05daddf6b3187a29147963b622d1232ad2cca0..d1c8ac5e5e20d6759434fdaca92abc19211d19a2 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=15
-MY_PATCH_LEVEL=jcn3
+MY_PATCH_LEVEL=jcn4
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 77ef6e5f063d34f0a5597c161683590f76c638aa..4fce5022c5dbd8ca7bc997e18db4b41623222fa4 100644 (file)
@@ -16,14 +16,14 @@ TestedFeatures =     "Banter named chords";
 % when this file has been parsed...
 
 % {
-#(set! pitch-names-alist
+#(set! note-names-alist
       (append 
       '(
        ; use these for German naming
        ((6 . 0) . ("H" ""))
        ((6 . -1) . ("B" ("feta-1" . "\12")))
        )
-      pitch-names-alist))
+      note-names-alist))
 
 #(set! chord-names-alist
       (append 
diff --git a/input/test/knee-mult.ly b/input/test/knee-mult.ly
new file mode 100644 (file)
index 0000000..98eb914
--- /dev/null
@@ -0,0 +1,24 @@
+\score{
+       \context PianoStaff <
+       \context Staff=one \notes\relative c'{
+               s1
+       }
+       \context Staff=two \notes\relative c'{
+               \clef bass;
+% no knee
+               \stemup [c8 \translator Staff=one \stemdown g'16 f]
+               s8
+               s2
+       }
+       >
+       \paper{
+               \translator{
+                       \GrandStaffContext
+                       minVerticalAlign = 2.8*\staffheight;
+                       maxVerticalAlign = 2.8*\staffheight;
+               }
+               linewidth=-1.;
+       }
+}
+
+\version "1.3.5"; 
index c77b84839ca72d75d9965b18c8663fc6ead8b6ef..b0a7deffc5429d2470eb35781c13e2b991f2885e 100644 (file)
@@ -120,46 +120,21 @@ Beam::get_default_dir () const
 
     } while (flip(&d) != DOWN);
   
-  /* 
-     [Ross] states that the majority of the notes dictates the
-     direction (and not the mean of "center distance")
 
-     But is that because it really looks better, or because he wants
-     to provide some real simple hands-on rules?
-     
-     We have our doubts, so we simply provide all sensible alternatives.
-
-     If dir is not determined: up (see stem::get_default_dir ()) */
-
-  Direction beam_dir = CENTER;
-  Direction neutral_dir = (Direction)(int)paper_l ()->get_var ("stem_default_neutral_direction");
-
-  SCM a = get_elt_property ("beam-dir-algorithm");
-  
-  if (a == ly_symbol2scm ("majority")) // should get default from paper.
-    beam_dir = (count[UP] == count[DOWN]) ? neutral_dir 
-      : (count[UP] > count[DOWN]) ? UP : DOWN;
-  else if (a == ly_symbol2scm ("mean"))
-    // mean center distance
-    beam_dir = (total[UP] == total[DOWN]) ? neutral_dir
-      : (total[UP] > total[DOWN]) ? UP : DOWN;
-  else if (a == ly_symbol2scm ("median"))
-    {
-      // median center distance
-      if (count[DOWN] && count[UP])
-       {
-         beam_dir = (total[UP] / count[UP] == total[DOWN] / count[DOWN]) 
-           ? neutral_dir 
-           : (total[UP] / count[UP] > total[DOWN] / count[DOWN]) ? UP : DOWN;
-       }
-      else
-       {
-         beam_dir = (count[UP] == count[DOWN]) ? neutral_dir 
-           : (count[UP] > count[DOWN]) ? UP : DOWN;
-       }
-    }
+  SCM s = scm_eval (gh_list (ly_symbol2scm ("beam-dir-algorithm"),
+                            ly_quote_scm (gh_cons (gh_int2scm (count[UP]),
+                                                   gh_int2scm (count[DOWN]))),
+                            ly_quote_scm (gh_cons (gh_int2scm (total[UP]),
+                                                   gh_int2scm (total[DOWN]))),
+                            SCM_UNDEFINED));
+  if (gh_number_p (s) && gh_scm2int (s))
+    return to_dir (s);
   
-  return beam_dir;
+  /*
+    If dir is not determined: get from paper
+  */
+  return (Direction)(int)
+    paper_l ()->get_var ("stem_default_neutral_direction");
 }
 
 
@@ -444,16 +419,16 @@ Beam::calc_stem_y_f (Stem* s, Real y, Real dy) const
   if (get_direction () != s->get_direction ())
     {
       stem_y -= get_direction ()
-       * (thick / 2 + (beam_multiplicity - 1 - stem_multiplicity))
-       * interbeam_f;
+       * (thick / 2 + (beam_multiplicity - 1) * interbeam_f);
 
       Staff_symbol_referencer_interface me (s);
       Staff_symbol_referencer_interface last (last_visible_stem ());
       
-      if ((s != first_visible_stem ())
-         && me.staff_symbol_l () != last.staff_symbol_l ())
-       stem_y += get_direction () 
-                 * (beam_multiplicity - stem_multiplicity) * interbeam_f;
+      // huh, why not for first visible?
+      if (//(s != first_visible_stem ()) &&
+         me.staff_symbol_l () != last.staff_symbol_l ())
+       stem_y += get_direction ()
+         * (beam_multiplicity - stem_multiplicity) * interbeam_f;
     }
   return stem_y;
 }
index c22fd18a5b73679c6673f11066dff3d65b4191bb..e5e31c38f5ddaad8138b21a91a6f5226e13d9087 100644 (file)
@@ -15,6 +15,7 @@
 #include "main.hh"
 #include "dimensions.hh"
 #include "text-item.hh"
+#include "lily-guile.icc"
 
 ADD_THIS_TRANSLATOR (Chord_name_engraver);
 
@@ -73,8 +74,20 @@ Chord_name_engraver::do_process_requests ()
     find_inversion_b = gh_scm2bool (chord_inversion);
 
   chord_name_p_ = new Chord_name;
-  chord_name_p_->set (to_chord (pitch_arr_, tonic_req_, inversion_req_, bass_req_, find_inversion_b));
-    
+  Chord chord = to_chord (pitch_arr_, tonic_req_, inversion_req_, bass_req_,
+                         find_inversion_b);
+
+  /*
+    Hmm, why not represent complete chord as list?
+    ((tonic third fifth) (inversion bass))
+  */
+  chord_name_p_->set_elt_property ("pitches", array_to_scm (chord.pitch_arr_));
+  if (chord.inversion_b_)
+    chord_name_p_->set_elt_property ("inversion",
+                                    to_scm (chord.inversion_pitch_));
+  if (chord.bass_b_)
+    chord_name_p_->set_elt_property ("bass", to_scm (chord.bass_pitch_));
+
   announce_element (Score_element_info (chord_name_p_, 0));
 }
 
index 4b6eff78a91104e6649674a2863f17c026d8c633..f994dd34527405a7edf9bfce51da9827a01007c0 100644 (file)
 #include "lily-guile.icc"
 
 /*
-  ugh, move to chord-name-engraver
-
-  Hmm, why not represent complete chord as list?
-  ((tonic third fifth) (inversion bass))
- */
-void
-Chord_name::set (Chord const& c)
-{
-  set_elt_property ("pitches", array_to_scm (c.pitch_arr_));
-  if (c.inversion_b_)
-    set_elt_property ("inversion", to_scm (c.inversion_pitch_));
-  if (c.bass_b_)
-    set_elt_property ("bass", to_scm (c.bass_pitch_));
-}
-
-/*
-  junkme
+  TODO: move text lookup out of Chord_name
  */
 
-SCM
-notename2scm (Musical_pitch p)
-{
-  return gh_cons (gh_int2scm (p.notename_i_), gh_int2scm (p.accidental_i_));
-}
-
 /*
   word is roman text or styled text:
    "text"
@@ -72,21 +50,21 @@ Chord_name::ly_text2molecule (SCM scm) const
     {
       while (gh_cdr (scm) != SCM_EOL)
         {
-         mol.add_at_edge (X_AXIS, RIGHT, 
-            ly_word2molecule (gh_car (scm)), 0);
+         mol.add_at_edge (X_AXIS, RIGHT, ly_word2molecule (gh_car (scm)), 0);
          scm = gh_cdr (scm);
        }
       scm = gh_car (scm);
     }  
-  mol.add_at_edge (X_AXIS, RIGHT, 
-    ly_word2molecule (scm), 0);
+  mol.add_at_edge (X_AXIS, RIGHT, ly_word2molecule (scm), 0);
   return mol;
 }
 
 Molecule
 Chord_name::pitch2molecule (Musical_pitch p) const
 {
-  SCM name = scm_eval (gh_list (ly_symbol2scm ("user-pitch-name"), ly_quote_scm (notename2scm (p)), SCM_UNDEFINED));
+  SCM name = scm_eval (gh_list (ly_symbol2scm ("user-pitch-name"),
+                               ly_quote_scm (to_scm (p)),
+                               SCM_UNDEFINED));
 
   if (name != SCM_UNSPECIFIED)
     {
@@ -129,17 +107,26 @@ diff_pitch (Musical_pitch tonic, Musical_pitch  p)
   return diff;
 }
 
+/*
+  JUNKME
+ */
 bool
 Chord_name::user_chord_name (Array<Musical_pitch> pitch_arr, Chord_mol* name_p) const
 {
-  SCM chord = SCM_EOL;
   Array<Musical_pitch> chord_type = pitch_arr;
   Chord::rebuild_transpose (&chord_type, diff_pitch (pitch_arr[0], Musical_pitch (0)), false);
 
+#if 0
+  SCM chord = SCM_EOL;
   for (int i= chord_type.size (); i--; )
-    chord = gh_cons (notename2scm (chord_type[i]), chord);
+    chord = gh_cons (to_scm (chord_type[i]), chord);
+#else
+  SCM chord = array_to_scm (chord_type);
+#endif
 
-  SCM name = scm_eval (gh_list (ly_symbol2scm ("user-chord-name"), ly_quote_scm (chord), SCM_UNDEFINED));
+  SCM name = scm_eval (gh_list (ly_symbol2scm ("user-chord-name"),
+                               ly_quote_scm (chord),
+                               SCM_UNDEFINED));
   if (gh_pair_p (name))
     {
       name_p->modifier_mol = ly_text2molecule (gh_car (name));
index 13e3421f0c8fcf58ac47d7721edbd7985ddbc9d1..cf101fd89534073d55f92a3eeece5c5a6b9db750 100644 (file)
   Beam adjusts the stems its owns to make sure that they reach the
   beam and that point in the correct direction (urg?)
 
-elt property:
-
-damping: amount of beam slope damping. (int)
-
-should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams 
-
-slope_quantisation: 'none, 'normal or 'traditional
+   elt_properties:
+   y-position: real  (position of left edge)
+   height: real  (dy)
 
+   damping: amount of beam slope damping. (int)
+   should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams 
 */
 class Beam : public Directional_spanner
 {
index 04c20ffb18dac118a4b3154aae5cde871903ef3e..dc49f205c23f6ce26d891de2c3a94902a5559580 100644 (file)
@@ -23,6 +23,12 @@ public:
   Molecule bass_mol;
 };
 
+/**
+   elt_properties:
+   pitches: list of musical-pitch
+   inversion(optional): musical-pitch
+   bass(optional): musical-pitch
+ */
 class Chord_name : public Item
 {
 public:
@@ -33,8 +39,6 @@ public:
   bool user_chord_name (Array<Musical_pitch> pitch_arr, Chord_mol* name_p) const;
   void banter (Array<Musical_pitch> pitch_arr, Chord_mol* name_p) const;
 
-  void set (Chord const& c);
-
 protected:
   virtual Molecule* do_brew_molecule_p () const;
 };
index 4ef5b7de2c41f36490227b2bf9c7d067d269c876..d4bea2a5eccefa026d4128dd3b085e42f4123359 100644 (file)
@@ -260,16 +260,6 @@ Stem::get_default_stemlen () const
       && (get_direction () != get_default_dir ()))
     length_f -= shorten_f;
 
-#if 0
-  /*
-    UGK.!
-   */
- if (flag_i () >= 5)
-    length_f += 2.0;
-  if (flag_i () >= 6)
-    length_f += 1.0;
-#endif
-  
   Real st_f = head_positions()[-dir] + dir * length_f;
 
   bool no_extend_b = get_elt_property ("no-stem-extend") != SCM_UNDEFINED;
index 4a9018966a1b4f572a587ec867839faefb28f6bc..4a8de0dbaacfa45dbca5c24241b2783995807698 100644 (file)
@@ -34,15 +34,6 @@ to the width of a quarter note head.
 arithmetic_basicspace = 2.;
 arithmetic_multiplier = 0.9 * \quartwidth ;
 
-% there are several ways to calculate the direction of a beam
-% 
-% * MAJORITY : number count of up or down notes
-% * MEAN     : mean centre distance of all notes
-% * MEDIAN   : mean centre distance weighted per note
-%
-
-#'beam-dir-algorithm = #'majority      %urg.
-
 
 #'Stem_tremolo::beam-width = 1.5 * \quartwidth ; 
 
index 3329c144d618defc29d9491a9e19f750feab373b..a5a428d649affda0a3e5c768f5e2554e0474bafb 100644 (file)
@@ -1,11 +1,11 @@
-;; pitch: (notename . accidental)
+;; note-name: (note . accidental)
 ;; list:  (list-of-pitches . (modifier-string . addition-subtraction-string))
 
 ;; if a complete chord is found, use name
 ;; if a chord's base triad is found (c e g), use name
 
-(define pitch-names-alist '())
-(set! pitch-names-alist
+(define note-names-alist '())
+(set! note-names-alist
       (append 
       '(
        ; use these for German naming
        ;((0 . 1) . ("C" ("feta-1" . "\10")))
        ;((0 . -1) . ("C" ("feta-1" . "\12")))
        )
-      pitch-names-alist))
+      note-names-alist))
 
+(define (pitch->note-name pitch)
+  (cons (car pitch) (cadr pitch)))
+  
 (define (user-pitch-name pitch)
-  (let ((entry (assoc pitch pitch-names-alist)))
+  (let ((entry (assoc (pitch->note-name pitch) note-names-alist)))
        (if entry
           (cdr entry))))
 
@@ -47,9 +50,7 @@
       chord-names-alist))
 
 (define (user-chord-name chord)
-  ;(display chord)
-  ;(newline)
-  (let ((entry (assoc chord chord-names-alist)))
-       (if entry
-          (cdr entry))))
-
+  (let ((entry (assoc (map (lambda (x) (pitch->note-name x)) chord)
+                     chord-names-alist)))
+    (if entry
+       (cdr entry))))
index c6104e21d7c2e3c5f6cb1c399ebb0884934a47b4..e622e9d0dcfbad1c5acfb5e466c456b5005b489a 100644 (file)
@@ -5,7 +5,6 @@
         (list 'beamSlopeDamping number? 'damping)
         (list 'autoKneeGap number? 'auto-knee-gap)
         (list 'autoInterstaffKneeGap number? 'auto-interstaff-knee-gap)
-        (list 'beamQuantisation symbol? 'slope-quantisation)
         (list 'beamDirAlgorithm symbol? 'beam-dir-algorithm)
         (list 'beamSlope number? 'height)
         (list 'beamVerticalPosition number? 'y-position)
index ce28ebf4bf42e751695cfdbe30c53c0538dae338..3c291a4f09044b33daf6d022d0805b0eb3060c30 100644 (file)
 
 ;; inter seems to be a modern quirk, we don't use that
 
+(define staff-line 0.10)
+(define beam-thickness (* 0.52 (- 1 staff-line)))
+(define beam-straddle 0)
+(define beam-sit (/ (+ beam-thickness staff-line) 2))
+(define beam-hang (- 1 (/ (- beam-thickness staff-line) 2)))
+
 (define beam-normal-dy-quants
-  '(0 (/2 (+ beam-thickness staff-line) 2) (+ beam-thickness staff-line) 1))
+  (list 0 (/ (+ beam-thickness staff-line) 2) (+ beam-thickness staff-line) 1))
 
 ;; two popular veritcal beam quantings
 ;; see params.ly: #'beam-vertical-quants
 (define (beam-normal-y-quants multiplicity dy)
-  (let ((quants `(,beam-hang 1)))
+  (let ((quants (list beam-hang 1)))
     (if (or (<= multiplicity 1) (>= (abs dy) (/ staff-line 2)))
        (set! quants (cons beam-sit quants)))
     (if (or (<= multiplicity 2) (>= (abs dy) (/ staff-line 2)))
     quants))
 
 
-;;; Default variables and settings
+;; There are several ways to calculate the direction of a beam
+;;
+;; * majority: number count of up or down notes
+;; * mean    : mean centre distance of all notes
+;; * median  : mean centre distance weighted per note
+
+(define (dir-compare up down)
+  (if (= up down)
+      0
+      (if (> up down)
+         1
+         -1)))
+
+;; (up . down)
+(define (beam-dir-majority count total)
+  (dir-compare (car count) (cdr count)))
+
+(define (beam-dir-mean count total)
+  (dir-compare (car total) (cdr total)))
+
+(define (beam-dir-median count total)
+  (if (and (> (car count) 0)
+          (> (cdr count) 0))
+      (dir-compare (/ (car total) (car count)) (/ (cdr total) (cdr count)))
+      (dir-compare (car count) (cdr count))))
+           
 
-(define staff-line 0.10)
-(define beam-thickness (* 0.52 (- 1 staff-line)))
-(define beam-straddle 0)
-(define beam-sit (/ (+ beam-thickness staff-line) 2))
-(define beam-hang (- 1 (/ (- beam-thickness staff-line) 2)))
+;;; Default variables and settings
 
 (define beam-height-quants beam-normal-dy-quants)
 (define beam-vertical-position-quants beam-normal-y-quants)
 
 
+;; [Ross] states that the majority of the notes dictates the
+;; direction (and not the mean of "center distance")
+;;
+;; But is that because it really looks better, or because he wants
+;; to provide some real simple hands-on rules?
+;;     
+;; We have our doubts, so we simply provide all sensible alternatives.
+(define beam-dir-algorithm beam-dir-majority)
+
+
 ;; array index flag-2 (what a name!!), last if index>size
 ;; unbeamed stems
 (define stem-length '(3.5 3.5 3.5 4.5 5.0))
 ;; beamed stems
 (define beamed-stem-shorten '(0.5))
 (define beamed-stem-length '(0.0 2.5 2.0 1.5))
-(define beamed-stem-minimum-length '(0.0 3.0 2.5 2.0))
+(define beamed-stem-minimum-length '(0.0 1.5 1.25 1.0))
 (define grace-beamed-stem-minimum-length
   (map (lambda (x) (* grace-length-factor x)) beamed-stem-minimum-length))