]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.77.jcn1
authorJan Nieuwenhuizen <janneke@gnu.org>
Wed, 9 Aug 2000 21:30:23 +0000 (23:30 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Wed, 9 Aug 2000 21:30:23 +0000 (23:30 +0200)
1.3.77.jcn1
===========

* `Fixed' chord notation, as per request of David Arnold, ie,
   Added a chord-name-mode, that only displays chord names
   when there's a change in the chord-name-scheme, Also, a chord
   name should always be displayed after a line break.  See

       input/test/drarn-chords.ly

* Reverted duration-iter change in midi2ly, moved printing of options.

---
Generated by janneke@gnu.org,
From = lilypond-1.3.77, To = lilypond-1.3.77.jcn1

usage

    cd lilypond-source-dir; patch -E -p1 < lilypond-1.3.77.jcn1.diff

Patches do not contain automatically generated files
or (urg) empty directories,
i.e., you should rerun autoconf, configure

13 files changed:
CHANGES
VERSION
input/test/drarn-chords.ly [new file with mode: 0644]
lily/chord-name-engraver.cc
lily/chord-name.cc
lily/chord.cc
lily/include/chord-name.hh
lily/include/chord.hh
ly/engraver.ly
midi2ly/duration-convert.cc
midi2ly/duration-iter.cc
midi2ly/main.cc
midi2ly/mudela-score.cc

diff --git a/CHANGES b/CHANGES
index 203e7c6e71677e7174fad55168ae57445535fa5c..8557f84f9ab06566b27ee546249cd8241f77d9c1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,21 @@
-1.3.77.mb1
+--- ../lilypond-1.3.77/CHANGES Tue Aug  8 16:14:36 2000
+++ b/CHANGES   Wed Aug  9 23:30:23 2000
+@@ -1,3 +1,15 @@
+1.3.77.jcn1
+===========
+
+* `Fixed' chord notation, as per request of David Arnold, ie, 
+   Added a chord-name-mode, that only displays chord names
+   when there's a change in the chord-name-scheme, Also, a chord
+   name should always be displayed after a line break.  See
+
+       input/test/drarn-chords.ly
+
+* Reverted duration-iter change in midi2ly, moved printing of options.
+
+ 1.3.77
+ ======
+ 1.3.77.mb1
 ==========
 
 * Minor documentation updates
diff --git a/VERSION b/VERSION
index e1d3b3952962c762955d62d17a04917ca20b1e80..dbc859e82d5823f3e6e9361326171b338018f17b 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=77
-MY_PATCH_LEVEL=mb1
+MY_PATCH_LEVEL=jcn1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff --git a/input/test/drarn-chords.ly b/input/test/drarn-chords.ly
new file mode 100644 (file)
index 0000000..42efe90
--- /dev/null
@@ -0,0 +1,37 @@
+\version "1.3.59";
+
+%{
+Would this be acceptable/good enough/convenient for entry?
+
+   Convention/Standard    Lily
+   
+   C#                     cis
+   Cb                     ces
+   Cm; Cmin               c:3-; c:m; c:min
+   Caug                   c:5+; c:aug;
+   Cdim                   c:3-.5-; c:dim
+   Cmaj7                  c:7+; c:maj
+   C7                     c:7
+   Csus; Csus4            c:4; c:sus
+
+%}
+
+scales = \notes \transpose c'' \chords{
+       \property ChordNames.drarnChords=##t
+               %c1:m \break c1:m
+               c1:m c1:m
+}
+
+%\include "paper-as9.ly";
+\score{
+       <
+               \context ChordNames \scales
+               \context Staff \scales
+       >
+       \paper{
+%              \paper_as_nine
+               \translator {
+                       \ChordNameContext
+                       }
+       }
+}
index 41a452f76e1612f538155aa07edd1342881e54e8..d8458a64ebd0b31ffcc036be3c67572c353db8f6 100644 (file)
@@ -31,8 +31,12 @@ protected:
   virtual bool do_try_music (Music* m);
 
 private:
+  void create_chord_name ();
+
   Array<Musical_pitch> pitch_arr_;
   Item* chord_name_p_;
+  Chord* chord_p_;
+  Chord* last_chord_p_;
   Tonic_req* tonic_req_;
   Inversion_req* inversion_req_;
   Bass_req* bass_req_;
@@ -46,6 +50,8 @@ Chord_name_engraver::Chord_name_engraver ()
   tonic_req_ = 0;
   inversion_req_ = 0;
   bass_req_ = 0;
+  chord_p_ = 0;
+  last_chord_p_ = 0;
 }
 
 void
