]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/output-ps.scm (output-scopes): use ly:paper-lookup for font
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 4 Mar 2004 12:09:42 +0000 (12:09 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 4 Mar 2004 12:09:42 +0000 (12:09 +0000)
props.

* input/test/tie-sparse.ly: remove.

* lily/tie-performer.cc (try_music): copy & paste from
Tie_engraver.

* lily/music-output-def.cc (LY_DEFINE): bugfix. Don't do
variable_ref twice.

* lily/key-performer.cc (create_audio_elements): use
alterations-in-key.

* scm/midi.scm (accidentals-in-key): divide alterations by 2.

13 files changed:
ChangeLog
Documentation/user/introduction.itely
Documentation/user/refman.itely
input/test/tie-sparse.ly [deleted file]
lily/audio-item.cc
lily/include/audio-item.hh
lily/key-performer.cc
lily/music-output-def.cc
lily/tie-engraver.cc
lily/tie-performer.cc
ly/performer-init.ly
scm/midi.scm
scm/output-ps.scm

index c1dba36a61cee8bf8d6833b54a27cc88cd2b6101..60ae87ef49773697f43eac56f7792b9349be0831 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2004-03-04  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * scm/output-ps.scm (output-scopes): use ly:paper-lookup for font
+       props.
+
+       * input/test/tie-sparse.ly: remove.
+
+       * lily/tie-performer.cc (try_music): copy & paste from
+       Tie_engraver.
+
+       * lily/music-output-def.cc (LY_DEFINE): bugfix. Don't do
+       variable_ref twice.
+
+       * lily/key-performer.cc (create_audio_elements): use
+       alterations-in-key.
+
+       * scm/midi.scm (accidentals-in-key): divide alterations by 2.
+
 2004-03-04  Heikki Junes <hjunes@cc.hut.fi>
 
        * input/test/smart-transpose.ly: fix cases fes->e and similar.
index 0d87a1334e8e1be582b0b492a7dd0b36dd02164a..404269b936842cb35279a00cad4b4e464ba80653 100644 (file)
@@ -4,6 +4,7 @@
 @node Introduction
 @chapter Introduction
 
+[TODO: should have introduction of introduction]
 
 The art of music typography is called @emph{(plate) engraving}. The
 term derives from the traditional process of music printing. Only a
index edbe18ab2b7218b7cada778a0e073164576b65fc..7534f142e4a67a9347761e10bc97f72e3f35cc08 100644 (file)
@@ -431,9 +431,6 @@ In this manual: @ref{Automatic note splitting}.
 
 Internals: @internalsref{TieEvent}, @internalsref{Tie}.
 
-Examples: if you want less ties created for a chord, see
-@inputfileref{input/test,tie-sparse.ly}.
-
 For tying only a subset of the note heads of a pair of chords, see
 @inputfileref{input/regression,tie-chord-partial.ly}.
 
diff --git a/input/test/tie-sparse.ly b/input/test/tie-sparse.ly
deleted file mode 100644 (file)
index d4cf9ab..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-
-\version "2.1.28"
-
-\header { texidoc = "@cindex Tie Sparse
-Setting @code{sparseTies} generated only one tie per chord pair. "
-}
-
-% seem not to work -HJJ
-       
-\score { 
-  \context Voice \notes\relative c {
-       \set sparseTies = ##t
-       c''  <c e g> ~ <c e g> 
-  }
-  \paper { raggedright = ##t }  
-}
-
index d72adbcc7d9011031e3a73f3fd0244e7b2d85338..bdcf76b57f7852660d359d00e9051355d26d954a 100644 (file)
@@ -68,21 +68,3 @@ Audio_text::Audio_text (Audio_text::Type type, String text_string)
   type_ = type;
 }
 
-Audio_tie::Audio_tie ()
-{
-  note_drul_[RIGHT] = 0;
-  note_drul_[LEFT] = 0;
-}
-
-void
-Audio_tie::set_note (Direction d, Audio_note* note)
-{
-  assert (!note_drul_[d]);
-  note_drul_[d] = note;
-  //set_bound (d, head);
-
-  //  add_dependency (head);
-}
-
-
-
index d0eb1fc3e6d697b4638115cfac6f25841c464690..312f2fbe40e06ad33b405d954c912b2ae8b80b4b 100644 (file)
@@ -103,14 +103,6 @@ public:
   int per_minute_4_;
 };
 
