\change Staff=bass
\once\override TextScript #'extra-offset = #'(-3 . -4) %tweak
-
- cis,16^2(^\markup {\small \italic "m.d." }
+
+ cis,16^2(^\markup {\small \italic "m.d." }\sustainUp
<fis fis,>8 <e! e,!>
| %4
- <dis, a' dis>4)
+ <dis, a' dis>4)\sustainDown
\change Staff=treble
\tieUp
cis''''4^\markup { \small \italic "m.g." }\arpeggio~
\grace {
- \override Stem #'stroke-style = #"grace"
-
- cis8
-
- %\stemBoth Hmm
+ cis8
+ \slurBoth % Tweak
- \override Stem #'direction = #0
+ \override Stem #'direction = #0
- a16[-5( fis dis]
- #(set-octavation 0)
+ a16[-5( fis dis]
+ #(set-octavation 0)
- cis32[ a-1 fis-4 dis] cis[ a fis)-2]
- % the small grace in lower staff comes after us
- s32
-
- \revert Stem #'stroke-style
+ cis32[ a-1 fis-4 dis] cis[ a fis)-2]
+ % the small grace in lower staff comes after us
+ s32
}
r8. e,16(\f_2 <a a,>8[ <b b,>]
| %2
- <cis cis,>4
+ \override Staff.SustainPedalLineSpanner #'staff-padding = #5
+
+ <cis cis,>4\sustainDown
\change Staff=treble
\stemDown
\override Slur #'attachment = #'(stem . stem) %tweak
\override Slur #'y-free = #0.1 %tweak
\revert Slur #'attachment-offset %tweak
\override Slur #'attachment-offset = #'((0 . 3) . (0 . 8)) %tweak
- r8. cis,,16( <fis fis,>8 <gis gis,>
+ r8. cis,,16(\sustainUp <fis fis,>8 <gis gis,>
| %3
\override Stem #'length = #5 %tweak
- <a a,>4
+ <a a,>4\sustainDown
\change Staff=treble
\revert Stem #'length %tweak
s32 s s
s s s
\clef bass
- <e,,, e,>32(
+ <e,,, e,>32(\sustainUp\sustainDown
\revert Stem #'stroke-style
}
% \fingerDown
\override Fingering #'direction = #-1
-
+
+
+ \override Staff.SustainPedalLineSpanner #'staff-padding = #3.5
+ \set Staff.pedalSustainStyle = #'mixed
%%a,8 e'[-5(<a-2 cis-3>])
- a,8 e'[-5(<a cis>])-2-3
+
+
+ a,8\sustainDown e'[-5(<a cis>])-2-3
%%r b,-5 <e-3 gis-5 d'>4
- r b,-5 <e gis d'>4-3-5
+ r b,-5\sustainUp\sustainDown <e gis d'>4-3-5
\slurBoth
\once \override Fingering #'extra-offset = #'(0 . -1) %tweak
- e,8[-5(
+ e,8[-5(\sustainUp
| %6
\once \override Fingering #'extra-offset = #'(0 . -1) %tweak
- a)-2]
+ a)-2]\sustainDown
\slurUp
- e'[(<a cis>)] r b, <e gis d'>4
+ e'[(<a cis>)] r b,\sustainUp\sustainDown <e gis d'>4
\slurBoth
- e,8[(
+ e,8[(\sustainUp
| %7
a)]
| %4
s2
\grace {
- \override Stem #'stroke-style = #"grace"
-
- s8
- s16 s s
- s32 s
- \once\override Dynamics.Hairpin #'extra-offset = #'(0 . 2) %tweak
- s\> s
- s32 s s s\!
+ s8
+ s16 s s
+ s32 s
+ \once\override Dynamics.Hairpin #'extra-offset = #'(0 . 2) %tweak
+ s\> s
+ s32 s s s\!
- \revert Stem #'stroke-style }
+ }
s32 s-"rall." s s s8 s4
| %5
s8\!
}
-lowerDynamics = \notes{
- s2
- | %2
- s2\sustainDown s8. s16\sustainUp s4
- | %3
- s2\sustainDown s8. s16\sustainUp s4
- | %4
- s4\sustainDown
- \set Dynamics.pedalSustainStrings = #'("Ped." "*Ped." "*")
-
- % grace destroys pedal-line-spanner?
- % let's do manual tweak:
- \once\override Dynamics.SustainPedal #'extra-offset = #'(10 . 0) %tweak
- s8\sustainUp
- \once\override Dynamics.SustainPedal #'extra-offset = #'(16 . 0) %tweak
- s8\sustainDown
-%{
- s4
- \grace {
- \override Stem #'stroke-style = #"grace"
-
- s8
- s16 s s
- s32 s s s\sustainUp
- s32 s s s\sustainDown
-
- \revert Stem #'stroke-style }
-
-%}
- s2
-
- | %5
- % ugh, I don't think that 'mixed should show last edge, but rather:
- %
- % Ped__________/\__________ *
- %
- % that's what gray wants, anyway.
-
- \set Dynamics.pedalSustainStyle = #'mixed
- s8\sustainDown s s
- s s\sustainUp\sustainDown s
- s
- \once \set Dynamics.pedalSustainStyle = #'text
- s\sustainUp
-
- | %6
- \set Dynamics.pedalSustainStyle = #'mixed
- s8\sustainDown s s
- s s\sustainUp\sustainDown s
- s
- \once \set Dynamics.pedalSustainStyle = #'text
- s\sustainUp
- | %7
-}
\score{
\context PianoStaff <<
\bass
\bassTwo
>>
- \new Dynamics <<
- \lowerDynamics
- >>
>>
\paper {
\context {
\ScoreContext
+ pedalSustainStrings = #'("Ped." "*Ped." "*")
\remove Bar_number_engraver
}
\context {
\consists "Output_property_engraver"
minimumVerticalExtent = #'(-1 . 1)
- pedalSustainStrings = #'("Ped." "*Ped." "*")
-
- \consists "Piano_pedal_engraver"
\consists "Script_engraver"
\consists "Dynamic_engraver"
\consists "Text_engraver"
/*
- piano-pedal-engraver.cc -- implement Piano_pedal_engraver
+ piano-pedal-engraver.cc -- implement Piano_pedal_engraver
- source file of the GNU LilyPond music typesetter
+ source file of the GNU LilyPond music typesetter
- (c) 2000--2004 Jan Nieuwenhuizen <janneke@gnu.org>
+ (c) 2000--2004 Jan Nieuwenhuizen <janneke@gnu.org>
- Chris Jackson <chris@fluffhouse.org.uk> - extended to support
- bracketed pedals.
+ Chris Jackson <chris@fluffhouse.org.uk> - extended to support
+ bracketed pedals.
*/
#include "engraver.hh"
/*
Urgh. This engraver is too complex. rewrite. --hwn
-
*/
struct Pedal_info
distinct from current_bracket_ev_, since current_bracket_ev_ only
necessary for brackets, not for text style.
- */
+ */
Music* start_ev_;
/*
Events that were found in this timestep.
- */
+ */
Drul_array<Music*> event_drul_;
Item* item_;
Spanner* bracket_; // A single portion of a pedal bracket
/*
This grob contains all the pedals of the same type on the same staff
- */
+ */
Spanner* line_spanner_;
Spanner* finished_line_spanner_;
};
*/
Link_array<Spanner> previous_;
+ void del_linespanner (Spanner*);
void create_text_grobs (Pedal_info *p, bool);
void create_bracket_grobs (Pedal_info *p, bool);
- void typeset_all ();
+ void typeset_all (Pedal_info*p);
};
void
Piano_pedal_engraver::initialize ()
{
- previous_.clear ();
-
char * names [] = { "Sostenuto", "Sustain", "UnaCorda", 0 };
info_list_ = new Pedal_info[sizeof (names)/ sizeof (const char*)];
}
/*
- Urg: Code dup
- I'm a script
- */
+ Urg: Code dup
+ I'm a script
+*/
void
Piano_pedal_engraver::acknowledge_grob (Grob_info info)
{
bool
Piano_pedal_engraver::try_music (Music *m)
{
- if (m->is_mus_type ("pedal-event"))
+ if (m->is_mus_type ("pedal-event"))
{
for (Pedal_info*p = info_list_; p->name_; p ++)
{
p->line_spanner_ = make_spanner (name.to_str0 ());
Music * rq = (p->event_drul_[START] ? p->event_drul_[START] : p->event_drul_[STOP]);
+
+
announce_grob (p->line_spanner_, rq->self_scm ());
}
/* Choose the appropriate grobs to add to the line spanner
- These can be text items or text-spanners
+ These can be text items or text-spanners
*/
/*
ugh, code dup, should read grob to create from other
property.
- bracket: |_________/\____|
- text: Ped. *Ped. *
- mixed: Ped. _____/\____|
- */
+ bracket: |_________/\____|
+ text: Ped. *Ped. *
+ mixed: Ped. _____/\____|
+ */
String prop = String ("pedal") + p->name_ + "Style";
SCM style = get_property (prop.to_str0 ());
+
bool mixed = style == ly_symbol2scm ("mixed");
- if (style == ly_symbol2scm ("text") ||
- mixed)
- {
- if (! p->item_)
- create_text_grobs (p, mixed);
- }
- if (style == ly_symbol2scm ("bracket") ||
- mixed)
- {
- create_bracket_grobs (p, mixed);
- }
+ bool bracket = (mixed
+ || style == ly_symbol2scm ("bracket"));
+ bool text = (style == ly_symbol2scm ("text")
+ || mixed);
+
+ if (text && !p->item_)
+ create_text_grobs (p, mixed);
+ if (bracket)
+ create_bracket_grobs (p, mixed);
}
}
}
else
{
s = ly_caddr (strings);
- if (previous_.size ())
- previous_.pop ();
}
p->start_ev_ = 0;
}
// add extra space below the previous already-occuring pedal
Side_position_interface::add_support (p->line_spanner_,
previous_.top ());
- previous_.push ( p->line_spanner_);
+ previous_.push (p->line_spanner_);
}
}
}
}
+
void
Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, bool mixed)
{
if (p->event_drul_[STOP])
{
- if (!p->event_drul_[START])
- {
- if (previous_.size ())
- previous_.pop ();
- }
-
assert (!p->finished_bracket_);
Grob *cmc = unsmob_grob (get_property ("currentMusicalColumn"));
/*
Set properties so that the stencil-creating function will
know whether the right edge should be flared ___/
- */
+ */
if (!p->event_drul_[START])
{
SCM flare = p->bracket_->get_property ("bracket-flare");
p->bracket_->set_property ("bracket-flare", scm_cons (gh_car (flare),
- gh_double2scm (0)));
+ gh_double2scm (0)));
}
p->finished_bracket_ = p->bracket_;
/* Set this property for 'mixed style' pedals, Ped._______/\ ,
- so the stencil function will shorten the ____ line by the length of the Ped. text.
+ so the stencil function will shorten the ____ line by the length of the Ped. text.
*/
if (mixed)
what about the right span point?
- */
+ */
Axis_group_interface::add_element (p->line_spanner_, p->bracket_);
announce_grob (p->bracket_, p->event_drul_[START]->self_scm ());
code dup. --hwn.
// position new pedal spanner below the current one
- */
+ */
if (previous_.size ())
Side_position_interface::add_support (p->line_spanner_, previous_.top ());
{
/*
suicide?
- */
+ */
if (p->line_spanner_
&& !p->line_spanner_->live ())
p->line_spanner_ = 0;
p->bracket_ = 0;
p->finished_line_spanner_ = p->line_spanner_;
p->line_spanner_ = 0;
- typeset_all ();
+ typeset_all (p);
}
if (p->line_spanner_)
{
p->finished_line_spanner_ = p->line_spanner_;
- typeset_all ();
+ typeset_all (p);
}
}
}
-
+void
+Piano_pedal_engraver::del_linespanner (Spanner *g)
+{
+ int idx = previous_.find_index (g);
+ if (idx >= 0)
+ previous_.del (idx);
+}
+
void
Piano_pedal_engraver::stop_translation_timestep ()
{
{
p->finished_line_spanner_ = p->line_spanner_;
p->line_spanner_ = 0;
+ del_linespanner (p->finished_line_spanner_);
}
+
+ typeset_all (p);
}
- typeset_all ();
for (Pedal_info*p = info_list_; p->name_; p ++)
{
void
-Piano_pedal_engraver::typeset_all ()
+Piano_pedal_engraver::typeset_all (Pedal_info * p)
{
- Item * sustain = 0;
- for (Pedal_info*p = info_list_; p->name_; p ++)
- {
- /*
- Handle suicide.
- */
- if (p->finished_line_spanner_
- && !p->finished_line_spanner_->live ())
- p->finished_line_spanner_ = 0;
- if (p->finished_bracket_
- && !p->finished_bracket_->live ())
- p->finished_bracket_ = 0;
-
+ /*
+ Handle suicide.
+ */
+ if (p->finished_line_spanner_
+ && !p->finished_line_spanner_->live ())
+ p->finished_line_spanner_ = 0;
+ if (p->finished_bracket_
+ && !p->finished_bracket_->live ())
+ p->finished_bracket_ = 0;
- if (p->name_ == String ("Sustain"))
- sustain = p->item_;
- if (p->item_)
- {
- /*
- Hmm.
- */
- if (p->name_ != String ("Sustain") && sustain)
- {
- Side_position_interface::add_support (p->item_,sustain);
- }
- typeset_grob (p->item_);
- p->item_ = 0;
- }
+ if (p->item_)
+ {
+ typeset_grob (p->item_);
+ p->item_ = 0;
+ }
- if (p->finished_bracket_)
+ if (p->finished_bracket_)
+ {
+ Grob * r = p->finished_bracket_->get_bound (RIGHT);
+ if (!r)
{
- Grob * r = p->finished_bracket_->get_bound (RIGHT);
- if (!r)
- {
- p->finished_bracket_->set_bound (RIGHT, unsmob_grob (get_property ("currentMusicalColumn")));
- }
+ p->finished_bracket_->set_bound (RIGHT, unsmob_grob (get_property ("currentMusicalColumn")));
+ }
- typeset_grob (p->finished_bracket_);
+ typeset_grob (p->finished_bracket_);
- p->finished_bracket_ =0;
- }
+ p->finished_bracket_ =0;
+ }
- if (p->finished_line_spanner_)
+ if (p->finished_line_spanner_)
+ {
+ Grob * l = p->finished_line_spanner_->get_bound (LEFT);
+ Grob * r = p->finished_line_spanner_->get_bound (RIGHT);
+ if (!r && l)
+ p->finished_line_spanner_->set_bound (RIGHT, l);
+ else if (!l && r)
+ p->finished_line_spanner_->set_bound (LEFT, r);
+ else if (!r && !l)
{
- Grob * l = p->finished_line_spanner_->get_bound (LEFT);
- Grob * r = p->finished_line_spanner_->get_bound (RIGHT);
- if (!r && l)
- p->finished_line_spanner_->set_bound (RIGHT, l);
- else if (!l && r)
- p->finished_line_spanner_->set_bound (LEFT, r);
- else if (!r && !l)
- {
- Grob * cc = unsmob_grob (get_property ("currentMusicalColumn"));
- Item * ci = dynamic_cast<Item*> (cc);
- p->finished_line_spanner_->set_bound (RIGHT, ci);
- p->finished_line_spanner_->set_bound (LEFT, ci);
- }
- typeset_grob (p->finished_line_spanner_);
- p->finished_line_spanner_ = 0;
+ Grob * cc = unsmob_grob (get_property ("currentMusicalColumn"));
+ Item * ci = dynamic_cast<Item*> (cc);
+ p->finished_line_spanner_->set_bound (RIGHT, ci);
+ p->finished_line_spanner_->set_bound (LEFT, ci);
}
+ typeset_grob (p->finished_line_spanner_);
+ p->finished_line_spanner_ = 0;
}
}
ENTER_DESCRIPTION (Piano_pedal_engraver,
-/* descr */ "Engrave piano pedal symbols and brackets.",
-/* creats*/ "SostenutoPedal SustainPedal UnaCordaPedal SostenutoPedalLineSpanner SustainPedalLineSpanner UnaCordaPedalLineSpanner",
-/* accepts */ "pedal-event",
-/* acks */ "note-column-interface",
-/* reads */ "currentCommandColumn "
+ /* descr */ "Engrave piano pedal symbols and brackets.",
+ /* creats*/ "SostenutoPedal SustainPedal UnaCordaPedal SostenutoPedalLineSpanner SustainPedalLineSpanner UnaCordaPedalLineSpanner",
+ /* accepts */ "pedal-event",
+ /* acks */ "note-column-interface",
+ /* reads */ "currentCommandColumn "
"pedalSostenutoStrings pedalSustainStrings "
"pedalUnaCordaStrings pedalSostenutoStyle "
"pedalSustainStyle pedalUnaCordaStyle",
-/* write */ "");
+ /* write */ "");