@@ -86,6 +92,7 @@ Chord_name_engraver::do_process_music ()
 {
   if (chord_name_p_)
     return;
+
   if (!pitch_arr_.size ())
     return;
 
@@ -94,26 +101,36 @@ Chord_name_engraver::do_process_music ()
   if (gh_boolean_p (chord_inversion))
     find_inversion_b = gh_scm2bool (chord_inversion);
 
-  chord_name_p_ = new Item (get_property ("basicChordNameProperties"));
-  Chord chord = to_chord (pitch_arr_, tonic_req_, inversion_req_, bass_req_,
-                         find_inversion_b);
+  chord_p_ = new Chord (to_chord (pitch_arr_,
+                                 tonic_req_, inversion_req_, bass_req_,
+                                 find_inversion_b));
+  
+  create_chord_name ();
+  announce_element (chord_name_p_, 0);
+  SCM s = get_property ("drarnChords"); //FIXME!
+  if (to_boolean (s) && last_chord_p_ && !compare (chord_p_, last_chord_p_))
+    chord_name_p_->set_elt_property ("begin-of-line-visible", SCM_BOOL_T);
+}
 
+void
+Chord_name_engraver::create_chord_name ()
+{
+  assert (chord_p_);
+  chord_name_p_ = new Item (get_property ("basicChordNameProperties"));
   /*
     Hmm, why not represent complete chord as list?
     ((tonic third fifth) (inversion bass))
   */
   SCM plist = SCM_EOL;
-  for (int i= chord.pitch_arr_.size (); i--; )
-    plist = gh_cons (chord.pitch_arr_[i].to_scm (), plist);
+  for (int i= chord_p_->pitch_arr_.size (); i--; )
+    plist = gh_cons (chord_p_->pitch_arr_[i].to_scm (), plist);
   
   chord_name_p_->set_elt_property ("pitches", plist);
-  if (chord.inversion_b_)
+  if (chord_p_->inversion_b_)
     chord_name_p_->set_elt_property ("inversion",
-                                    chord.inversion_pitch_.to_scm ());
-  if (chord.bass_b_)
-    chord_name_p_->set_elt_property ("bass", chord.bass_pitch_.to_scm ());
-
-  announce_element (chord_name_p_, 0);
+                                    chord_p_->inversion_pitch_.to_scm ());
+  if (chord_p_->bass_b_)
+    chord_name_p_->set_elt_property ("bass", chord_p_->bass_pitch_.to_scm ());
 }
 
 void
@@ -128,5 +145,8 @@ Chord_name_engraver::do_pre_move_processing ()
   tonic_req_ = 0;
   inversion_req_ = 0;
   bass_req_ = 0;
+  delete last_chord_p_;
+  last_chord_p_ = chord_p_;
+  chord_p_ = 0;
 }
 
index 62562e08ec1a96e57a62a66a171bdbb003211d0c..c8e8e785ac8e55a7c419476a2c0f4a74c7fe1b8c 100644 (file)
@@ -11,6 +11,8 @@
 #include "paper-def.hh"
 #include "lookup.hh"
 #include "score-element.hh"
