+1.3.129.jcn2
+============
+
+* Implemented Phrasing slurs, copied from slur.
+
1.3.129.jcn1
============
@lilypondfile[printfilename]{ophee-slurs.ly}
+@lilypondfile[printfilename]{phrasing-slur.ly}
+
@lilypondfile[printfilename]{tie.ly}
@lilypondfile[printfilename]{tie-chord.ly}
+
@c Note:
@c
@c A menu is needed before every deeper *section nesting of @nodes
* Span requests::
@end menu
-Slurs connects chords and try to avoid crossing stems. A slur is
-started with @code{(} and stopped with @code{)}. The
-starting @code{(} appears to the right of the first note in
-the slur. The terminal @code{)} appears to the left of the
-first note in the slur. This makes it possible to put a note in
-slurs from both sides:
+A slur connects chords and is used to indicate legato. Slurs avoid
+crossing stems. A slur is started with @code{(} and stopped with
+@code{)}. The starting @code{(} appears to the right of the first note
+in the slur. The terminal @code{)} appears to the left of the last note
+in the slur. This makes it possible to put a note in slurs from both
+sides:
@lilypond[fragment,verbatim,center]
f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
+@c . {Phrasing slur}
+@node Phrasing slur
+@subsection Phrasing slur
+@cindex phrasing slur
+@cindex phrasing mark
+
+A phrasing slur (or phrasing mark) connects chords and is used to
+indicate a musical sentence. Phrasing slurs avoid crossing stems. A
+phrasing slur is started with @code{\(} and stopped with @code{\)}. The
+starting @code{\(} appears to the right of the first note in the
+phrasing slur. The terminal @code{\)} appears to the left of the last
+note in the phrasing slur.
+
+@lilypond[fragment,verbatim,center,relative]
+ \time 6/4; c''\((d)e f(e)\)d
+@end lilypond
+
+
@c . {Tie}
@node Tie
@subsubsection Tie
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=129
-MY_PATCH_LEVEL=jcn1
+MY_PATCH_LEVEL=jcn2
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
--- /dev/null
+\header {
+texidoc="Slurs play well with phrasing slur.";
+}
+
+\score {
+ \notes\relative c'' {
+ \time 6/4; c\((d)e f(e)\)d
+ }
+ \paper {
+ linewidth = -1.;
+ }
+}
\ No newline at end of file
-/*
- slur-engraver.hh -- declare Slur_engraver
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef SLURGRAV_HH
-#define SLURGRAV_HH
-
-
-
-#endif // SLURGRAV_HH
return E_SMALLER;
case '!':
return E_EXCLAMATION;
+ case '(':
+ return E_OPEN;
+ case ')':
+ return E_CLOSE;
default:
return E_CHAR;
}
%token CONTEXT
/* escaped */
-%token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER
+%token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
%token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
%type <i> exclamations questions dots
$$ = s;
s->set_mus_property ("span-type", ly_str02scm( "slur"));
}
+ | E_OPEN {
+ Span_req* s= new Span_req;
+ $$ = s;
+ s->set_mus_property ("span-type", ly_str02scm( "phrasing-slur"));
+ }
| E_SMALLER {
Span_req*s =new Span_req;
$$ = s;
$$ = s;
s->set_mus_property ("span-type", ly_str02scm( "slur"));
}
+ | E_CLOSE {
+ Span_req* s= new Span_req;
+ $$ = s;
+ s->set_mus_property ("span-type", ly_str02scm( "phrasing-slur"));
+ }
;
gen_text_def:
--- /dev/null
+/*
+ phrasing-slur-engraver.cc -- implement Phrasing_slur_engraver
+
+ (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "musical-request.hh"
+#include "slur.hh"
+#include "debug.hh"
+#include "note-column.hh"
+#include "translator-group.hh"
+#include "engraver.hh"
+#include "spanner.hh"
+
+class Phrasing_slur_engraver : public Engraver
+{
+ Link_array<Span_req> requests_arr_;
+ Link_array<Span_req> new_phrasing_slur_req_l_arr_;
+ Link_array<Grob> phrasing_slur_l_stack_;
+ Link_array<Grob> end_phrasing_slur_l_arr_;
+ Moment last_start_;
+
+protected:
+ virtual bool try_music (Music*);
+ virtual void acknowledge_grob (Grob_info);
+ virtual void stop_translation_timestep ();
+ virtual void start_translation_timestep ();
+ virtual void finalize ();
+ virtual void create_grobs ();
+
+public:
+ VIRTUAL_COPY_CONS (Translator);
+ Phrasing_slur_engraver ();
+};
+
+Phrasing_slur_engraver::Phrasing_slur_engraver ()
+{
+ last_start_ = Moment (-1);
+}
+
+bool
+Phrasing_slur_engraver::try_music (Music *req_l)
+{
+ if (Span_req *sl = dynamic_cast <Span_req *> (req_l))
+ {
+ String t = ly_scm2string (sl->get_mus_property ("span-type"));
+ if (t == "abort")
+ {
+ for (int i = 0; i < phrasing_slur_l_stack_.size (); i++)
+ {
+ phrasing_slur_l_stack_[i]->suicide ();
+ }
+ phrasing_slur_l_stack_.clear ();
+ for (int i = 0; i < end_phrasing_slur_l_arr_.size (); i++)
+ {
+ end_phrasing_slur_l_arr_[i]->suicide ();
+ }
+ end_phrasing_slur_l_arr_.clear ();
+ requests_arr_.clear ();
+ new_phrasing_slur_req_l_arr_.clear ();
+ }
+ else if (t == "phrasing-slur")
+ {
+ /*
+ Let's not start more than one phrasing slur per moment.
+ */
+ if (sl->get_span_dir() == START)
+ {
+ if (now_mom () > last_start_)
+ {
+ new_phrasing_slur_req_l_arr_.push (sl);
+ last_start_ = now_mom ();
+ return true;
+ }
+ }
+ else
+ {
+ new_phrasing_slur_req_l_arr_.push (sl);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+void
+Phrasing_slur_engraver::acknowledge_grob (Grob_info info)
+{
+ if (Note_column::has_interface (info.elem_l_))
+ {
+ Grob *e =info.elem_l_;
+ for (int i = 0; i < phrasing_slur_l_stack_.size (); i++)
+ Slur::add_column (phrasing_slur_l_stack_[i], e);
+ for (int i = 0; i < end_phrasing_slur_l_arr_.size (); i++)
+ Slur::add_column (end_phrasing_slur_l_arr_[i], e);
+ }
+}
+
+void
+Phrasing_slur_engraver::finalize ()
+{
+ for (int i = 0; i < phrasing_slur_l_stack_.size (); i++)
+ {
+#if 0
+ typeset_grob (phrasing_slur_l_stack_[i]);
+#else
+ /*
+ Let's not typeset unterminated stuff
+ */
+ phrasing_slur_l_stack_[i]->suicide ();
+#endif
+ }
+ phrasing_slur_l_stack_.clear ();
+ SCM wg = get_property ("weAreGraceContext");
+ bool wgb = to_boolean (wg);
+ if (!wgb)
+ for (int i=0; i < requests_arr_.size (); i++)
+ {
+ requests_arr_[i]->origin ()->warning (_ ("unterminated phrasing slur"));
+ }
+}
+
+void
+Phrasing_slur_engraver::create_grobs ()
+{
+ Link_array<Grob> start_phrasing_slur_l_arr;
+ for (int i=0; i< new_phrasing_slur_req_l_arr_.size (); i++)
+ {
+ Span_req* phrasing_slur_req_l = new_phrasing_slur_req_l_arr_[i];
+ // end phrasing slur: move the phrasing slur to other array
+ if (phrasing_slur_req_l->get_span_dir() == STOP)
+ {
+ if (phrasing_slur_l_stack_.empty ())
+ phrasing_slur_req_l->origin ()->warning (_f ("can't find start of phrasing slur"));
+ else
+ {
+ Grob* phrasing_slur = phrasing_slur_l_stack_.pop ();
+ SCM s = get_property ("phrasingSlurEndAttachment");
+ if (gh_symbol_p (s))
+ {
+ index_set_cell (phrasing_slur->get_grob_property ("attachment"), STOP, s);
+ }
+ end_phrasing_slur_l_arr_.push (phrasing_slur);
+ requests_arr_.pop ();
+ }
+ }
+ else if (phrasing_slur_req_l->get_span_dir() == START)
+ {
+ // push a new phrasing_slur onto stack.
+ // (use temp. array to wait for all phrasing_slur STOPs)
+ Grob* phrasing_slur = new Spanner (get_property ("PhrasingSlur"));
+ Slur::set_interface (phrasing_slur);
+ SCM s = get_property ("phrasingSlurBeginAttachment");
+ if (gh_symbol_p (s))
+ {
+ index_set_cell (phrasing_slur->get_grob_property ("attachment"), START, s);
+ }
+ start_phrasing_slur_l_arr.push (phrasing_slur);
+ requests_arr_.push (phrasing_slur_req_l);
+ announce_grob (phrasing_slur, phrasing_slur_req_l);
+ }
+ }
+ for (int i=0; i < start_phrasing_slur_l_arr.size (); i++)
+ phrasing_slur_l_stack_.push (start_phrasing_slur_l_arr[i]);
+ new_phrasing_slur_req_l_arr_.clear ();
+}
+
+void
+Phrasing_slur_engraver::stop_translation_timestep ()
+{
+ for (int i = 0; i < end_phrasing_slur_l_arr_.size (); i++)
+ {
+ typeset_grob (end_phrasing_slur_l_arr_[i]);
+ }
+ end_phrasing_slur_l_arr_.clear ();
+}
+
+void
+Phrasing_slur_engraver::start_translation_timestep ()
+{
+ new_phrasing_slur_req_l_arr_.clear ();
+}
+
+
+ADD_THIS_TRANSLATOR (Phrasing_slur_engraver);
/*
- slur-grav.cc -- implement Slur_engraver
+ slur-engraver.cc -- implement Slur_engraver
(c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "musical-request.hh"
-#include "slur-engraver.hh"
#include "slur.hh"
#include "debug.hh"
#include "note-column.hh"
\consists "Script_engraver";
\consists "Script_column_engraver";
\consists "Rhythmic_column_engraver";
+ \consists "Phrasing_slur_engraver";
\consists "Slur_engraver";
\consists "Tie_engraver";
\consists "Tuplet_engraver";
(before-musical-spacing-factor . 0.4)
(meta . ,(grob-description "PaperColumn" paper-column-interface axis-group-interface spaceable-element-interface))
))
+ (PhrasingSlur . (
+ (molecule-callback . ,Slur::brew_molecule)
+ (thickness . 1.2)
+ (spacing-procedure . ,Slur::set_spacing_rods)
+ (minimum-length . 1.5)
+ (after-line-breaking-callback . ,Slur::after_line_breaking)
+ (extremity-rules . ,default-slur-extremity-rules)
+ (extremity-offset-alist . ,default-phrasing-slur-extremity-offset-alist)
+ (de-uglify-parameters . ( 1.5 0.8 -2.0))
+ (Y-extent-callback . ,Slur::height)
+ (details . ((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5)
+ (bezier-pct-c0 . -0.2) (bezier-pct-c3 . 0.000006)
+ (bezier-pct-out-max . 0.8) (bezier-pct-in-max . 1.2)
+ (bezier-area-steps . 1.0)))
+ (beautiful . 0.5)
+ (y-free . 0.75)
+ (attachment . (#f . #f))
+ (attachment-offset . ((0 . 0) . (0 . 0)))
+ (slope-limit . 0.8)
+ (meta . ,(grob-description "PhrasingSlur" slur-interface))
+ ))
(NonMusicalPaperColumn . (
(axes 0)
(before-musical-spacing-factor . 1.0)
"
'(
staff-position
- height
+ height
flag-width-function
damping
default-neutral-direction
damping
outer-stem-length-limit
slope-limit
+ auto-knee-gap
)
))
((loose-end -1 1) . (-4 . 0))
))
+;; This is a bit of a hack: slurs and phrasing slurs
+;; attaching at the same note must not collide.
+;; However, slurs (and phrasing slurs) should look
+;; at scripts and eachother.
+(define default-phrasing-slur-extremity-offset-alist
+ '(
+ ((head 1 1) . (-0.25 . 1.25))
+ ((head 1 -1) . (-0.25 . -1.25))
+ ((head -1 1) . (-0.25 . 1.25))
+ ((head -1 -1) . (-0.85 . -1.25))
+
+ ((stem 1 1) . (0 . 1.5))
+ ((stem -1 -1) . (0 . -1.5))
+
+ ((loose-end 1 1) . (-0.4 . 0))
+ ((loose-end 1 -1) . (-0.4 . 0))
+ ((loose-end -1 -1) . (-4 . 0))
+ ((loose-end -1 1) . (-4 . 0))
+ ))
+