- SCM settings = get_property ("autoBeamSettings");
-
- /* first guess */
-
- /* begin beam at any position
- (and fallback for end) */
- Moment moment (0);
-
- /* end beam at end of beat */
- if (dir == STOP)
- {
- SCM beat (get_property ("beatLength"));
-
- if (unsmob_moment (beat))
- moment = *unsmob_moment (beat);
- }
-
- /* second guess: property generic time exception */
- SCM m = gh_assoc (gh_append3 (function, wild, time), settings);
-
- if (m != SCM_BOOL_F && unsmob_moment (ly_cdr (m)))
- moment = * unsmob_moment (ly_cdr (m));
-
- /* third guess: property time exception, specific for duration type */
- m = gh_assoc (gh_append3 (function, type, time), settings);
- if (m != SCM_BOOL_F && unsmob_moment (ly_cdr (m)))
- moment = * unsmob_moment (ly_cdr (m));
-
- /* fourth guess [user override]: property plain generic */
- m = gh_assoc (gh_append3 (function, wild, wild), settings);
- if (m != SCM_BOOL_F && unsmob_moment (ly_cdr (m)))
- moment = * unsmob_moment (ly_cdr (m));
-
- /* fifth guess [user override]: property plain, specific for duration type */
- m = gh_assoc (gh_append3 (function, type, wild), settings);
- if (m != SCM_BOOL_F && unsmob_moment (ly_cdr (m)))
- moment = * unsmob_moment (ly_cdr (m));
-
- Rational r;
- if (moment.to_bool ())
- {
- /* Ugh? measurePosition can be negative, when \partial
- We may have to fix this elsewhere (timing translator)
- r = unsmob_moment (get_property ("measurePosition"))->mod_rat (moment);
- */
- Moment pos = * unsmob_moment (get_property ("measurePosition"));
- if (pos < Moment (0))
- {
- Moment length = * unsmob_moment (get_property ("measureLength"));
- pos = length - pos;
- }
- r = pos.main_part_.mod_rat (moment.main_part_);
- }
- else
- {
- if (dir == START)
- /* if undefined, starting is ok */
- r = 0;
- else
- /* but ending is not */
- r = 1;
- }
-
- return !r;