[c8 c] c4 c4 c4 |
}
+extend = {
+ c8(( c c )c c c c )c |
+ \[4/5c8( c c' c )c\]1/1 c c c c |
+ \[4/5c8( c c c c'\]1/1 c c c )c |
+ \[4/5c8( c c c c''\]1/1 c c c )c' |
+ \[4/5c8( c c c c'\]1/1 c c c )'c |
+ \[4/5c8( c c' c c\]1/1 c c c )c |
+ \[4/5c8( c c c ''c\]1/1 c c c )c |
+ \[4/5c8( c ''c c c\]1/1 c c c )c |
+}
+
\score{
\melodic{
\shortlong
\dirs
\complex
\beum
+ \stemup;
+ \octave c'';
+ \extend
+ \stemdown;
+ \octave c';
+ \extend
}
\paper{ }
}
#include "molecule.hh"
#include "lookup.hh"
-Bow::Bow()
+IMPLEMENT_IS_TYPE_B1(Bow,Directional_spanner);
+
+Bow::Bow ()
{
dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0;
dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
Offset
-Bow::center() const
+Bow::center () const
{
Real dy = dy_f_drul_[RIGHT]-dy_f_drul_[LEFT];
- Real w = width().length ();
+ Real w = width ().length ();
return Offset (w/2,dy );
}
+Real
+Bow::height_f () const
+{
+ return 0;
+}
Molecule*
-Bow::brew_molecule_p() const
+Bow::brew_molecule_p () const
{
Molecule*output = new Molecule;
- Real w = width().length ();
+ Real w = width ().length ();
Real dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
- Real nw_f = paper()->note_width ();
- Real nh_f = paper()->internote_f ();
+ Real nw_f = paper ()->note_width ();
w+= (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]);
Real round_w = w; // slur lookup rounds the slurwidth .
- Atom a = paper()->lookup_l ()->slur (dy_f, round_w, dir_);
+ Atom a = paper ()->lookup_l ()->slur (dy_f, round_w, height_f (), dir_);
Real error = w-round_w;
- a.translate (Offset ((dx_f_drul_[LEFT] + 0.5*nw_f)
+ a.translate (Offset ( (dx_f_drul_[LEFT] + 0.5*nw_f)
+ error/2,
dy_f_drul_[LEFT]));
output->add (a);
return output;
}
-
-IMPLEMENT_IS_TYPE_B1(Bow,Directional_spanner);
--- /dev/null
+/*
+ horizontal-vertical-group-item.cc -- implement Horizontal_vertical_group_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#include "horizontal-vertical-group-item.hh"
+#include "p-col.hh"
+
+void
+Horizontal_vertical_group_item::do_print() const
+{
+ Horizontal_vertical_group_element::do_print();
+}
+
+IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group_element,Item);
Drul_array<Real> dy_f_drul_;
Drul_array<Real> dx_f_drul_;
- Molecule*brew_molecule_p() const;
+ virtual Real height_f () const;
+ virtual Molecule* brew_molecule_p () const;
public:
Bow();
DECLARE_MY_RUNTIME_TYPEINFO;
#ifndef COLLISION_HH
#define COLLISION_HH
#include "lily-proto.hh"
-#include "elem-group-item.hh"
+#include "horizontal-vertical-group-item.hh"
/**
Resolve conflicts between various Note_columns (chords).
--- /dev/null
+/*
+ horizontal-vertical-group-item.hh -- declare Horizontal_vertical_group_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef HORIZONTAL_VERTICAL_GROUP_ITEM_HH
+#define HORIZONTAL_VERTICAL_GROUP_ITEM_HH
+
+#include "axis-group-item.hh"
+#include "elem-group.hh"
+
+
+/**
+ Treat a collection of items as a unity
+ */
+class Horizontal_vertical_group_item : public Axis_group_item, public Horizontal_vertical_group_element {
+protected:
+ virtual void do_print() const;
+ virtual void remove_all() { Horizontal_vertical_group_element::remove_all (); }
+ virtual void do_unlink () { Horizontal_vertical_group_element::do_unlink (); }
+ SCORE_HORIZONTAL_VERTICAL_CLONE(Horizontal_vertical_group_item);
+public:
+ virtual void add_element (Graphical_element*e) { Horizontal_vertical_group_element::add_element (e); }
+ virtual void remove_element (Graphical_element*e) { Horizontal_vertical_group_element::remove_element (e); }
+
+ DECLARE_MY_RUNTIME_TYPEINFO;
+};
+
+#endif // HORIZONTAL_VERTICAL_GROUP_ITEM_HH
Atom bar (String, Real height) const;
Atom dots () const;
- Atom slur (Real &dy, Real &dx, Direction dir) const;
+ Atom slur (Real &dy, Real &dx, Real ht, Direction dir) const;
Atom plet (Real &dy, Real &dx, Direction dir) const;
Atom tex_slur (int dy, Real &dx, Direction dir) const;
- Atom ps_slur (Real dy, Real dx, Real dir) const;
+ Atom ps_slur (Real dy, Real dx, Real ht, Real dir) const;
Atom half_slur (int dy, Real &dx, Direction dir, int xpart) const;
Atom half_slur_middlepart (Real &dx, Direction dir) const;
Atom big_slur (int dy, Real &dx, Direction dir) const;
#ifndef SCRIPT_COLUMN_HH
#define SCRIPT_COLUMN_HH
-#include "elem-group-item.hh"
+#include "horizontal-vertical-group-item.hh"
/** a struct for treating a group of noteheads (noteheads, stem
(chord) and scripts) as a single entity. */
virtual void do_add_processing ();
virtual void do_pre_processing ();
virtual void do_substitute_dependency (Score_elem*, Score_elem*);
+ virtual Real height_f () const;
SCORE_ELEM_CLONE(Slur);
DECLARE_MY_RUNTIME_TYPEINFO;
Atom ret;
if (embedded_b)
{
- Real height = 2 PT;
+ Real height = paper_l_->get_var ("barsize") / 6;
embed = "\\embeddedps{\n" ;
embed += String (wid) + " "
+ String (height) + " "
#include "debug.hh"
#include "boxes.hh"
-
-
void
Slur::add (Note_column*n)
{
}
void
-Slur::set_default_dir()
+Slur::set_default_dir ()
{
dir_ = DOWN;
- for (int i=0; i < encompass_arr_.size(); i ++)
+ for (int i=0; i < encompass_arr_.size (); i ++)
{
if (encompass_arr_[i]->dir_ < 0)
{
- dir_ =UP;
+ dir_ = UP;
break;
}
}
}
void
-Slur::do_add_processing()
+Slur::do_add_processing ()
{
- set_bounds(LEFT, encompass_arr_[0]);
+ set_bounds (LEFT, encompass_arr_[0]);
if (encompass_arr_.size () > 1)
- set_bounds(RIGHT, encompass_arr_.top());
+ set_bounds (RIGHT, encompass_arr_.top ());
}
void
Slur::do_substitute_dependency (Score_elem*o, Score_elem*n)
{
int i;
- while ((i = encompass_arr_.find_i ((Note_column*)o->item())) >=0)
+ while ((i = encompass_arr_.find_i ((Note_column*)o->item ())) >=0)
{
if (n)
- encompass_arr_[i] = (Note_column*)n->item();
+ encompass_arr_[i] = (Note_column*)n->item ();
else
encompass_arr_.del (i);
}
}
-
static int
Note_column_compare (Note_column *const&n1 , Note_column* const&n2)
{
- return Item::left_right_compare(n1, n2);
+ return Item::left_right_compare (n1, n2);
}
void
-Slur::do_post_processing()
+Slur::do_post_processing ()
{
encompass_arr_.sort (Note_column_compare);
if (!dir_)
- set_default_dir();
+ set_default_dir ();
Real interline_f = paper ()->interline_f ();
Real inter_f = interline_f / 2;
Drul_array<Note_column*> extrema;
extrema[LEFT] = encompass_arr_[0];
- extrema[RIGHT] = encompass_arr_.top();
+ extrema[RIGHT] = encompass_arr_.top ();
Direction d=LEFT;
- Real nw_f = paper()->note_width ();
+ Real nw_f = paper ()->note_width ();
do
{
}
else if (extrema[d]->stem_l_ && !extrema[d]->stem_l_->transparent_b_)
{
- dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_->height()[dir_]);
+ dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_->height ()[dir_]);
/* normal slur from notehead centre to notehead centre, minus gap */
dx_f_drul_[d] += -d * gap_f;
}
else
{
- dy_f_drul_[d] = (int)rint (extrema[d]->head_positions_interval()[dir_])* inter_f;
+ dy_f_drul_[d] = (int)rint (extrema[d]->head_positions_interval ()[dir_])* inter_f;
}
dy_f_drul_[d] += dir_ * interline_f;
}
while ((d *= -1) != LEFT);
}
+Real
+Slur::height_f () const
+{
+ /*
+ rather braindead way that of adjusting slur height
+ for heads/stems that extend beyond default slur
+ works quite good
+ */
+
+ Real interline_f = paper ()->interline_f ();
+ Real nh_f = interline_f / 2;
+ Real h = 0;
+ Real dx = width ().length ();
+ Real dy = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
+ Stem* stem = encompass_arr_[0]->stem_l_;
+ Real lx = stem->hpos_f ();
+ Real centre = (width ().min () + width ().max ()) / 2;
+ Real ly = stem->dir_ == dir_ ? stem->stem_end_f () : stem->stem_begin_f ()
+ + dir_ * nh_f / 2;
+ for (int i = 0; i < encompass_arr_.size (); i++)
+ {
+ Stem* stem = encompass_arr_[i]->stem_l_;
+ Real sx = abs (centre - stem->hpos_f ());
+ Real sy = stem->dir_ == dir_ ? stem->stem_end_f ()
+ : stem->stem_begin_f () + dir_ * nh_f / 2;
+ sy = dir_ * (sy - (ly + ((stem->hpos_f () - lx) / dx) * dy));
+ /*
+ uhm, correct for guess bezier curve (more if further from centre)
+ forget the cos alpha...
+ */
+ if (sy > 0)
+ h = h >? sy * (1 + 2 * sx / dx);
+ }
+ Real ratio = 1.0/3; // duh
+ /*
+ correct h for slur ratio
+ */
+ Real staffheight = paper ()->get_var ("barsize");
+ if (h)
+ h *= ((h * interline_f) / dx ) / ratio;
+ return h;
+}
+
IMPLEMENT_IS_TYPE_B1(Slur,Spanner);
}
Atom
-Lookup::ps_slur (Real dy , Real dx, Real dir) const
+Lookup::ps_slur (Real dy , Real dx, Real ht, Real dir) const
{
String ps = "\\embeddedps{\n";
ps += String_convert::double_str (dx) + " "
+ String_convert::double_str (dy) + " "
+ + String_convert::double_str (ht) + " "
+ String_convert::double_str (dir) +
" draw_slur}";
Atom
-Lookup::slur (Real &dy_f , Real &dx, Direction dir) const
+Lookup::slur (Real &dy_f , Real &dx, Real ht, Direction dir) const
{
if (dx < 0)
{
Atom s;
if (postscript_global_b)
- s = ps_slur (dy_f, dx, dir);
+ s = ps_slur (dy_f, dx, ht, dir);
else
{
Real nh = paper_l_->internote_f ();
copyright = "public domain";
}
-rh = \melodic{
+\include "paper20.ly"
+
+one = \melodic{
\octave c'';
\textstyle "italic";
- % ugh, start in multi, because of slurring an tieing over bars
- \multi 2 <
- {
- r16\p_"legato"
- ['d-1( 'fis-3 'd-1] ['a-2 'b-3 cis-4 'a-3]
- [d-3 cis-2 d-1 e-2] [d-1 fis-3 e-2 d-1] |
- \textstyle "finger";
- \stemup;
- )cis4-2 fis-5 ~ [fis8 fis-4] e4-3 ~ |
- e( )d8-2 s s4 s4 |
- r8 d4-> cis8-1 ~ cis 'b4-1 'b8 |
- }
- {
-% s1
- \stemdown;
- r8 'a4 'a8 'b4.-"2\\_1" cis8 ~ |
- cis16\< ['a( cis 'a] [d-2 e fis d-1]
- [g-3 fis g a-4] [a-3 b a \!g] |
- )fis4-"2\\_3" [e8-2 a-5] <fis4-4 d-2> <gis-5 e-3> |
- }
- >
- \stemboth;
+ r16\p_"legato"
+ \textstyle "finger";
+ ['d-1( 'fis-3 'd-1] ['a-2 'b-3 cis-4 'a-3]
+ [d-3 cis-2 d-1 e-2] [d-1 fis-3 e-2 d-1] |
+ \textstyle "finger";
+ \stemup;
+ )cis4-2 fis-5 ~ [fis8 fis-4] e4-3 ~ |
+ e16\< \stemboth ['a16( cis 'a] [d-2 e fis d-1]
+ [g-3 fis g a-4] [a-3 b a \!g] |
+ \stemup
+ )fis4-"2\\_3" [e8-2 a-5] <fis4-4 d-2> <gis-5 e-3> |
+ <a4-5( e> <fis-4 d-2> <[)g!16-5 d> fis-2 g-3 a-4]
+ \stemboth
+ [g-3 b a g] |
+ \textstyle "italic";
+ [fis_"dim." e fis-3 g] [fis-3 a-5 g fis]
+ \textstyle "finger";
+ e4-"2\\_5" ~ e16 ['e( 'fis 'g ] |
+ \textstyle "italic";
+ ['a-4_"dim." 'g-1 'a 'b] ['a-2 c-4 'b 'a]
+ ['g-1 'fis-2 'g-3 'a] ['g-3 'b 'a 'g] |
+ \stemup
+ )'fis4\p r16 [''b-1\< d-2 ''b~] <'g4-5 'e-3 ''b>
+ r16 ['cis-1 'e-2 \!cis] | % cis wants ~
+
+}
+
+two = \melodic{
+ \textstyle "finger";
+% ugh: koor
+% \translator Staff=bass \octave c; \stemup
+ fis4-1( e8-2 a4 a4 gis8-2 |
+ ) a8
+ \translator Staff=treble \octave c''; \stemdown
+ 'a4 'a8 'b4.-"2\\_1" cis8 ~ |
+ cis8
+ \translator Staff=bass \octave c; \stemup
+ a8 ~ [a d'] ~ d' d'4-> c'8 |
+ d'8
+ \translator Staff=treble \octave c''; \stemdown
+ d4-> cis8-1 ~ cis 'b4-1 'b8 |
+ r8 'a4 'a8
+ \translator Staff=bass \octave c; \stemup
+ [g'8-1( fis'-2] )e'4-1 ~ |
+ e'4 d' ~ [d'16 d-1 cis'-2 g-1] cis'4-2 ~ |
+ [c'8 a-3] d'4.-1 d'4-> cis'8-2 |
+ \translator Staff=treble \octave c''; \stemdown
+ 'd4 \skip 4*3; |
+}
+
+three = \melodic{
+ \octave c;
+ \stemdown;
+ d4-3 c-4 'b e-3 |
+ a16 ['a-5\mf( c-3 'a-5] [d-2 e-1 fis-2 d-4]
+ [g-1 fis-3 g a] [g b a g] |
+ )fis4 fis e a-4 |
+ d'16 \stemboth [d-5\f( fis-3 d-5] [a-2 b-1 c'-2 a-4]
+ [d'-1 c'-3 d' e'] [d'-4 fis'-2 e'-1 ) d'] |
+ [cis'-3 b-4 cis'-3 d'-2] [c'-4 e'-2 d'-3 c'-4]
+ \stemdown b4-5 [cis'8-4 b-3(] |
+ [a-4 )fis-5 b-2 a-3] [gis-4 e-5 a-3 g-4] |
+ fis4. d8-5 e4-5 a4-3 |
+ \stemboth
+ r16 [d-4( fis-2 d-4] [)g8-.-1 'g-.-5]
+ r16 [e-4( g-2 e-4] [)a8-. 'a-.-5] |
+}
+
+rh = \melodic{
+ \one
\bar "|.";
}
+
lh = \melodic{
- \octave c;
- \clef bass;
- s1 | s1 | s1 | s1
-% \multi 2 <
-% { \stemup; }
-% { \stemdown; }
-% >
-% \stemboth; |
+ \clef "bass";
+ \multi 2 <
+ \two
+ \three
+ >
\bar "|.";
}
+
global = \melodic{
\meter 4/4;
\key fis cis;
% Allegretto
% it would be nice to shut-off fingering...
\melodic \type Grandstaff <
- <
+ \type Staff=treble <
\global
- \rh
+% huh? try these iso directly!
+ \lh
+% \one
+% \two
>
- <
+ \type Staff=bass <
\global
- \lh
+ \rh
+% or try \two having here, iso above!
+% \two
+% \three
>
>
\paper{
+ \paper_twenty
+ linewidth= 195.\mm;
}
\midi{
\tempo 4 = 110;
bind def
/draw_cresc
{
+ staffrulethickness setlinewidth
/cresc_cont exch def
/cresc_ht exch def
/cresc_wd exch def
stroke
}
bind def
- staffheight 2 div
- /slurhtlimit exch def
+ staffheight 2 div /slurhtlimit exch def
/slurratio 0.3333 def
%
% (b*ratio)/(1 + b / htlimit)
/getslurcontrol
{
- slurhtlimit 90 div /slur_alpha exch def
+ slurhtlimit add /slurheight exch def
+ slurheight 90 div /slur_alpha exch def
slurratio 60 div slur_alpha div /slur_beta exch def
slur_beta mul 1 atan slur_alpha mul
} bind def
staffrulethickness setlinewidth
0 0 moveto
/slur_dir exch def
+ /slur_height exch def
/slur_dy exch def
/slur_dx exch def
slur_dy slur_dx lily_distance /slur_b exch def
- slur_b getslurcontrol
+ slur_b slur_height getslurcontrol
slur_dir mul /slur_ht exch def
- slur_b getslurcontrol /slur_indent exch def
+ slur_b slur_height getslurcontrol /slur_indent exch def
%
slur_dy slur_dx atan rotate
slur_indent slur_ht