From: Jan Nieuwenhuizen Date: Wed, 9 Aug 2000 21:30:23 +0000 (+0200) Subject: patch::: 1.3.77.jcn1 X-Git-Tag: release/1.3.78~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4f6b4a6446a913f89760e63b7f65c8bdb223a3a5;p=lilypond.git patch::: 1.3.77.jcn1 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 --- diff --git a/CHANGES b/CHANGES index 203e7c6e71..8557f84f9a 100644 --- 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 e1d3b39529..dbc859e82d 100644 --- 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 index 0000000000..42efe9055d --- /dev/null +++ b/input/test/drarn-chords.ly @@ -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 + } + } +} diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 41a452f76e..d8458a64eb 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -31,8 +31,12 @@ protected: virtual bool do_try_music (Music* m); private: + void create_chord_name (); + Array 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; } diff --git a/lily/chord-name.cc b/lily/chord-name.cc index 62562e08ec..c8e8e785ac 100644 --- a/lily/chord-name.cc +++ b/lily/chord-name.cc @@ -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 (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) { diff --git a/lily/chord.cc b/lily/chord.cc index 5bcdf9c7be..6c85816726 100644 --- a/lily/chord.cc +++ b/lily/chord.cc @@ -14,6 +14,25 @@ #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. diff --git a/lily/include/chord-name.hh b/lily/include/chord-name.hh index b4b55b318b..bd9bcfb9dc 100644 --- a/lily/include/chord-name.hh +++ b/lily/include/chord-name.hh @@ -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 diff --git a/lily/include/chord.hh b/lily/include/chord.hh index ce85501bf8..ce00613275 100644 --- a/lily/include/chord.hh +++ b/lily/include/chord.hh @@ -50,4 +50,6 @@ Chord to_chord (Musical_pitch tonic, Array* add_arr_p, Array 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 diff --git a/ly/engraver.ly b/ly/engraver.ly index 790704c229..2eaadcd336 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -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) diff --git a/midi2ly/duration-convert.cc b/midi2ly/duration-convert.cc index 8b86426cea..a7b7594ff3 100644 --- a/midi2ly/duration-convert.cc +++ b/midi2ly/duration-convert.cc @@ -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 ()); } diff --git a/midi2ly/duration-iter.cc b/midi2ly/duration-iter.cc index 7afb3e6b04..fbc8bf4988 100644 --- a/midi2ly/duration-iter.cc +++ b/midi2ly/duration-iter.cc @@ -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 diff --git a/midi2ly/main.cc b/midi2ly/main.cc index 71f1d6d744..3e753d9c17 100644 --- a/midi2ly/main.cc +++ b/midi2ly/main.cc @@ -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); diff --git a/midi2ly/mudela-score.cc b/midi2ly/mudela-score.cc index 8a142c8449..05d570f4fd 100644 --- a/midi2ly/mudela-score.cc +++ b/midi2ly/mudela-score.cc @@ -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