+#include "paper-column.hh"
+#include "line-of-score.hh"
 
 /*
   TODO: move text lookup out of Chord_name
@@ -124,8 +126,29 @@ Chord_name::ly_text2molecule (Score_element * me, SCM text)
   return mol;
 }
 
-MAKE_SCHEME_CALLBACK(Chord_name,brew_molecule);
+MAKE_SCHEME_CALLBACK (Chord_name, after_line_breaking);
+SCM
+Chord_name::after_line_breaking (SCM smob)
+{
+  Item* me = dynamic_cast<Item*> (unsmob_element (smob));
+  assert (me);
+    
+  SCM s = me->get_elt_property ("begin-of-line-visible");
+  if (to_boolean (s))
+    {
+      if (Paper_column::rank_i (me->column_l ()) -
+         /*
+           hmm, what's my column number in this line?
+           why doesn't this work?
+           me->line_l ()->rank_i_ > 2)
+         */
+         me->line_l ()->spanned_rank_iv ()[LEFT] > 1)
+       me->suicide ();
+    }
+  return SCM_UNSPECIFIED;
+}
 
+MAKE_SCHEME_CALLBACK (Chord_name, brew_molecule);
 SCM
 Chord_name::brew_molecule (SCM smob) 
 {
index 5bcdf9c7bed1d0cf0c0d09357275ff1720b49c8d..6c858167262d77800362841d123c32436a0398b6 100644 (file)
 #include "paper-def.hh"
 #include "lookup.hh"
 
+int
+compare (Chord* left, Chord* right)
+{
+  assert (left);
+  assert (right);
+  
+  if (left->inversion_b_ == right->inversion_b_
+      && left->bass_b_ == right->bass_b_
+      && left->pitch_arr_.size () == right->pitch_arr_.size ())
+    {
+      for (int i = 0; i < left->pitch_arr_.size (); i++)
+       if (left->pitch_arr_[i] != right->pitch_arr_[i])
+         return 1;
+      return 0;
+    }
+  
+  return 1;
+}
+
 /*
   FIXME: should use SCM iso. arrays and have-to-delete pointers.
 
index b4b55b318ba2012ce633495d55d102f085040ba2..bd9bcfb9dc5ad7cbccbf9a22d22b93e012bef57d 100644 (file)
@@ -24,6 +24,7 @@ public:
   static SCM brew_molecule (SCM);
   static Molecule ly_word2molecule (Score_element*, SCM scm, Real* x) ;
   static Molecule ly_text2molecule (Score_element*, SCM scm) ;
+  static SCM after_line_breaking (SCM);
 };
 
 #endif // CHORD_NAME_HH
index ce85501bf87b073e1768abf4972af4f9a3a673b8..ce00613275562e9ad270c4db6fa24093ed95a4b4 100644 (file)
@@ -50,4 +50,6 @@ Chord to_chord (Musical_pitch tonic, Array<Musical_pitch>* add_arr_p, Array<Musi
 
 Chord to_chord (Array<Musical_pitch> pitch_arr, Tonic_req* tonic_req, Inversion_req* inversion_req, Bass_req* bass_req, bool find_inversion_b);
 
+int compare (Chord*, Chord*);
+
 #endif // CHORD_HH
index 790704c229d6741f3b875a5cbc6f57720c430694..2eaadcd3368c3a895a03581bfdc9c37c2653e167 100644 (file)
@@ -472,6 +472,7 @@ ScoreContext = \translator {
        basicChordNameProperties = #`(
                (molecule-callback . ,Chord_name::brew_molecule)
                (interfaces . (chord-name-interface))
+               (after-line-breaking-callback . ,Chord_name::after_line_breaking) 
        )
        basicCollisionProperties = #`(
                (axes 0 1)
index 8b86426cea945cb13458f27a61bb347830d5044c..a7b7594ff3a13fe767b4b6d9b92ebe1567dc1993 100644 (file)
@@ -148,7 +148,6 @@ Duration_convert::set_array ()
   dur_array_s.clear ();
 
   Duration_iterator i;
-  dur_array_s.push (i.dur ());
   while (i.ok ())
     dur_array_s.push (i.forward_dur ());
 }
index 7afb3e6b043b2aec2072e35d00fcaaf671f6515c..fbc8bf49889c9e1e8fdb76b9e15250751cd3fbe7 100644 (file)
@@ -47,6 +47,8 @@ Duration_iterator::forward_dur ()
      */
   assert (ok ());
 
+  Duration dur = this->dur ();
+
   if (!cursor_dur_.dots_i_ && !cursor_dur_.plet_b ()) 
     {
       cursor_dur_.durlog_i_ += 1;
@@ -77,25 +79,25 @@ Duration_iterator::forward_dur ()
                
   if (Duration_convert::no_tuplets_b_s
       && cursor_dur_.plet_b () && ok ())
-    return forward_dur ();
+    forward_dur ();
   if (Duration_convert::no_double_dots_b_s 
       && (cursor_dur_.dots_i_ == 2) && ok ())
-    return forward_dur ();
+    forward_dur ();
   if (Duration_convert::no_smaller_than_i_s
       && (cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s) && ok ())
-    return forward_dur ();
+    forward_dur ();
   if (Duration_convert::no_smaller_than_i_s
       && cursor_dur_.dots_i_
       && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s)
       && ok ())
-    return forward_dur ();
+    forward_dur ();
   if (Duration_convert::no_smaller_than_i_s
       && (cursor_dur_.dots_i_ == 2)
       && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2)
       && ok ())
