options.
* Documentation/user/internals.itely (Creating contexts): document
\newcontext
* lily/parser.yy (Composite_music): add \newcontext
* Documentation/user/refman.itely (MIDI block): add note about
dotted tempos.
* lily/my-lily-lexer.cc (start_main_input): define input-file-name
as Scheme variable.
2003-08-26 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * input/regression/bar-number.ly: remove unnecessary old-relative
+ options.
+
+ * Documentation/user/internals.itely (Creating contexts): document
+ \newcontext
+
+ * lily/parser.yy (Composite_music): add \newcontext
+
* Documentation/user/refman.itely (MIDI block): add note about
dotted tempos.
@itemize
+@item
+The @code{\newcontext} command will create a context with a unique
+name automatically. Hence, for multi-staff scores, it is no longer
+necessary to invent arbitrary context names. For example, a two-staff
+score may be created by
+
+@example
+ \simultaneous @{
+ \newcontext Staff @{ @var{notes for 1st staff} @}
+ \newcontext Staff @{ @var{notes for 2nd staff} @}
+ @}
+@end example
+
+
+
@item
Octave checks make octave errors easier to correct.
The syntax is
@end lilypond
-@item @code{< \context Staff ... >}
+@item @code{< \newcontext Staff ... >}
@tab more staves
@tab
@lilypond[fragment]
-< \context Staff = SA { c'1 }
- \context Staff = SB { c'1 } >
+< \newcontext Staff { c'1 }
+ \newcontext Staff { c'1 } >
@end lilypond
@cindex @code{\context}
@cindex context selection
-Contexts for a music expression can be selected manually, using the
-following music expression:
+Contexts for a music expression can be selected manually, using one of
+the following music expressions:
@example
+\newcontext @var{contexttype} @var{musicexpr}
\context @var{contexttype} [= @var{contextname}] @var{musicexpr}
@end example
@code{e4}. A context is ended when when all music referring it has
finished, so after the third quarter, @code{another} is removed.
+The @code{\newcontext} construction creates a context with a
+generated, unique @var{contextname}. An expression with
+@code{\newcontext} always leads to a new context. This is convenient
+for creating multiple staffs, multiple lyric lines, etc.
+
+When using automatic staff changes, automatic phrasing, etc., the
+context names have special meanings, so @code{\newcontext} cannot be
+used.
+
@node Default contexts
@subsection Default contexts
@c
@lilypond[fragment, verbatim]
< \context StaffGroup <
- \context Staff = up { e'4 d'
+ \newcontext Staff { e'4 d'
\bar "||"
f' e' }
- \context Staff = down { \clef bass c4 g e g } >
-\context Staff = pedal { \clef bass c2 c2 } >
+ \newcontext Staff { \clef bass c4 g e g } >
+\newcontext Staff { \clef bass c2 c2 } >
@end lilypond
small, short-lived voices or for single chords:
@lilypond[verbatim,fragment]
-\context Voice = VA \relative c'' {
+\context Staff \relative c'' {
c4 < { f d e } \\ { b c2 } > c4 < g' \\ b, \\ f' \\ d >
}
@end lilypond
@lilypond[singleline, verbatim]
\relative c''
-\context Staff < \context Voice = VA { \voiceOne cis2 b }
- \context Voice = VB { \voiceThree b4 ais ~ ais4 gis4 }
- \context Voice = VC { \voiceTwo fis4~ fis4 f ~ f } >
+\context Staff < \newcontext Voice { \voiceOne cis2 b }
+ \newcontext Voice { \voiceThree b4 ais ~ ais4 gis4 }
+ \newcontext Voice { \voiceTwo fis4~ fis4 f ~ f } >
@end lilypond
Normally, note heads with a different number of dots are not merged, but
@example
\score @{
\notes \relative c'' <
- \context Staff = sa @{ cis4 d e2 @}
+ \newcontext Staff @{ cis4 d e2 @}
\context GrandStaff <
\pianoAccidentals
- \context Staff = sb @{ cis4 d e2 @}
- \context Staff = sc @{ es2 c @}
+ \newcontext Staff @{ cis4 d e2 @}
+ \newcontext Staff @{ es2 c @}
>
- \context Staff = sd @{ es2 c @}
+ \newcontext Staff @{ es2 c @}
>
@}
@end example
@lilypond[singleline]
\score {
\notes \relative c'' <
- \context Staff = sa { cis4 d e2 }
+ \newcontext Staff { cis4 d e2 }
\context GrandStaff <
\pianoAccidentals
- \context Staff = sb { cis4 d e2 }
- \context Staff = sc { es2 c }
+ \newcontext Staff { cis4 d e2 }
+ \newcontext Staff { es2 c }
>
- \context Staff = sd { es2 c }
+ \newcontext Staff { es2 c }
>
\paper {
\translator {
every eighth grace note:
@lilypond[relative=2,verbatim,fragment]
-< \context Staff = SA { e4 \grace { c16[ d e f] } e4 }
- \context Staff = SB { c'4 \grace { g8[ b] } c4 } >
+< \newcontext Staff { e4 \grace { c16[ d e f] } e4 }
+ \newcontext Staff { c'4 \grace { g8[ b] } c4 } >
@end lilypond
care when you mix staves with grace notes and staves without, for example,
@lilypond[relative=2,verbatim,fragment]
-< \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
- \context Staff = SB { c4 \bar "|:" d4 } >
+< \newcontext Staff { e4 \bar "|:" \grace c16 d4 }
+ \newcontext Staff { c4 \bar "|:" d4 } >
@end lilypond
Grace sections should only be used within sequential music
\score {
\apply #(drums->paper 'drums) \context Staff <
\clef percussion
- \context Voice = up { \voiceOne \up }
- \context Voice = down { \voiceTwo \down }
+ \newcontext Voice { \voiceOne \up }
+ \newcontext Voice { \voiceTwo \down }
>
}
\score {
\apply #(drums->paper 'mydrums) \context Staff <
\clef percussion
- \context Voice = up { \voiceOne \up }
- \context Voice = down { \voiceTwo \down }
+ \newcontext Voice { \voiceOne \up }
+ \newcontext Voice { \voiceTwo \down }
>
}
@end lilypond
bass = \notes \transpose c c,, { a4. e8 r e g e }
\score {
<
- \apply #(drums->paper 'drums) \context Staff = drums <
+ \apply #(drums->paper 'drums) \newcontext Staff <
\clef percussion
- \context Voice = up { \voiceOne \up }
- \context Voice = down { \voiceTwo \down }
+ \newcontext Voice { \voiceOne \up }
+ \newcontext Voice { \voiceTwo \down }
>
- \context Staff = bass { \clef "F_8" \bass }
+ \newcontext Staff { \clef "F_8" \bass }
>
}
@end lilypond
staff. The syntax for this is
@example
\autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
-@end example
+@end example
+The two staffs of the piano staff must be named @code{up} and
+@code{down}.
+
The autochanger switches on basis of pitch (central C is the turning
point), and it looks ahead skipping over rests to switch in
advance. Here is a practical example:
@lilypond[fragment,relative,verbatim]
\context PianoStaff <
\property PianoStaff.connectArpeggios = ##t
- \context Voice = one { <<c' e g c>>-\arpeggio }
- \context Voice = other { \clef bass <<c,, e g>>-\arpeggio }
+ \newcontext Staff { <<c' e g c>>-\arpeggio }
+ \newcontext Staff { \clef bass <<c,, e g>>-\arpeggio }
>
@end lilypond
staves and lyrics first, e.g.
@example
\context ChoirStaff \notes <
- \context Lyrics = LA @{ s1 @}
- \context Staff = SA @{ s1 @}
- \context Lyrics = LB @{ s1 @}
- \context Staff = SB @{ s1 @}
+ \newcontext Lyrics @{ s1 @}
+ \newcontext Staff @{ s1 @}
+ \newcontext Lyrics @{ s1 @}
+ \newcontext Staff @{ s1 @}
>
@end example
and then combine the appropriate melodies and lyric lines:
@example
\addlyrics
- \context Staff = SA @emph{the music}
- \context Lyrics = LA @emph{the lyrics}
+ \newcontext Staff @emph{the music}
+ \newcontext Lyrics @emph{the lyrics}
@end example
putting both together, you would get
@example
\context ChoirStaff \notes <
- \context Lyrics = LA @dots{}
- \context Staff = SB @dots{}
+ \newcontext Lyrics @dots{}
+ \newcontext Staff @dots{}
\addlyrics @dots{}
>
@end example
\score {
\context ChoirStaff {
<
- \context Staff = one { \upper }
- \context Staff = three { \lower }
+ \newcontext Staff { \upper }
+ \newcontext Staff { \lower }
>
}
\paper {
names:
@lilypond[fragment,verbatim,singleline]
- \notes \context Staff = treble {
+ \notes {
\property Staff.instrument = \markup {
\column << "Clarinetti"
{ "in B"
@lilypond[verbatim]
\score {
\notes \relative c' <
- \context Staff = SA { e4 f g a \break c1 }
- \context Staff = SB { c4 d e f \break R1 }
+ \newcontext Staff { e4 f g a \break c1 }
+ \newcontext Staff { c4 d e f \break R1 }
>
\paper {
linewidth = 6.\cm
@quotation
@lilypond[fragment,verbatim]
\simultaneous {
- \context Staff = staffA { \clef violin c'' }
- \context Staff = staffB { \clef bass c }
+ \newcontext Staff { \clef violin c'' }
+ \newcontext Staff { \clef bass c }
}
@end lilypond
@end quotation
@lilypond[verbatim,singleline]
\score {
\notes
- < \context Staff = staffA {
+ < \newcontext Staff {
\time 3/4
\clef violin
\relative c'' {
e2( d4 c2 b4 a8[ a]
b[ b] g[ g] a2.) }
}
- \context Staff = staffB {
+ \newcontext Staff {
\clef bass
c2 e4 g2.
f4 e d c2.
@lilypond[fragment]
<
- \context Staff = staffA
+ \newcontext Staff
\relative c''
< { a4 g2 f4-~ f4 } \\
{ s4 g4 f2 f4 } >
- \context Staff = staffB
+ \newcontext Staff
< { \clef bass <<c g>>1 } \\
{ f4 d e2 }
>
Printing such a staff is done similar to the polyphonic example in
@ref{Combining music into compound expressions}:
@example
- < \context Staff = up @{ @dots{} @}
- \context Staff = down @{ @dots{} @}
+ < \newcontext Staff @{ @dots{} @}
+ \newcontext Staff @{ @dots{} @}
>
@end example
but now this entire expression must be interpreted as a
@lilypond[relative 0,fragment]
\context PianoStaff
- < \context Staff = up { \time 2/4
+ < \newcontext Staff { \time 2/4
c4 c g' g }
- \context Staff = down {
+ \newcontext Staff {
\clef bass c,, c' e c }
>
@end lilypond
\score @{
\simultaneous @{
- \context Staff = hornStaff \hornNotes
- \context Staff = bsnStaff \bassoonNotes
+ \newcontext Staff \hornNotes
+ \newcontext Staff \bassoonNotes
@} @}
@end example
@lilypond[singleline]
\score {
\notes \relative c \simultaneous {
- \context Staff = hornStaff { \time 2/4
+ \newcontext Staff { \time 2/4
R2*3
r4 f8 a cis4 f e d }
- \context Staff = fagStaff { \clef bass
+ \newcontext Staff { \clef bass
r4 d,8 f | gis4 c | b bes |
a8 e f4 | g d | gis f }
} }
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc="
-#(ly:set-option 'old-relative)
+
\header {
texidoc = "Tied accidentaled notes (which cause reminder accidentals) don't wreak havoc in
the spacing when unbroken."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\header {
texidoc = "Ambituses indicate pitch ranges for voices.
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc="
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\header
{
texidoc = "Automatic beaming is also done on tuplets."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\header {
texidoc="Test automatic beamer: the last measure should have a single beam."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{ texidoc="Automatic kneeing. A knee is made when a horizontal
-#(ly:set-option 'old-relative)
+
\header {
texidoc = "Beams can be printed across line breaks if forced.
"
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc="
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header { texidoc = "@cindex Beam Damp
Beams are less steep than the notes they encompass. " }
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc="
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc = "Explicit beams may cross barlines. "
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc="
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header
{
-#(ly:set-option 'old-relative)
+
\header {
texidoc = "The number of beams doesn't change on a rest."
}
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc="
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc = "Automatic beaming works also in ternary time sigs."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc = "Beams (simple)."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc = "Clusters are a device to denote that a complete range of
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc = "Dots move to the right when a collision with the (up)flag happens."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc = "Broken crescendi should be open on one side."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {texidoc = "Dynamic letters are kerned, and their weight
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc=" Dynamics appear below or above the staff. If multiple
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc = "
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header { texidoc = "The magnification can be set for any font. Note
that this doesn't change variable symbols such as beams or slurs. " }
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header
{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc = "Bar line should come before the grace note."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\header
{
texidoc = "Grace beams and normal beams may occur simultaneously.
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
% ?
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc = "Another nested grace situation."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc = "Partcombiner and grace notes can go together."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc = "Pieces may begin with grace notes."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc = "Here startGraceMusic should set no-stem-extend to true;
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc = "Instrument names are also printed on partial starting measures."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header { texidoc = "Tests placement of accidentals in every clef. " }
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header { texidoc = "Key signatures can be set per pitch
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc="
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc="
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
texidoc="Lyric phrasing
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header
{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\header
{
-#(ly:set-option 'old-relative)
+
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header { texidoc=" You can write molecule callbacks in Scheme, thus
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
-#(ly:set-option 'old-relative)
+
\header
{
-#(ly:set-option 'old-relative)
+
\header
{
texidoc = "Ottava brackets are supported, through the
-#(ly:set-option 'old-relative)
+
\header { texidoc = "
Setting @code{\outputproperty} is a clumsy and deprecated way of changing
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header {
texidoc="Multi measure rests of second voice should not disappear."
-#(ly:set-option 'old-relative)
+
\version "1.9.1"
\header{
{"markup", MARKUP},
{"midi", MIDI},
{"name", NAME},
+ {"newcontext", NEWCONTEXT},
{"notes", NOTES},
{"octave", OCTAVE},
{"once", ONCE},
%pure_parser
-/* tokens which are not keywords */
-%token AUTOCHANGE
+
+%token ACCEPTS
+%token ADDLYRICS
%token ALIAS
+%token ALTERNATIVE
+%token APPLY
%token APPLYCONTEXT
%token APPLYOUTPUT
-%token APPLY
-%token ACCEPTS
-%token ALTERNATIVE
+%token AUTOCHANGE
%token BAR
%token BREATHE
%token CHORDMODIFIERS
%token CHORDS
+%token CHORD_CLOSE
+%token CHORD_OPEN
%token CLEF
+%token COMMANDSPANREQUEST
%token CONSISTS
-%token DURATION
-%token SEQUENTIAL
-%token GROBDESCRIPTIONS
-%token SIMULTANEOUS
%token CONSISTSEND
+%token CONTEXT
+%token DEFAULT
%token DENIES
%token DESCRIPTION
+%token DURATION
%token EXTENDER
%token FIGURES FIGURE_OPEN FIGURE_CLOSE
%token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
%token GRACE
+%token GROBDESCRIPTIONS
%token HEADER
%token HYPHEN
%token INVALID
%token KEY
%token LYRICS
%token MARK
-%token MULTI_MEASURE_REST
%token MIDI
-%token PITCH
-%token DEFAULT
+%token MULTI_MEASURE_REST
%token NAME
-%token PITCHNAMES
+%token NEWCONTEXT
%token NOTES
+%token OCTAVE
%token ONCE
+%token OUTPUTPROPERTY
+%token OVERRIDE SET REVERT
%token PAPER
+%token PARTCOMBINE
%token PARTIAL
+%token PITCH
+%token PITCHNAMES
%token PROPERTY
-%token OVERRIDE SET REVERT
%token RELATIVE
%token REMOVE
%token REPEAT
-%token ADDLYRICS
-%token PARTCOMBINE
+%token REST
%token SCM_T
%token SCORE
+%token SEQUENTIAL
+%token SIMULTANEOUS
%token SKIP
%token SPANREQUEST
-%token COMMANDSPANREQUEST
%token TEMPO
-%token OUTPUTPROPERTY
-%token OCTAVE
-%token TIME_T
%token TIMES
+%token TIME_T
%token TRANSLATOR
%token TRANSPOSE
%token TYPE
%token UNSET
-%token CONTEXT
-%token REST
-%token CHORD_OPEN
-%token CHORD_CLOSE
/* escaped */
$$ = csm;
}
+ | NEWCONTEXT string Music {
+ static int new_context_count;
+
+ Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
+
+ csm->set_mus_property ("element", $3->self_scm ());
+ scm_gc_unprotect_object ($3->self_scm ());
+
+ csm->set_mus_property ("context-type", $2);
+
+ SCM new_id = scm_number_to_string (gh_int2scm (new_context_count ++),
+ gh_int2scm (10));
+ csm->set_mus_property ("context-id", new_id);
+ $$ = csm;
+ }
| TIMES {
THIS->push_spot ();
}
/*
Backwards compatibility.
*/
-bool lily_1_8_relative = true;
+bool lily_1_8_relative = false;
bool lily_1_8_compatibility_used = false;
/*
\include "declarations-init.ly"
-#(ly:set-option 'old-relative #t)
+#(ly:set-option 'new-relative)
#(ly:set-point-and-click #f)
\maininput