-class Audio_tie : public Audio_item
-{
-public:
-  Audio_tie ();
-  void set_note (Direction, Audio_note*);
-  Drul_array<Audio_note*> note_drul_;
-};
-
 class Audio_time_signature : public Audio_item
 {
 public:
index dbdfb4d8351a78f9febcfd0e0cc10f8029157c94..54617f292d03c2abfd3ef8cbb91fb1f4e84d823a 100644 (file)
@@ -45,7 +45,10 @@ Key_performer::create_audio_elements ()
   if (key_req_) 
     {
       SCM pitchlist = key_req_->get_property ("pitch-alist");
-      SCM proc = scm_primitive_eval (ly_symbol2scm ("accidentals-in-key")); 
+      static SCM proc;
+      if (!proc)
+       proc = scm_primitive_eval (ly_symbol2scm ("alterations-in-key"));
+      
       SCM acc = gh_call1 (proc, pitchlist);
       
       Pitch key_do (0, 
index ab651a45c7f1699bc230a17ac7ca285f1412ba4c..b618837323caebf69aecea891f597ee62e24ebde 100644 (file)
@@ -138,10 +138,9 @@ LY_DEFINE(ly_paper_lookup,
   SCM_ASSERT_TYPE (op, pap, SCM_ARG1, __FUNCTION__, "Paper");
   SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
 
-  SCM v = op->lookup_variable (sym);
-
-  if (SCM_VARIABLEP(v))
-    return SCM_VARIABLE_REF(v);
+  SCM var = ly_module_lookup (op->scope_, sym);
+  if (SCM_VARIABLEP (var))
+    return SCM_VARIABLE_REF (var);
   else
     return SCM_EOL;
 }
index b30d40c35eb1788d8bde2d49620ea3a1a4babc2f..6b48a88173e953d10a0f4afd9876d526d6d516ff 100644 (file)
    basis of position and duration-log of the heads (not of the events).
 
    TODO: support sparseTies.
-
-   TODO: melismata will fuck up now:
-
-   < { c8 ~ c8 }
-     { c16 c c c  } >
-
-   melisma is after the 2nd 8th note, but will now be signaled as
-   lasting till the 3rd 16th.
 */
 class Tie_engraver : public Engraver
 {
index b38e9f2cb733feb62e1d7b90bdedac9e729a85a8..2f0c4ecd5e7506be79186c1dac37552b62764a8c 100644 (file)
@@ -1,9 +1,9 @@
 /*   
-  tie-performer.cc --  implement Tie_performer
+  new-tie-engraver.cc --  implement Tie_performer
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2004 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
 #include "pqueue.hh"
 #include "performer.hh"
 
-struct CNote_melodic_tuple {
-  Music *event_ ;
-  Audio_note *note_;
-  Moment end_;
-  CNote_melodic_tuple ();
-  CNote_melodic_tuple (Audio_note*, Music*, Moment);
-  static int pitch_compare (CNote_melodic_tuple const &, CNote_melodic_tuple const &);
-  static int time_compare (CNote_melodic_tuple const &, CNote_melodic_tuple const &);  
-};
-
-inline int compare (CNote_melodic_tuple const &a, CNote_melodic_tuple const &b)
-{
-  return CNote_melodic_tuple::time_compare (a,b);
-}
-
-
-/**
-   Manufacture ties.  Acknowledge notes, and put them into a
-   priority queue. If we have a Music, connect the notes that finish
-   just at this time, and note that start at this time.
-
-   TODO: should share code with Tie_engraver ?
- */
 class Tie_performer : public Performer
 {
-public:
-  TRANSLATOR_DECLARATIONS(Tie_performer);
-private:
+  Music *event_;
+  Music *last_event_;
+  Array<Audio_element_info> now_heads_;
+  Array<Audio_element_info> heads_to_tie_;
 
   bool ties_created_;
-  Array<CNote_melodic_tuple> now_notes_;
-  Array<CNote_melodic_tuple> tied_notes_;
-
-  Music *event_;
-  Music * prev_event_;
-  
-  Link_array<Audio_tie> ties_;
   
 protected:
-  virtual void process_music ();
-  virtual void start_translation_timestep ();
   virtual void stop_translation_timestep ();
-  virtual void acknowledge_audio_element (Audio_element_info);
+  virtual void start_translation_timestep ();
+  virtual void acknowledge_grob (Audio_element_info);
   virtual bool try_music (Music*);
-  virtual void create_audio_elements ();
+  virtual void process_music ();
+public:
+  TRANSLATOR_DECLARATIONS(Tie_performer);
 };
 
-void
-Tie_performer::process_music ()
-{
-  if (event_)
-    daddy_context_->set_property ("tieMelismaBusy", SCM_BOOL_T);
-}
 
 
 Tie_performer::Tie_performer ()
 {
   event_ = 0;
-  ties_created_ = false;
-  prev_event_ = 0;
+  last_event_  = 0;
 }
 
-ENTER_DESCRIPTION (Tie_performer, "", "",
-                  "tie-event",
-                  "", "", "");
-
-
 
 bool
-Tie_performer::try_music (Music *m)
+Tie_performer::try_music (Music *mus)
 {
-  if (!event_)
+  if (mus->is_mus_type ("tie-event"))
     {
-      event_ = m;
-      return true;
+      event_ = mus;
     }
-  return false;
+  
+  return true;
 }
 
 void
-Tie_performer::acknowledge_audio_element (Audio_element_info i)
+Tie_performer::process_music ()
 {
-  if (Audio_note *nh = dynamic_cast<Audio_note *> (i.elem_))
-    {
-      Music *m = i.event_;
-      if (m->is_mus_type ("note-event"))
-       now_notes_.push (CNote_melodic_tuple (nh, m, now_mom ()+ m->get_length ()));
-    }
+  if (event_)
+    daddy_context_->set_property ("tieMelismaBusy", SCM_BOOL_T);
 }
 
 void
-Tie_performer::create_audio_elements ()
+Tie_performer::acknowledge_grob (Audio_element_info inf)
 {
-  /*
-    This is a nested loop. Not optimal, but good enough.
-   */
-  if (tied_notes_.size ())
+  if (Audio_note * an = dynamic_cast<Audio_note *> (inf.elem_))
     {
-      Moment now = now_mom();
-      for (int i = tied_notes_.size (); i--; )
+      now_heads_.push (inf);
+      for  (int i = heads_to_tie_.size (); i--;)
        {
-         if (tied_notes_[i].end_ != now)
-           continue;
-
-         for (int j = now_notes_.size(); j--;)
+         Music * right_mus = inf.event_;
+         
+         Audio_note *th =  dynamic_cast<Audio_note*> (heads_to_tie_[i].elem_);
+         Music * left_mus = heads_to_tie_[i].event_;
+
+         if (right_mus && left_mus
+             && gh_equal_p (right_mus->get_property ("pitch"),
+                            left_mus->get_property ("pitch")))
            {
-             int comp
-               = Pitch::compare (*unsmob_pitch (tied_notes_[i].event_->get_property ("pitch")),
-                                 *unsmob_pitch (now_notes_[j].event_->get_property ("pitch")));
-
-             if (comp == 0)
-               {
-                 
-                 Audio_tie * p = new Audio_tie;
-                 p->set_note (LEFT, tied_notes_[i].note_);
-                 p->set_note (RIGHT, now_notes_[j].note_);
-                 ties_.push (p);
-                 announce_element (Audio_element_info (p, event_));
-                 ties_created_ = true;
-
-                 tied_notes_.del (i);
-                 break ; 
-               }
+             an->tie_to (th);
            }
        }
     }
 }
 
+void
+Tie_performer::start_translation_timestep ()
+{
+  daddy_context_->set_property ("tieMelismaBusy",
+                             gh_bool2scm (heads_to_tie_.size ()));
+      
+}
 
 void
 Tie_performer::stop_translation_timestep ()
 {
-  if (prev_event_ && tied_notes_.size () && !ties_.size ()
-      && now_notes_.size ())
-    {
-      prev_event_->origin ()->warning (_ ("No ties were performed."));
-    }
-
   if (ties_created_)
     {
-      prev_event_ = 0;
-      tied_notes_.clear();
+      heads_to_tie_.clear ();
+      last_event_ = 0;
     }
   
   if (event_)
     {
-      tied_notes_ = now_notes_ ;
-      prev_event_ = event_;
+      heads_to_tie_ = now_heads_;
+      last_event_ = event_;
     }
-
   event_ = 0;
-  now_notes_ .clear ();
-
-  for (int i=ties_.size (); i--;)
-    {
-      ties_[i]->note_drul_[RIGHT]->tie_to (ties_[i]->note_drul_[LEFT]);
-    }
-  
-  ties_.clear ();
-}
-
-void
-Tie_performer::start_translation_timestep ()
-{
-  event_ =0;
-  ties_created_ = false;
-  Moment now = now_mom ();
-  for (int i= tied_notes_.size (); i-- ;)
-    {
-      if (tied_notes_[i].end_ < now)
-       tied_notes_.del (i);
-      else
-       break ;
-    }
-}
-
-
-CNote_melodic_tuple::CNote_melodic_tuple ()
-{
-  note_ =0;
-  event_ =0;
-  end_ = 0;
-}
-
-CNote_melodic_tuple::CNote_melodic_tuple (Audio_note *h, Music*m, Moment mom)
-{
-  note_ = h;
-  event_ = m;
-  end_ = mom;
-}
-
-int
-CNote_melodic_tuple::pitch_compare (CNote_melodic_tuple const&h1,
-                                   CNote_melodic_tuple const &h2)
-{
-  SCM p1  = h1.event_->get_property ("pitch");
-  SCM p2  = h2.event_->get_property ("pitch");  
-  return Pitch::compare (*unsmob_pitch (p1),
-                              *unsmob_pitch (p2));
-}
-
-int
-CNote_melodic_tuple::time_compare (CNote_melodic_tuple const&h1,
-                                  CNote_melodic_tuple const &h2)
-{
-  return (h1.end_ - h2.end_).main_part_.sign ();
+  now_heads_.clear ();
 }
 
+ENTER_DESCRIPTION(Tie_performer,
+/* descr */       "Generate ties between noteheads of equal pitch.",
+/* creats*/       "",
+/* accepts */     "tie-event",
+/* acks  */       "",
+/* reads */       "tieMelismaBusy",
+/* write */       "");
index 26796cbaa0178edb574047dfb060661810cfa7f4..2bb450759ad2ffc260ca409b51089a934d7dd4e2 100644 (file)
     \consists "Span_dynamic_performer"
     \consists "Tie_performer"
     \consists "Piano_pedal_performer"
+    \consists "Note_performer"
+    \consists "Beam_performer"
+    \consists "Slur_performer"
+    \consists "Melisma_translator"
 }
 
+
 \translator {
     \VoiceContext
     \remove "Note_performer"
     \name DrumVoice
 }
 
-\translator {
-    \type "Performer_group_performer"
-    \name Voice
-    \consists "Note_performer"
-    \consists "Beam_performer"
-    \consists "Slur_performer"
-    \consists "Melisma_translator"
-}
-
 \translator {
     \type "Performer_group_performer"
     \name FiguredBass 
index 5cfbd595413bb129ec1dbab6bfd987233dd56d7a..807a020a3ba4f14af30a779272e06272b28f329f 100644 (file)
@@ -283,6 +283,6 @@ returns the program of the instrument
 ;; urg: we should set this at start of track
 (define-public dynamic-default-volume 0.71)
 
-(define-public (accidentals-in-key pitch-list)
+(define-public (alterations-in-key pitch-list)
   "Count number of sharps minus number of flats"
-  (apply + (map cdr pitch-list)))
+  (/ (apply + (map cdr pitch-list))) 2)
index 5090ef12de8bc041486cabd9d162bd0c0ac865ff..6bb582d441289df46ce78617f14a29e5325be99f 100644 (file)
 ;;/output-scale lilypondpaperoutputscale lily-output-units mul def
 ;;
 ;; output-scale = 1.75729901757299 * 2.83464 = 4.9813100871731003736
+
 (define OUTPUT-SCALE 4.98)
 (define TOP-MARGIN 0)
-(define PROPS `(((font-family . roman)
-                (word-space . 1)
-                (baseline-skip . ,BASELINE-SKIP)
-                (font-series . medium)
-                (font-style . roman)
-                (font-shape . upright)
-                (font-size . 0))))
-
 
 ;;; helper functions, not part of output interface
 (define (escape-parentheses s)
 (define (output-scopes paper scopes fields basename)
 
   ;; FIXME: customise/generate these
-  (let* ((linewidth (ly:paper-get-number paper 'linewidth))
-        (props (cons (acons 'linewidth linewidth '()) PROPS))
-        (prefix "lilypond")
-        (stencils '()))
+  (let*
+      ((props
+       (list
+        (append
+         `((linewidth . ,(ly:paper-get-number paper 'linewidth))
+           (font-family . roman))
+         (ly:paper-lookup paper 'font-defaults))))
+       (prefix "lilypond")
+       (stencils '()))
 
     (define (scope-entry->string key var)
       (let ((val (variable-ref var)))