-    return forward_dur ();
+    forward_dur ();
 
-  return dur ();
+  return dur;
 }
 
 bool
index 71f1d6d74437c0bd8cd001b44a4d7b8305d2ba13..3e753d9c176ff723d51d3cde771f5625eabfbb86 100644 (file)
@@ -122,6 +122,23 @@ usage()
   cout << _f ("Report bugs to %s", "bug-gnu-music@gnu.org") << endl;
 }
 
+void
+show_settings ()
+{
+  LOGOUT (VERBOSE_ver) << "\n";
+  LOGOUT (VERBOSE_ver) << _f ("no_double_dots: %d\n", 
+    Duration_convert::no_double_dots_b_s);
+  LOGOUT (VERBOSE_ver) << _f ("no_rests: %d\n", 
+    no_rests_b_g);
+  LOGOUT (VERBOSE_ver) << _f ("no_quantify_b_s: %d\n", 
+    Duration_convert::no_quantify_b_s);
+  LOGOUT (VERBOSE_ver) << _f ("no_smaller_than: %d (1/%d)\n", 
+    Duration_convert::no_smaller_than_i_s,
+    Duration_convert::type2_i (Duration_convert::no_smaller_than_i_s));
+  LOGOUT (VERBOSE_ver) << _f ("no_tuplets: %d\n", 
+    Duration_convert::no_tuplets_b_s);
+}
+
 int
 main (int argc_i, char* argv_sz_a[])
 {
@@ -230,22 +247,10 @@ main (int argc_i, char* argv_sz_a[])
   source.set_binary (true);
   source.set_path (&path);
 
-  LOGOUT (NORMAL_ver) << "\n";
-  LOGOUT (NORMAL_ver) << _f ("no_double_dots: %d\n", 
-    Duration_convert::no_double_dots_b_s);
-  LOGOUT (NORMAL_ver) << _f ("no_rests: %d\n", 
-    no_rests_b_g);
-  LOGOUT (NORMAL_ver) << _f ("no_quantify_b_s: %d\n", 
-    Duration_convert::no_quantify_b_s);
-  LOGOUT (NORMAL_ver) << _f ("no_smaller_than: %d (1/%d)\n", 
-    Duration_convert::no_smaller_than_i_s,
-    Duration_convert::type2_i (Duration_convert::no_smaller_than_i_s));
-  LOGOUT (NORMAL_ver) << _f ("no_tuplets: %d\n", 
-    Duration_convert::no_tuplets_b_s);
-
   char const* arg_sz = 0;
   while ( (arg_sz = getopt_long.get_next_arg ()))
     {
+      show_settings ();
       filename_str_g = arg_sz;
       Midi_score_parser midi_parser;
       Mudela_score* score_p = midi_parser.parse (arg_sz, &source);
index 8a142c8449ed3e1fd196aaa5e42d63352624df53..05d570f4fd276216d77c0aae389f1904a24bb68c 100644 (file)
@@ -138,7 +138,7 @@ Mudela_score::output (String filename_str)
   
   mudela_stream << "\\paper{}\n";
   
-#if 0
+#if 1
   mudela_stream << "\\midi{\n";
   
   // let's not use silly 0 track