+2003-05-18 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * scm/music-functions.scm (set-octavation): new function.
+
+ * input/regression/ottava.ly: new file
+
+ * lily/translator-scheme.cc (LY_DEFINE): new function
+ ly:unset-context-property
+ (LY_DEFINE) new function ly:context-property-where-defined:
+
2003-05-18 Heikki Junes <hjunes@cc.hut.fi>
* lilypond-font-lock.el: Add postfix syntax for horizontal groups.
* scm/music-functions.scm (make-multi-measure-rest): set input
locations for multimeasure rests.
-
2003-03-31 Juergen Reuter <reuter@ipd.uka.de>
* Staff symbol::
* Key signature::
* Clef::
+* Ottava brackets::
* Time signature::
* Unmetered music::
* Bar lines::
+@node Ottava brackets
+@subsection Ottava brackets
+
+``Ottava'' brackets introduce an extra transposition of an octave for
+the staff. They are created by invoking the function
+@code{set-octavation}
+
+@cindex ottava
+@cindex 15ma
+@cindex octavation
+
+@lilypond[verbatim,fragment]
+\relative c''' {
+ a2 b
+ #(set-octavation 1)
+ a b
+ #(set-octavation 0)
+ a b }
+@end lilypond
+
+Internally the @code{set-octavation} sets @code{ottavation} (eg. to
+@code{"8va"}) and @code{centralCPosition} properties.
+
+@seealso
+
+@internalsref{OttavaBracket}
+
+@refbugs
+
+@code{set-octavation} will get confused when clef changes happen
+during an octavation bracket.
@node Time signature
@subsection Time signature
The string to be printed, as well as the style, is set through object
properties.
-[TODO: 8va engraver.]
-
-An application is to fake octavation indications.
-
@lilypond[fragment,relative,verbatim]
- \relative c' { a''' b c a
- \property Voice.TextSpanner \set #'type = #'dotted-line
- \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
- \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
- \property Staff.centralCPosition = #-13
- a-\startTextSpan b c a-\stopTextSpan }
+ \relative c' { c1
+ \property Voice.TextSpanner \set #'direction = #-1
+ \property Voice.TextSpanner \set #'edge-text = #'("rall " . "")
+ c2-\startTextSpan b c-\stopTextSpan a }
@end lilypond
* NOTATION
+
+
** Ancient notation ... ?? ... (Jurgen?)
-** Completely rewritten text formatting support. It is implemented in a
+** Completely rewritten text formatting support, implemented in a
completely modular way.
** Chord name formatting completely rewritten.
-** Texts on multimeasure rests can be set by the user.
+** Texts can be added to multimeasure rests
** Zigzagged glissandi
** Nested horizontal brackets for music analysis.
- NOTE-\groupOpen
+ NOTE-\startGroup
..
- NOTE-\groupClose
+ NOTE-\stopGroup
** Gregorian ligatures.
-** Texts on multi-measure rests.
+** Ottava brackets. Syntax: #(set-octavation 1)
+** Metronome markings.
New features in 1.6 since 1.4
--- /dev/null
+\header
+{
+texidoc = "ottava brackets are supported, through the
+use of the scheme function @code{set-octavation}.
+"
+
+}
+\version "1.7.18"
+
+
+\paper { raggedright = ##t}
+\score {
+ \notes\relative c''' \notes {
+ a b c a
+ #(set-octavation 1)
+ a b c a
+ #(set-octavation 0)
+
+ a b c a
+}
+}
+
+++ /dev/null
-\version "1.7.16"
-
-
-fragment = \notes {
- a'''' b c a
- \property Voice.TextSpanner \set #'type = #'dotted-line
- \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
- \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
- \property Staff.centralCPosition = #-13
- a-\startTextSpan b c a-\stopTextSpan
-}
-
-\paper { raggedright = ##t}
-
-\score {
- \notes\relative c \fragment
- \paper { }
-}
-%% new-chords-done %%
}
}
-
SCM
make_chord_step (int step, int alter)
{
return ch;
}
-
+/*
+ Todo: actually also use apply iso. call too ...
+*/
+bool
+ly_input_procedure_p (SCM x)
+{
+ return gh_procedure_p (x)
+ || (gh_pair_p (x) && gh_procedure_p (gh_car (x)));
+}
Music*
set_property_music (SCM sym, SCM value)
Simple_music:
event_chord { $$ = $1; }
| APPLYOUTPUT embedded_scm {
- if (!gh_procedure_p ($2))
+ if (!ly_input_procedure_p ($2))
THIS->parser_error (_ ("\applycontext takes function argument"));
$$ = MY_MAKE_MUSIC ("ApplyOutputEvent");
$$->set_mus_property ("procedure", $2);
$$->set_spot (THIS->here_input());
}
| APPLYCONTEXT embedded_scm {
- if (!gh_procedure_p ($2))
+ if (!ly_input_procedure_p ($2))
THIS->parser_error (_ ("\applycontext takes function argument"));
$$ = MY_MAKE_MUSIC ("ApplyContext");
$$->set_mus_property ("procedure", $2);
scm_gc_unprotect_object (p->self_scm ());
}
| APPLY embedded_scm Music {
+ if (!ly_input_procedure_p ($2))
+ THIS->parser_error (_ ("\apply takes function argument"));
+
SCM ret = gh_call1 ($2, $3->self_scm ());
Music *m = unsmob_music (ret);
if (!m) {
Translator_group* tr= dynamic_cast<Translator_group*> (t);
SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
+ SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+
tr->internal_set_property (name, val);
return SCM_UNSPECIFIED;
}
+LY_DEFINE(ly_context_property_where_defined,
+ "ly:context-property-where-defined", 2, 0, 0,
+ (SCM context, SCM name),
+ "Return the context above @var{context} where @var{name} is defined.")
+{
+ Translator *t = unsmob_translator (context);
+ Translator_group* tr = dynamic_cast<Translator_group*> (t);
+ SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
+ SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+
+ return tr->where_defined (name)->self_scm();
+}
+
+LY_DEFINE(ly_unset_context_property,
+ "ly:unset-context-property", 2, 0, 0,
+ (SCM context, SCM name),
+ "Unset value of property @var{name} in context @var{context}.")
+{
+ Translator *t = unsmob_translator (context);
+ Translator_group* tr = dynamic_cast<Translator_group*> (t);
+ SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
+ SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+
+ tr->unset_property (name);
+
+ return SCM_UNSPECIFIED;
+}
+
+
+
LY_DEFINE(ly_context_parent,
"ly:context-parent", 1, 0, 0,
(SCM context),
InnerChoirStaffContext = \translator {
\type "Engraver_group_engraver"
\name InnerChoirStaff
- %% alignmentReference = #0 FIXME
\consists "System_start_delimiter_engraver"
systemStartDelimiter = #'SystemStartBracket
localKeySignature = #'()
\accepts "Lyrics"
\accepts "ChordNames"
}
+
ChoirStaffContext = \translator {
\InnerChoirStaffContext
\name ChoirStaff
\description "
A context like @code{Staff} but for printing rhythms. Pitches are
- ignored; the notes are printed on one line. It can contain
- @code{Voice} contexts.
+ ignored; the notes are printed on one line.
"
minimumVerticalExtent = ##f
extraVerticalExtent = ##f
\type "Engraver_group_engraver"
\name GrandStaff
localKeySignature = #'()
- \description "
- Contains @code{Staff} or @code{RhythmicStaff} contexts. It adds a
- brace on the left side, grouping the staves together. The bar
- lines of the contained staves are connected vertically. It can
- contain @code{Staff} contexts."
+
+ \description " A group of staffs, with a brace on the left
+ side, grouping the staves together. The bar lines of the
+ contained staves are connected vertically. "
\consists "Span_bar_engraver"
\consists "Span_arpeggio_engraver"
StaffGroupContext = \translator {
\InnerStaffGroupContext
\name StaffGroup
- \description "
- Contains @code{Staff} or @code{RhythmicStaff} contexts. Adds a
- bracket on the left side, grouping the staves together. The bar
- lines of the contained staves are connected vertically. It can
- contain @code{Staff}, @code{RhythmicStaff}, @code{GrandStaff}, or
- @code{Lyrics} contexts.
+
+ \description
+
+ " Groups staffs while adding a bracket on the left side,
+ grouping the staves together. The bar lines of the contained
+ staves are connected vertically.
"
\accepts "InnerChoirStaff"
other context can contain a @code{Score} context. This context
handles the administration of time signatures. It also makes sure
that items such as clefs, time signatures, and key-signatures are
- aligned across staves. It can contain @code{Lyrics},
- @code{Staff}, @code{RhythmicStaff}, @code{GrandStaff},
- @code{StaffGroup}, and @code{ChoirStaff} contexts.
+ aligned across staves.
You cannot explicitly instantiate a Score context (since it is
not contained in any other context). It is instantiated
(type . line)
(if-text-padding . 1.0)
(width-correct . 0)
- (outer . #t)
+ (enclose-bounds . #t)
(direction . -1)
(edge-widen . (0.5 . 0.5))
(edge-height . (1.0 . 1.0))
(Y-offset-callbacks . (,Side_position_interface::aligned_side))
(molecule-callback . ,Text_spanner::brew_molecule)
(font-family . roman)
- (outer . #t)
+ (enclose-bounds . #t)
(width-correct . 0.0)
(type . dotted-line)
(edge-height . (0 . 1.5))
then beams are generated automatically.")
(translator-property-description 'noDirection boolean? "Don't set directions by a2-engraver when part-combining.")
(translator-property-description 'oneBeat ly:moment? " How long does one beat in the current time signature last?")
+(translator-property-description
+ 'originalCentralCPosition integer?
+ "Used for temporary overriding central C in octavation brackets. ")
(translator-property-description 'othersolo boolean? "FIXME")
(translator-property-description 'ottavation string? "If set, the text
for an 8va spanner. Changing this implies a new text spanner. ")
"define-music-properties.scm"
"auto-beam.scm"
"chord-name.scm"
+
"define-translator-properties.scm"
+ "translation-functions.scm"
"script.scm"
"drums.scm"
"midi.scm"
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; tuplets.
-
-(define-public (denominator-tuplet-formatter mus)
- (number->string (ly:get-mus-property mus 'denominator)))
-
-(define-public (fraction-tuplet-formatter mus)
- (string-append (number->string (ly:get-mus-property mus 'numerator))
- ":"
- (number->string (ly:get-mus-property mus 'denominator))
- ))
-
-;; metronome marks
-(define-public (make-metronome-markup event context)
- (let*
- ((dur (ly:get-mus-property event 'tempo-unit))
- (count (ly:get-mus-property event 'metronome-count))
- (note-mark (make-note-markup (ly:duration-log dur)
- (ly:duration-dot-count dur)
- 1)
- )
- )
-
- (make-line-markup
- (list
- note-mark
- (make-simple-markup "=")
- (make-simple-markup (number->string count))
-
- ))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
music))
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; repeats.
m
))
-
+;;;;;;;;;;;;;;;;
+;; mmrest
(define-public (make-multi-measure-rest duration location)
(let*
(
m
))
+
+
+(define-public (make-ottava-set octavation)
+ (let*
+ (
+ (m (make-music-by-name 'ApplyContext))
+ )
+
+
+ (define (ottava-modify context)
+ "Either reset centralCPosition to the stored original,
+or remember old centralCPosition, add OCTAVATION to centralCPosition,
+and set OTTAVATION to `8va', or whatever appropriate.
+"
+ (if (= octavation 0)
+ (let*
+ ((where (ly:context-property-where-defined context 'centralCPosition))
+ (oc0 (ly:get-context-property context 'originalCentralCPosition))
+
+ )
+
+ (ly:set-context-property context 'centralCPosition oc0)
+ (ly:unset-context-property where 'originalCentralCPosition)
+ (ly:unset-context-property where 'ottavation)
+ )
+
+ (let*
+ ((where (ly:context-property-where-defined context 'centralCPosition))
+ (c0 (ly:get-context-property context 'centralCPosition))
+ (new-c0 (+ c0 (* -7 octavation)))
+ (string (cdr
+ (assoc octavation '((2 . "15ma")
+ (1 . "8va")
+ (0 . #f)
+ (-1 . "8va bassa")
+ (-2 . "15ma bassa")))))
+ )
+
+ (ly:set-context-property where 'centralCPosition new-c0)
+ (ly:set-context-property where 'originalCentralCPosition c0)
+ (ly:set-context-property where 'ottavation string)
+
+ )))
+
+ (ly:set-mus-property! m 'procedure ottava-modify)
+ m
+ ))
+
+(define-public (set-octavation ottavation)
+ (ly:export (make-ottava-set ottavation)))
+
(define-public (make-time-signature-set num den . rest)
" Set properties for time signature NUM/DEN.
Rest can contain a list of beat groupings
--- /dev/null
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; tuplets.
+
+(define-public (denominator-tuplet-formatter mus)
+ (number->string (ly:get-mus-property mus 'denominator)))
+
+(define-public (fraction-tuplet-formatter mus)
+ (string-append (number->string (ly:get-mus-property mus 'numerator))
+ ":"
+ (number->string (ly:get-mus-property mus 'denominator))
+ ))
+
+
+;; metronome marks
+(define-public (make-metronome-markup event context)
+ (let*
+ ((dur (ly:get-mus-property event 'tempo-unit))
+ (count (ly:get-mus-property event 'metronome-count))
+ (note-mark (make-note-markup (ly:duration-log dur)
+ (ly:duration-dot-count dur)
+ 1)
+ )
+ )
+
+ (make-line-markup
+ (list
+ note-mark
+ (make-simple-markup "=")
+ (make-simple-markup (number->string count))
+
+ ))))
+