"clefPosition "
"explicitClefVisibility "
"forceClef "
- "middleCPosition "
,
/* write */ "");
span_ = make_spanner ("OttavaBracket", SCM_EOL);
span_->set_property ("text", ott);
- SCM c0 (get_property ("middleCPosition"));
- SCM oc0 (get_property ("originalMiddleCPosition"));
- if (scm_less_p (oc0, c0) == SCM_BOOL_T)
+ SCM offset (get_property ("middleCOffset"));
+ if (robust_scm2double (offset, 0) > 0)
span_->set_property ("direction", scm_from_int (DOWN));
}
}
return pitch_interval (*r, *p).smobbed_copy ();
}
+
+/* FIXME: probably isn't the right place for this function */
+#include "context.hh"
+LY_DEFINE (ly_set_middle_C_x, "ly:set-middle-C!",
+ 1, 0, 0, (SCM context),
+ "Set the @code{middleCPosition} variable in @var{context}"
+ " based on the variables @code{middleCClefPosition} and"
+ " middleCOffset.")
+{
+ LY_ASSERT_SMOB (Context, context, 1);
+
+ Context *c = unsmob_context (context);
+ int clef_pos = robust_scm2int (c->get_property ("middleCClefPosition"), 0);
+ int offset = robust_scm2int (c->get_property ("middleCOffset"), 0);
+
+ c->set_property (ly_symbol2scm ("middleCPosition"), scm_from_int (clef_pos + offset));
+ return SCM_UNDEFINED;
+}
tieWaitForNote = ##f
clefGlyph = #"clefs.G"
clefPosition = #-2
+ middleCClefPosition = #-6
middleCPosition = #-6
firstClef = ##t
bassStaffProperties = #'((assign clefGlyph "clefs.F")
(assign clefPosition 2)
- (assign middleCPosition 6))
+ (assign middleCPosition 6)
+ (assign middleCClefPosition 6))
%% tablature:
stringOneTopmost = ##t
highStringOne = ##t
%% Choose vaticana do clef on 3rd line as default.
clefGlyph = #"clefs.vaticana.do"
middleCPosition = #1
+ middleCClefPosition = #1
clefPosition = #1
clefOctavation = #0
%% Choose petrucci g clef on 2nd line as default.
clefGlyph = #"clefs.petrucci.g"
+ middleCClefPosition = #-6
middleCPosition = #-6
clefPosition = #-2
clefOctavation = #0
@code{midiMinimumVolume}.")
(midiMinimumVolume ,number? "Set the minimum loudness for MIDI.
Ranges from 0 to@tie{}1.")
+ (middleCClefPosition ,number? "The position of the middle C,
+as determined only by the clef. This can be calculated by looking at
+@code{clefPosition} and @code{clefGlyph}.")
+ (middleCOffset ,number? "The offset of
+middle C from the position given by @code{middleCClefPosition} This
+is used for ottava brackets.")
(middleCPosition ,number? "The place of the middle C, measured in
half staff-spaces. Usually determined by looking at
-@code{clefPosition} and @code{clefGlyph}.")
+@code{middleCClefPosition} and @code{middleCOffset}.")
(minimumFret ,number? "The tablature auto string-selecting
mechanism selects the highest string with a fret at least
@code{minimumFret}.")
"Either reset middleCPosition to the stored original, or remember
old middleCPosition, add OCTAVATION to middleCPosition, and set
OTTAVATION to `8va', or whatever appropriate."
- (if (number? (ly:context-property context 'middleCPosition))
- (begin
- (if (number? (ly:context-property context 'originalMiddleCPosition))
- (let ((where (ly:context-property-where-defined context 'middleCPosition)))
-
- (ly:context-set-property! context 'middleCPosition
- (ly:context-property context 'originalMiddleCPosition))
- (ly:context-unset-property where 'originalMiddleCPosition)
- (ly:context-unset-property where 'ottavation)))
-ot
- (let* ((where (ly:context-property-where-defined context 'middleCPosition))
- (c0 (ly:context-property context 'middleCPosition))
- (new-c0 (+ c0 (* -7 octavation)))
- (string (cdr (assoc octavation '((2 . "15ma")
- (1 . "8va")
- (0 . #f)
- (-1 . "8vb")
- (-2 . "15mb"))))))
- (ly:context-set-property! context 'middleCPosition new-c0)
- (ly:context-set-property! context 'originalMiddleCPosition c0)
- (ly:context-set-property! context 'ottavation string)))))
+ (if (number? (ly:context-property context 'middleCOffset))
+ (let ((where (ly:context-property-where-defined context 'middleCOffset)))
+ (ly:context-unset-property where 'middleCOffset)
+ (ly:context-unset-property where 'ottavation)))
+
+ (let* ((offset (* -7 octavation))
+ (string (cdr (assoc octavation '((2 . "15ma")
+ (1 . "8va")
+ (0 . #f)
+ (-1 . "8vb")
+ (-2 . "15mb"))))))
+ (ly:context-set-property! context 'middleCOffset offset)
+ (ly:context-set-property! context 'ottavation string)
+ (ly:set-middle-C! context)))
(set! (ly:music-property m 'procedure) ottava-modify)
(context-spec-music m 'Staff)))
(if (pair? e)
(let* ((musics (map make-prop-set
`(((symbol . clefGlyph) (value . ,(cadr e)))
- ((symbol . middleCPosition)
+ ((symbol . middleCClefPosition)
(value . ,(+ oct
(caddr e)
(cdr (assoc (cadr e) c0-pitch-alist)))))
((symbol . clefPosition) (value . ,(caddr e)))
((symbol . clefOctavation) (value . ,(- oct))))))
+ (recalc-mid-C (make-music 'ApplyContext))
(seq (make-music 'SequentialMusic
- 'elements musics))
+ 'elements (append musics (list recalc-mid-C))))
(csp (make-music 'ContextSpeccedMusic)))
+ (set! (ly:music-property recalc-mid-C 'procedure) ly:set-middle-C!)
(context-spec-music seq 'Staff))
(begin
(ly:warning (_ "unknown clef type `~a'") clef-name)