]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/no-notation/midi-lyric-barcheck.ly: new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 6 Feb 2004 23:49:41 +0000 (23:49 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 6 Feb 2004 23:49:41 +0000 (23:49 +0000)
* input/regression/collision-dots-invert.ly: new file.

* lily/note-collision.cc (check_meshing_chords): add stem_to_stem
case.

* lily/new-lyric-combine-music-iterator.cc (process): let iterator
die if melody died too.

12 files changed:
ChangeLog
Documentation/user/refman.itely
input/no-notation/midi-lyric-barcheck.ly [new file with mode: 0644]
input/regression/collision-dots-invert.ly [new file with mode: 0644]
lily/beam-performer.cc
lily/lyric-extender.cc
lily/new-lyric-combine-music-iterator.cc
lily/note-collision.cc
lily/slur-performer.cc [new file with mode: 0644]
lily/source-file.cc
lily/stem.cc
scm/music-functions.scm

index fe7ae09503b56db71fa3c01546eaf61512e8ae5d..730b35772a21a1958024d11ed983d430aaa72a2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,21 @@
+2004-02-07  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * input/no-notation/midi-lyric-barcheck.ly: new file.
+
+       * input/regression/collision-dots-invert.ly: new file.
+
+       * lily/note-collision.cc (check_meshing_chords): add stem_to_stem
+       case.
+
+       * lily/new-lyric-combine-music-iterator.cc (process): let iterator
+       die if melody died too.
+
 2004-02-06  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
-       * Documentation/user/refman.itely (More stanzas): document slur
-       deficiency.
+       * lily/source-file.cc (load_stdin): add trailing 0. Fixes problem
+       with reading from stdin.
+
+       * lily/slur-performer.cc (try_music): new file.
 
        * lily/melisma-performer.cc (try_music): new file. Handle
        melismata to help lyrics.
@@ -11,7 +25,6 @@
 
        * lily/score-performer.cc (one_time_step): reinstate
        process_music().
-       
 
        * lily/performer.cc (process_music): add to interface.
 
index 2d5b1003349361f3051c6436457986976d8884e2..467b40f3afc846728bafdbe85cac5410f89c0877 100644 (file)
@@ -3540,9 +3540,6 @@ making or a music identifier @code{\foo} containing the syllable
   foo = \lyrics bar4
 @end example
 
-The MIDI version of @code{\lyricsto} doesn't detect melismata caused
-by slurs.
-
 
 @node Ambitus
 @subsection Ambitus
diff --git a/input/no-notation/midi-lyric-barcheck.ly b/input/no-notation/midi-lyric-barcheck.ly
new file mode 100644 (file)
index 0000000..8bfa01d
--- /dev/null
@@ -0,0 +1,20 @@
+\header {
+
+    texidoc = "Lyrics in MIDI are aligned to ties and beams:
+this examples causes no bar checks in MIDI.
+TODO: slurs.
+"
+
+
+    }
+\score {
+
+    <<\notes\relative c'' \context Voice = A {
+       \autoBeamOff
+       c8[ c] c2.
+       c1~c4 c2.  c1 }
+    \lyricsto "A" \lyrics\new LyricsVoice { bla bla | bla bla | bla }
+    >>
+    \paper {}
+      \midi {}
+    }
diff --git a/input/regression/collision-dots-invert.ly b/input/regression/collision-dots-invert.ly
new file mode 100644 (file)
index 0000000..e7842f4
--- /dev/null
@@ -0,0 +1,14 @@
+\header {
+
+    texidoc = "When notes are colliding, the resolution depends on the
+    dots: notes with dots should go to the right, if there could be
+    confusion to which notes the dots belong."
+}
+\version "2.1.19"
+\score { 
+  \notes \relative c'' { 
+    << <a c>2\\ { <b d>4 <b d>4 }   >>
+    << { <a c>2 } \\ { <b d>4. <b e>8 } >> 
+  }
+  \paper {  raggedright = ##t } 
+}   
index 24662aa4e652ae24b6a28d51848809acc1115b5d..4010502032be1f32711b07ae8a2c2c43641498ea 100644 (file)
@@ -13,9 +13,6 @@
 #include "global-translator.hh"
 #include "warn.hh"
 
-/**
-Convert evs to audio beams.
-*/
 class Beam_performer : public Performer {
 public:
   TRANSLATOR_DECLARATIONS(Beam_performer);
@@ -41,12 +38,6 @@ Beam_performer::process_music ()
 
   if (start_ev_)
     {
-      if (beam_)
-       {
-         start_ev_->origin ()->warning (_ ("already have a beam"));
-         return;
-       }
-      
       beam_ = true;
       set_melisma (true);
     }
@@ -61,7 +52,6 @@ Beam_performer::set_melisma (bool ml)
     daddy_trans_->set_property ("beamMelismaBusy", ml ? SCM_BOOL_T :SCM_BOOL_F);
 }
 
-
 void
 Beam_performer::start_translation_timestep ()
 {
@@ -73,8 +63,6 @@ Beam_performer::start_translation_timestep ()
   start_ev_ = 0;
   now_stop_ev_ = 0;
 }
-
-
  
 bool
 Beam_performer::try_music (Music *m)
index 1fdce62b9a4a71d85ee11575e023f762831680f5..c2f33dbc36d5cac03a843f53c3440ca314090ec0 100644 (file)
@@ -18,7 +18,6 @@
 #include "note-head.hh"
 #include "group-interface.hh"
 
-
 bool
 Lyric_extender::is_visible (Grob *gr)
 {
@@ -82,8 +81,10 @@ Lyric_extender::brew_molecule (SCM smob)
   Real h = sl * robust_scm2double (me->get_grob_property ("thickness"), 0);
   Real pad = 2* h;
 
-  if (!r->break_status_dir ())
+  if (r->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface")))
     right_point = right_point <? (r->extent (common, X_AXIS)[LEFT] - pad);
+  else if (Note_head::has_interface (r))
+    ; 
   else if (!last_line)
     {
       /*
index 1bf41b8710a80d5995cb822417b60ca252b7a391..b54c02da8dfa84bf621730e6a842b0469da0d098 100644 (file)
@@ -195,7 +195,7 @@ New_lyric_combine_music_iterator::find_voice ()
          String name = ly_scm2string (voice_name);
          Translator_group *voice = find_context_below (t, "Voice", name);
          if (!voice)
-           get_music ()->origin ()->warning (_f ("Cannot find Voice: %s\n",
+           get_music ()->origin ()->warning (_f ("cannot find Voice: %s\n",
                                                  name.to_str0 ())); 
          else
            music_context_ = voice;
@@ -223,9 +223,14 @@ New_lyric_combine_music_iterator::process (Moment )
   
   if (!music_context_->daddy_trans_)
     {
-      music_context_ = 0;
+      /*
+       The melody has died.
+       We die too.
+       */
       if (lyrics_context_)
        lyrics_context_->unset_property (ly_symbol2scm ("associatedVoiceContext"));
+      lyric_iter_ = 0;
+      music_context_ = 0;
     }
   
   if (music_context_
index d664121daa52090bf4a942bf7658195bdfd8036b..9683378af874daa18fca99d0b0bc216dde12461b 100644 (file)
@@ -160,6 +160,9 @@ check_meshing_chords (Grob *me,
       }
   }
 
+  full_collide = full_collide || (close_half_collide
+                                 && distant_half_collide);
+  
   Drul_array<Real> center_note_shifts;
   center_note_shifts[LEFT] = 0.0;
   center_note_shifts[RIGHT] = 0.0;
@@ -167,16 +170,19 @@ check_meshing_chords (Grob *me,
   
   Real shift_amount = 1;
 
-  bool touch = (ups[0] - dps.top () >= 0);
+  bool touch = (ups[0] >= dps.top ());
   if (touch)
     shift_amount *= -1;
 
   /* For full collisions, the right hand head may obscure dots, so
      make sure the dotted heads go to the right.  */
-  if (Rhythmic_head::dot_count (nu) > Rhythmic_head::dot_count (nd)
-      && full_collide)
-    shift_amount = 1;
-
+  bool stem_to_stem = false;
+  if (full_collide)
+    if (Rhythmic_head::dot_count (nu) > Rhythmic_head::dot_count (nd))
+      shift_amount = 1;
+    else if (Rhythmic_head::dot_count (nu) < Rhythmic_head::dot_count (nd))
+      stem_to_stem = true;
+  
   if (merge_possible)
     {
       shift_amount = 0;
@@ -206,6 +212,8 @@ check_meshing_chords (Grob *me,
     }
   /* TODO: these numbers are magic; should devise a set of grob props
      to tune this behavior.  */
+  else if (stem_to_stem)
+    shift_amount *= -0.65; 
   else if (close_half_collide && !touch)
     shift_amount *= 0.52;
   else if (distant_half_collide && !touch)
diff --git a/lily/slur-performer.cc b/lily/slur-performer.cc
new file mode 100644 (file)
index 0000000..ac086be
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+  slur-performer.cc -- implement Slur_performer
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1996--2004 Jan Nieuwenhuizen <janneke@gnu.org>
+ */
+
+#include "performer.hh"
+#include "event.hh"
+#include "audio-item.hh"
+#include "audio-column.hh"
+#include "global-translator.hh"
+#include "warn.hh"
+
+/*
+  this is C&P from beam_performer.
+ */
+
+class Slur_performer : public Performer {
+public:
+  TRANSLATOR_DECLARATIONS(Slur_performer);
+  
+protected:
+  virtual bool try_music (Music *ev) ;
+  virtual void start_translation_timestep ();
+  virtual void process_music ();
+  void set_melisma (bool);
+private:
+  Music *start_ev_;
+  Music *now_stop_ev_;
+  bool slur_;
+};
+
+void 
+Slur_performer::process_music ()
+{
+  if (now_stop_ev_)
+    {
+      slur_ = false;
+    }
+
+  if (start_ev_)
+    {
+      slur_ = true;
+      set_melisma (true);
+    }
+}
+
+
+void
+Slur_performer::set_melisma (bool ml)
+{
+  daddy_trans_->set_property ("slurMelismaBusy", ml ? SCM_BOOL_T :SCM_BOOL_F);
+}
+
+void
+Slur_performer::start_translation_timestep ()
+{
+  if (slur_)
+    {
+      set_melisma (true);
+    }
+  
+  start_ev_ = 0;
+  now_stop_ev_ = 0;
+}
+bool
+Slur_performer::try_music (Music *m)
+{
+  if (m->is_mus_type ("slur-event"))
+    {
+      Direction d = to_dir (m->get_mus_property ("span-direction"));
+
+      if (d == START)
+       {
+         start_ev_ = m;
+       }
+      else if (d==STOP)
+       {
+         now_stop_ev_ = m;
+       }
+      return true;
+    }
+  return false;
+}
+
+ENTER_DESCRIPTION(Slur_performer,"","",
+                 "slur-event","","","");
+
+Slur_performer::Slur_performer()
+{
+  slur_ = false;
+}
index 8c36ef47ccde9712bcba7b7e1cd118e29cb4bbcc..0ef67667b5bb44c2b2a73d63c18fee7754516862 100644 (file)
@@ -34,6 +34,7 @@ Source_file::load_stdin ()
   while ((c = fgetc (stdin)) != EOF)
     chs.push (c);
 
+  chs.push (0);
   length_ = chs.size ();
   contents_str0_ = chs.remove_array ();
 }
index 49c907879e1a19f609eb3945fbe401c81db6554d..6a2656ed2a6186c1e958ba7a63f32b060b733c7b 100644 (file)
@@ -215,6 +215,9 @@ icmp (int const &a, int const &b)
   return a-b;
 }
 
+/*
+  The positions, in ascending order.
+ */
 Array<int>
 Stem::note_head_positions (Grob *me)
 {
index 91c6bbaaaf11725b13f3d1c10ecee1092c68d8eb..f343098560427d4214ff48de2ee7d325e733286d 100644 (file)
@@ -518,7 +518,7 @@ Rest can contain a list of beat groupings
                (make-simultaneous-music (car lst))))
 
              'Voice  (number->string number))
-             (voicify-list (cdr lst) (+ number 1))
+             (voicify-list (cdr lst) (1+ number))
        ))
    )
 
@@ -549,7 +549,7 @@ Rest can contain a list of beat groupings
      (if
       (and (equal? (ly:music-name m) "Simultaneous_music")
           (reduce (lambda (x y ) (or x y)) #f (map music-separator? es)))
-      (voicify-chord m)
+      (set! m  (context-spec-music (voicify-chord m)  'Staff))
       )
 
      m