#include <math.h> // tanh.
-
+#include "molecule.hh"
#include "directional-element-interface.hh"
#include "beaming.hh"
#include "beam.hh"
void
Beam::add_stem (Score_element*me, Score_element*s)
{
- Pointer_group_interface gi (me, "stems");
- gi.add_element (s);
+ Pointer_group_interface:: add_element(me, "stems", s);
s->add_dependency (me);
[Alternatively, stems could set its own directions, according to
their beam, during 'final-pre-processing'.]
*/
-MAKE_SCHEME_CALLBACK(Beam,before_line_breaking);
+MAKE_SCHEME_CALLBACK(Beam,before_line_breaking,1);
SCM
Beam::before_line_breaking (SCM smob)
{
Set elt properties height and y-position if not set.
Adjust stem lengths to reach beam.
*/
-MAKE_SCHEME_CALLBACK(Beam,after_line_breaking);
+MAKE_SCHEME_CALLBACK(Beam,after_line_breaking,1);
SCM
Beam::after_line_breaking (SCM smob)
{
/*
steep slope running against lengthened stem is suspect
*/
- Real ss = me->paper_l ()->get_var ("staffspace");
Real first_ideal = Stem::calc_stem_info (first_visible_stem (me)).idealy_f_;
Real last_ideal = Stem::calc_stem_info (last_visible_stem (me)).idealy_f_;
- Real lengthened = gh_scm2double (me->get_elt_property ("outer-stem-length-limit")) * ss;
+ Real lengthened = gh_scm2double (me->get_elt_property ("outer-stem-length-limit"));
Real steep = gh_scm2double (me->get_elt_property ("slope-limit"));
// ugh -> use commonx
int beam_multiplicity = get_multiplicity (me);
int stem_multiplicity = (Stem::flag_i (s) - 2) >? 0;
- Real staffspace = me->paper_l ()->get_var ("staffspace");
-
SCM space_proc = me->get_elt_property ("space-function");
SCM space = gh_call1 (space_proc, gh_int2scm (beam_multiplicity));
- Real thick = gh_scm2double (me->get_elt_property ("thickness")) *staffspace;
- Real interbeam_f = gh_scm2double (space) * staffspace;
+ Real thick = gh_scm2double (me->get_elt_property ("thickness")) ;
+ Real interbeam_f = gh_scm2double (space) ;
// ugh -> use commonx
Real x0 = first_visible_stem (me)->relative_coordinate (0, X_AXIS);
SCM proc = me->get_elt_property ("height-quants");
SCM quants = gh_call2 (proc, me->self_scm (),
gh_double2scm (me->paper_l ()->get_var ("stafflinethickness")
- / me->paper_l ()->get_var ("staffspace")));
+ / 1.0));
for (SCM s = quants; gh_pair_p (s); s = gh_cdr (s))
Real staffline_f = me->paper_l ()->get_var ("stafflinethickness");
int multiplicity = get_multiplicity (me);
- Real staffspace =me->paper_l ()->get_var ("staffspace");
SCM space_proc = me->get_elt_property ("space-function");
SCM space = gh_call1 (space_proc, gh_int2scm (multiplicity));
- Real thick = gh_scm2double (me->get_elt_property ("thickness")) *staffspace;
- Real interbeam_f = gh_scm2double (space) * staffspace;
+ Real thick = gh_scm2double (me->get_elt_property ("thickness")) ;
+ Real interbeam_f = gh_scm2double (space) ;
Real bdy = interbeam_f;
Real stemdx = staffline_f;
SCM proc = me->get_elt_property ("flag-width-function");
SCM result = gh_call1 (proc, gh_int2scm (t));
- nw_f = gh_scm2double (result) * staffspace;
+ nw_f = gh_scm2double (result);
}
w = w/2 <? nw_f;
Molecule a;
if (lhalfs) // generates warnings if not
- a = me->lookup_l ()->beam (dydx, w, thick);
+ a = Lookup::beam (dydx, w, thick);
a.translate (Offset (-w, -w * dydx));
for (int j = 0; j < lhalfs; j++)
{
int rwholebeams= Stem::beam_count (here,RIGHT) <? Stem::beam_count (next,LEFT) ;
Real w = next->relative_coordinate (0, X_AXIS) - here->relative_coordinate (0, X_AXIS);
- Molecule a = me->lookup_l ()->beam (dydx, w + stemdx, thick);
+ Molecule a = Lookup::beam (dydx, w + stemdx, thick);
a.translate_axis( - stemdx/2, X_AXIS);
int j = 0;
Real gap_f = 0;
// TODO: notehead widths differ for different types
gap_f = nw_f / 2;
w -= 2 * gap_f;
- a = me->lookup_l ()->beam (dydx, w + stemdx, thick);
+ a = Lookup::beam (dydx, w + stemdx, thick);
}
for (; j < rwholebeams; j++)
w = w/2 <? nw_f;
if (rhalfs)
- a = me->lookup_l ()->beam (dydx, w, thick);
+ a = Lookup::beam (dydx, w, thick);
for (; j < rwholebeams + rhalfs; j++)
{
return leftbeams;
}
-MAKE_SCHEME_CALLBACK(Beam,brew_molecule);
+MAKE_SCHEME_CALLBACK(Beam,brew_molecule,1);
SCM
Beam::brew_molecule (SCM smob)
{
mol.translate_axis (x0
- dynamic_cast<Spanner*> (me)->get_bound (LEFT)->relative_coordinate (0, X_AXIS), X_AXIS);
- return mol.create_scheme ();
+ return mol.smobbed_copy ();
}
int
rest -> stem -> beam -> interpolate_y_position ()
*/
-Real
-Beam::rest_collision_callback (Score_element *rest, Axis a )
+MAKE_SCHEME_CALLBACK(Beam,rest_collision_callback,2);
+SCM
+Beam::rest_collision_callback (SCM element_smob, SCM axis)
{
+ Score_element *rest = unsmob_element (element_smob);
+ Axis a = (Axis) gh_scm2int (axis);
+
assert (a == Y_AXIS);
Score_element * st = unsmob_element (rest->get_elt_property ("stem"));
Score_element * stem = st;
if (!stem)
- return 0.0;
+ return gh_double2scm (0.0);
Score_element * beam = unsmob_element (stem->get_elt_property ("beam"));
if (!beam || !Beam::has_interface (beam) || !Beam::visible_stem_count (beam))
- return 0.0;
+ return gh_double2scm (0.0);
// make callback for rest from this.
Real beam_dy = 0;
Real beamy = (stem->relative_coordinate (0, X_AXIS) - x0) * dydx + beam_y;
Real staff_space = Staff_symbol_referencer::staff_space (rest);
- Real rest_dim = rest->extent (Y_AXIS)[d]*2.0 / staff_space ;
+
+
+ Real rest_dim = rest->extent (rest, Y_AXIS)[d]*2.0 / staff_space ; // refp??
Real minimum_dist
= gh_scm2double (rest->get_elt_property ("minimum-beam-collision-distance"));
if (discrete_dist < stafflines+1)
discrete_dist = int (ceil (discrete_dist / 2.0)* 2.0);
- return (-d * discrete_dist);
+ return gh_double2scm (-d * discrete_dist);
}
void
Beam::set_interface (Score_element*me)
{
- Pointer_group_interface g (me, "stems");
- g.set_interface ();
-
/*
why the init? No way to tell difference between default and user
override. */