From 30ff0f06d4db076922f81be7fe33a7bcf0690114 Mon Sep 17 00:00:00 2001 From: hanwen Date: Wed, 18 Feb 2004 11:32:39 +0000 Subject: [PATCH] * scm/define-translator-properties.scm (all-user-translation-properties): add printOctaveNames * ly/engraver-init.ly: remove Note_event_swallower. * lily/note-name-engraver.cc (process_music): new property printOctaveNames * lily/context.cc (find_existing_context): remove support for Current. * scm/music-functions.scm (set-accidental-style): new function; duplicate accidental macros. * ly/property-init.ly (hideStaffSwitch): remove accidental macros. * lily/note-name-engraver.cc (process_music): process_acknowledged_grobs () -> process_music () --- ChangeLog | 23 +++- Documentation/user/refman.itely | 153 +++++++++----------------- input/regression/accidental-octave.ly | 33 +----- input/regression/accidental-voice.ly | 39 ++----- input/regression/accidentals.ly | 35 +----- lily/context.cc | 3 +- lily/note-name-engraver.cc | 25 +++-- ly/engraver-init.ly | 1 - ly/init.ly | 6 + ly/property-init.ly | 95 ---------------- scm/define-translator-properties.scm | 1 + scm/lily.scm | 1 - scm/music-functions.scm | 109 ++++++++++++++++++ scripts/convert-ly.py | 12 ++ 14 files changed, 231 insertions(+), 305 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1582689bd3..10940a351d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2004-02-18 Han-Wen Nienhuys + * scm/define-translator-properties.scm + (all-user-translation-properties): add printOctaveNames + + * ly/engraver-init.ly: remove Note_event_swallower. + + * lily/note-name-engraver.cc (process_music): new property + printOctaveNames + + * lily/context.cc (find_existing_context): remove support for + Current. + + * scm/music-functions.scm (set-accidental-style): new function; + duplicate accidental macros. + + * ly/property-init.ly (hideStaffSwitch): remove accidental macros. + + * lily/note-name-engraver.cc (process_music): + process_acknowledged_grobs () -> process_music () + * scm/part-combiner.scm (determine-split-list): robustification. 2004-02-17 Han-Wen Nienhuys @@ -27,8 +46,8 @@ 2004-02-17 Han-Wen Nienhuys * lily/accidental-engraver.cc (process_acknowledged_grobs): use - properties from Voice context. This fixes staff-switches during - grace contexts. + properties from Voice context. This fixes accidental size for + staff-switches during grace contexts. * lily/note-collision.cc (check_meshing_chords): only wipe heads if necessary. Else, simply wipe dots. diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index ac1b83d073..36563253f2 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -1530,67 +1530,34 @@ inserted automatically before the running notes. @node Using the predefined accidental variables @subsection Using the predefined accidental variables -The constructs for describing the accidental typesetting rules are -quite hairy, so non-experts should stick to the variables -defined in @file{ly/property-init.ly}. -@cindex @file{property-init.ly} - -The variables set properties in the ``@code{Current}'' context (see -@ref{Context properties}). This means that the variables should -normally be added right after the creation of the context in which the -accidental typesetting described by the variable is to take -effect. For example, if you want to use piano-accidentals in a piano -staff, then issue @code{\pianoAccidentals} first thing after the -creation of the piano staff: + +Common rules for typesetting macros have been canned in a +function. This function is called as follows: + +@cindex @code{set-accidental-style} @example -\score @{ - \notes \relative c'' << - \new Staff @{ cis4 d e2 @} - \context GrandStaff << - \pianoAccidentals - \new Staff @{ cis4 d e2 @} - \new Staff @{ es2 c @} - >> - \new Staff @{ es2 c @} - >> -@} + #(set-accidental-style 'modern 'Voice) @end example -@lilypond[raggedright] -\score { - \notes \relative c'' << - \new Staff { cis4 d e2 } - \context GrandStaff << - \pianoAccidentals - \new Staff { cis4 d e2 } - \new Staff { es2 c } - >> - \new Staff { es2 c } - >> - \paper { - \translator { - \StaffContext - minimumVerticalExtent = #'(-4.0 . 4.0) - } - } -} -@end lilypond -The variables are: +The function takes two arguments: a symbol that denotes the style (in +the example, @code{modern}), and another symbol that denotes the +context name (in this example, @code{Staff}). If no context name is +supplied, @code{Staff} is the default. + +The following styles are supported: @table @code -@item \defaultAccidentals - @cindex @code{\defaultAccidentals} +@item default This is the default typesetting behaviour. It should correspond to 18th century common practice: Accidentals are remembered to the end of the measure in which they occur and only on their own octave. -@item \voiceAccidentals - @cindex @code{\voiceAccidentals} +@item voice @c - The normal behaviour is to -remember the accidentals on Staff-level. This variable, however, -typesets accidentals individually for each voice. Apart from that the -rule is similar to @code{\defaultAccidentals}. + The normal behaviour is to remember the accidentals on +Staff-level. This variable, however, typesets accidentals +individually for each voice. Apart from that, the rule is similar to +@code{code}. This leads to some weird and often unwanted results because accidentals from one voice do not get cancelled in other @@ -1603,78 +1570,79 @@ rule is similar to @code{\defaultAccidentals}. { c, e } >> >> @end lilypond - Hence you should only use @code{\voiceAccidentals} if the voices + Hence you should only use @code{voice} if the voices are to be read solely by individual musicians. If the staff is to be used by one musician (e.g. a conductor) then you use -@code{\modernVoiceAccidentals} or @code{\modernVoiceCautionaries} +@code{modern} or @code{modern-cautionary} instead. -@item \modernAccidentals - @cindex @code{\modernAccidentals} +@item modern +@cindex @code{modern} style accidentals This rule corresponds to the common practice in the 20th century. - The rule is more complex than @code{\defaultAccidentals}. - You get all the same accidentals, but temporary - accidentals also get cancelled in other octaves. Furthermore, - in the same octave, they also get cancelled in the following measure: + This rule prints the same accidentals as @code{default}, but temporary + accidentals also are cancelled in other octaves. Furthermore, + in the same octave, they also get cancelled in the following + measure: + @lilypond[raggedright,fragment,verbatim] \modernAccidentals cis' c'' cis'2 | c'' c' @end lilypond -@item \modernCautionaries - @cindex @code{\modernCautionaries} - This rule is similar to @code{\modernAccidentals}, but the +@item @code{modern-cautionary} + @cindex @code{modern-cautionary} + This rule is similar to @code{modern}, but the ``extra'' accidentals (the ones not typeset by - @code{\defaultAccidentals}) are typeset as cautionary accidentals. + @code{default}) are typeset as cautionary accidentals. They are printed in reduced size or with parentheses: @lilypond[raggedright,fragment,verbatim] - \modernCautionaries + modern-cautionary cis' c'' cis'2 | c'' c' @end lilypond - @cindex @code{\modernVoiceAccidentals} -@item \modernVoiceAccidentals + @cindex @code{modern-voice} +@item modern-voice is used for multivoice accidentals to be read both by musicians playing one voice and musicians playing all voices. Accidentals are typeset for each voice, but they @emph{are} cancelled across voices in the same @internalsref{Staff}. - @cindex @code{\modernVoiceCautionaries} -@item \modernVoiceCautionaries -is the same as @code{\modernVoiceAccidentals}, but with the extra -accidentals (the ones not typeset by @code{\voiceAccidentals}) typeset + @cindex @code{modern-voice-cautionary} +@item modern-voice-cautionary +is the same as @code{modern-voice}, but with the extra +accidentals (the ones not typeset by @code{voice}) typeset as cautionaries. Even though all accidentals typeset by -@code{\defaultAccidentals} @emph{are} typeset by this variable then +@code{default} @emph{are} typeset by this variable then some of them are typeset as cautionaries. -@item \pianoAccidentals - @cindex @code{\pianoAccidentals} +@item piano + @cindex @code{piano} accidentals 20th century practice for piano notation. Very similar to - @code{\modernAccidentals} but accidentals also get cancelled + @code{modern} but accidentals also get cancelled across the staves in the same @internalsref{GrandStaff} or @internalsref{PianoStaff}. -@item \pianoCautionaries +@item piano-cautionary @cindex @code{\pianoCautionaries} As @code{\pianoAccidentals} but with the extra accidentals typeset as cautionaries. -@item \noResetKey - @cindex @code{\noResetKey} - Same as @code{\defaultAccidentals} but with accidentals lasting +@item no-reset + @cindex @code{no-reset} accidental style + Same as @code{default} but with accidentals lasting ``forever'' and not only until the next measure: @lilypond[raggedright,fragment,verbatim,relative] \noResetKey c1 cis cis c @end lilypond -@item \forgetAccidentals - @cindex @code{\forgetAccidentals} - This is sort of the opposite of @code{\noResetKey}: Accidentals +@item forget + This is sort of the opposite of @code{no-reset}: Accidentals are not remembered at all---and hence all accidentals are typeset relative to the key signature, regardless of what was before in the music: + @lilypond[raggedright,fragment,verbatim,relative] \forgetAccidentals \key d\major c4 c cis cis d d dis dis @@ -1719,29 +1687,6 @@ voices in the same staff share accidentals, but staves do not. @end table -@refcommands - -@cindex @code{\defaultAccidentals} -@code{\defaultAccidentals}, -@cindex @code{\voiceAccidentals} -@code{\voiceAccidentals}, -@cindex @code{\modernAccidentals} -@code{\modernAccidentals}, -@cindex @code{\modernCautionaries} -@code{\modernCautionaries}, -@cindex @code{\modernVoiceAccidentals} -@code{\modernVoiceAccidentals}, -@cindex @code{\modernVoiceCautionaries} -@code{\modernVoiceCautionaries}, -@cindex @code{\pianoAccidentals} -@code{\pianoAccidentals}, -@cindex @code{\pianoCautionaries} -@code{\pianoCautionaries}, -@cindex @code{\noResetKey} -@code{\noResetKey}, -@cindex @code{\forgetAccidentals} -@code{\forgetAccidentals}. - @seealso Internals: @internalsref{Accidental_engraver}, diff --git a/input/regression/accidental-octave.ly b/input/regression/accidental-octave.ly index eda7014802..118bacaa34 100644 --- a/input/regression/accidental-octave.ly +++ b/input/regression/accidental-octave.ly @@ -10,34 +10,6 @@ This shows how accidentals in different octaves are handled. } -#(define (lo-octave p) - (let* ((a (ly:pitch-alteration p)) - (n (ly:pitch-notename p))) - (ly:make-pitch -1 n a))) - -#(define (no-octaves music) - (let* ((es (ly:get-mus-property music 'elements)) - (e (ly:get-mus-property music 'element)) - (p (ly:get-mus-property music 'pitch))) - - (if (pair? es) - (ly:set-mus-property! - music 'elements - (map no-octaves es))) - - (if (ly:music? e) - (ly:set-mus-property! - music 'element - (no-octaves e))) - - (if (ly:pitch? p) - (begin - (set! p (lo-octave p)) - (ly:set-mus-property! music 'pitch p))) - - - music)) - mel = \notes \transpose c c' { @@ -49,7 +21,10 @@ mel = \notes \transpose c c' { \score { << \context Staff \mel - \context NoteNames \apply #no-octaves \mel + \context NoteNames{ + \set printOctaveNames= ##f + \mel + } >> } diff --git a/input/regression/accidental-voice.ly b/input/regression/accidental-voice.ly index f735632933..7f70f9adf1 100644 --- a/input/regression/accidental-voice.ly +++ b/input/regression/accidental-voice.ly @@ -9,33 +9,7 @@ The last f gets cautionary natural because fis was only in the other voice. " } -#(define (lo-octave p) - (let* ((a (ly:pitch-alteration p)) - (n (ly:pitch-notename p))) - (ly:make-pitch -1 n a))) -#(define (no-octaves music) - (let* ((es (ly:get-mus-property music 'elements)) - (e (ly:get-mus-property music 'element)) - (p (ly:get-mus-property music 'pitch))) - - (if (pair? es) - (ly:set-mus-property! - music 'elements - (map no-octaves es))) - - (if (ly:music? e) - (ly:set-mus-property! - music 'element - (no-octaves e))) - - (if (ly:pitch? p) - (begin - (set! p (lo-octave p)) - (ly:set-mus-property! music 'pitch p))) - - - music)) voicea = \notes \transpose c c' { \stemUp @@ -49,13 +23,20 @@ voiceb = \notes \transpose c c' { \score { << \notes - \new NoteNames \apply #no-octaves \voicea + \new NoteNames { + \set printOctaveNames = ##f + \voicea + } \context Staff << - \modernVoiceCautionaries + #(set-accidental-style 'modern-voice-cautionary) \new Voice \voicea \new Voice \voiceb >> - \new NoteNames \apply #no-octaves \voiceb + \new NoteNames { + \set printOctaveNames = ##f + \voiceb + + } >> \paper { raggedright = ##t } } diff --git a/input/regression/accidentals.ly b/input/regression/accidentals.ly index b4984c908b..1256165e61 100644 --- a/input/regression/accidentals.ly +++ b/input/regression/accidentals.ly @@ -5,36 +5,6 @@ texidoc=" This shows how accidentals are handled. " } - -#(define (lo-octave p) - (let* ((a (ly:pitch-alteration p)) - (n (ly:pitch-notename p))) - (ly:make-pitch -1 n a))) - -#(define (no-octaves music) - (let* ((es (ly:get-mus-property music 'elements)) - (e (ly:get-mus-property music 'element)) - (p (ly:get-mus-property music 'pitch))) - - (if (pair? es) - (ly:set-mus-property! - music 'elements - (map no-octaves es))) - - (if (ly:music? e) - (ly:set-mus-property! - music 'element - (no-octaves e))) - - (if (ly:pitch? p) - (begin - (set! p (lo-octave p)) - (ly:set-mus-property! music 'pitch p))) - - - music)) - - mel = \notes { \key d \major \time 4/4 d4 dis dis8 dis, d4 | d dis disis8 d, dis4 | d des disis8 dis, d4 | dis deses d dis ~ | dis dis ~ dis8 d, dis4 ~ | \break dis dis cis c | c cis cisis cis | c ces cisis c | cis ceses c cis ~ | cis cis ~ cis cis \bar "|." | \break @@ -43,7 +13,10 @@ mel = \notes { \key d \major \time 4/4 \score { \notes << \context Staff \transpose c c'' \mel - \context NoteNames \apply #no-octaves \mel + \context NoteNames{ + \set printOctaveNames = ##f + \mel + } >> } diff --git a/lily/context.cc b/lily/context.cc index 4503d1cf7c..6b4b71b2dc 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -97,8 +97,7 @@ Context::Context () Context * Context::find_existing_context (SCM n, String id) { - if ((is_alias (n) && (id_string_ == id || id.is_empty ())) - || n == ly_symbol2scm ("Current")) + if ((is_alias (n) && (id_string_ == id || id.is_empty ()))) return this; Context* r = 0; diff --git a/lily/note-name-engraver.cc b/lily/note-name-engraver.cc index 47562e6e2c..05f6c5987e 100644 --- a/lily/note-name-engraver.cc +++ b/lily/note-name-engraver.cc @@ -16,10 +16,10 @@ class Note_name_engraver : public Engraver public: TRANSLATOR_DECLARATIONS(Note_name_engraver); - Link_array reqs_; + Link_array events_; Link_array texts_; virtual bool try_music (Music*m); - virtual void process_acknowledged_grobs (); + virtual void process_music (); virtual void stop_translation_timestep (); }; @@ -28,29 +28,32 @@ Note_name_engraver::try_music (Music *m) { if (m->is_mus_type ("note-event")) { - reqs_.push (m); + events_.push (m); return true; } return false; } void -Note_name_engraver::process_acknowledged_grobs () +Note_name_engraver::process_music () { - if (texts_.size ()) - return; String s ; - for (int i=0; i < reqs_.size (); i++) + for (int i=0; i < events_.size (); i++) { if (i) s += " "; - s += unsmob_pitch (reqs_[i]->get_mus_property ("pitch"))->to_string (); + Pitch p = *unsmob_pitch (events_[i]->get_mus_property ("pitch")); + + if (!to_boolean (get_property ("printOctaveNames"))) + p = Pitch (-1, p.get_notename (), p.get_alteration ()); + + s += p.to_string (); } if (s.length ()) { Item * t = make_item ("NoteName"); t->set_grob_property ("text", scm_makfrom0str (s.to_str0 ())); - announce_grob(t, reqs_[0]->self_scm()); + announce_grob (t, events_[0]->self_scm()); texts_.push (t); } } @@ -63,7 +66,7 @@ Note_name_engraver::stop_translation_timestep () typeset_grob (texts_[i]); } texts_.clear () ; - reqs_.clear (); + events_.clear (); } @@ -76,5 +79,5 @@ ENTER_DESCRIPTION(Note_name_engraver, /* creats*/ "NoteName", /* accepts */ "note-event", /* acks */ "", -/* reads */ "", +/* reads */ "printOctaveNames", /* write */ ""); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 74c260355d..7b368fe34f 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -350,7 +350,6 @@ printing of a single line of lyrics. " \consists "Rest_swallow_translator" \consists "Skip_event_swallow_translator" \consists "Tie_engraver" - \consists "Note_swallow_translator" \consists "Note_name_engraver" \consists "Separating_line_group_engraver" } diff --git a/ly/init.ly b/ly/init.ly index ea1d75d85e..5894ad2c70 100644 --- a/ly/init.ly +++ b/ly/init.ly @@ -13,6 +13,12 @@ #(ly:set-point-and-click #f) \maininput +% there is a problem at the end of the input file + + +%% +%% above message is to compensate for look ahead of the parser. +%% #(if (and (ly:get-option 'old-relative) (not (ly:get-option 'old-relative-used))) diff --git a/ly/property-init.ly b/ly/property-init.ly index 3f1a5e4261..899dd031d6 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -117,101 +117,6 @@ emptyText = \override TextScript #'no-spacing-rods = ##t showStaffSwitch = \set followVoice = ##t hideStaffSwitch = \set followVoice = ##f -% accidentals as they were common in the 18th century. -defaultAccidentals = { - \set Current.extraNatural = ##t - \set Current.autoAccidentals = #'(Staff (same-octave . 0)) - \set Current.autoCautionaries = #'() -} - -% accidentals in voices instead of staves. -% Notice that accidentals from one voice do NOT get cancelled in other voices -voiceAccidentals = { - \set Current.extraNatural = ##t - \set Current.autoAccidentals = #'(Voice (same-octave . 0)) - \set Current.autoCautionaries = #'() - -} - -% accidentals as suggested by Kurt Stone, Music Notation in the 20th century. -% This includes all the default accidentals, but accidentals also needs cancelling -% in other octaves and in the next measure. -modernAccidentals = { - \set Current.extraNatural = ##f - \set Current.autoAccidentals = #'(Staff (same-octave . 0) (any-octave . 0) (same-octave . 1)) - \set Current.autoCautionaries = #'() -} - -% the accidentals that Stone adds to the old standard as cautionaries -modernCautionaries = { - \set Current.extraNatural = ##f - \set Current.autoAccidentals = #'(Staff (same-octave . 0)) - \set Current.autoCautionaries = #'(Staff (any-octave . 0) (same-octave . 1)) -} - -% Multivoice accidentals to be read both by musicians playing one voice -% and musicians playing all voices. -% Accidentals are typeset for each voice, but they ARE cancelled across voices. -modernVoiceAccidentals = { - \set Current.extraNatural = ##f - \set Current.autoAccidentals = #'( - Voice (same-octave . 0) (any-octave . 0) (same-octave . 1) - Staff (same-octave . 0) (any-octave . 0) (same-octave . 1) - ) - \set Current.autoCautionaries = #'() -} - -% same as modernVoiceAccidental eccept that all special accidentals are typeset -% as cautionaries -modernVoiceCautionaries = { - \set Current.extraNatural = ##f - \set Current.autoAccidentals = #'( - Voice (same-octave . 0) - ) - \set Current.autoCautionaries = #'( - Voice (any-octave . 0) (same-octave . 1) - Staff (same-octave . 0) (any-octave . 0) (same-octave . 1) - ) -} - -% stone's suggestions for accidentals on grand staff. -% Accidentals are cancelled across the staves in the same grand staff as well -pianoAccidentals = { - \set Current.autoAccidentals = #'( - Staff (same-octave . 0) (any-octave . 0) (same-octave . 1) - GrandStaff (any-octave . 0) (same-octave . 1) - ) - \set Current.autoCautionaries = #'() -} - -pianoCautionaries = { - \set Current.autoAccidentals = #'( - Staff (same-octave . 0) - ) - \set Current.autoCautionaries = #'( - Staff (any-octave . 0) (same-octave . 1) - GrandStaff (any-octave . 0) (same-octave . 1) - ) -} - - -% Do not reset the key at the start of a measure. Accidentals will be -% printed only once and are in effect until overridden, possibly many -% measures later. -noResetKey = { - \set Current.autoAccidentals = #'(Staff (same-octave . #t)) - \set Current.autoCautionaries = #'() -} - -% do not set localKeySignature when a note alterated differently from -% localKeySignature is found. -% Causes accidentals to be printed at every note instead of -% remembered for the duration of a measure. -% accidentals not being remembered, causing accidentals always to be typeset relative to the time signature -forgetAccidentals = { - \set Current.autoAccidentals = #'(Staff (same-octave . -1)) - \set Current.autoCautionaries = #'() -} % To remove a Volta bracket or some other graphical object, diff --git a/scm/define-translator-properties.scm b/scm/define-translator-properties.scm index a6cd485be2..1b21fa39ae 100644 --- a/scm/define-translator-properties.scm +++ b/scm/define-translator-properties.scm @@ -247,6 +247,7 @@ the string to print when this is done with the pedal.") sustain pedals: text, bracket or mixed (both).") (pedalUnaCordaStyle ,symbol? "see pedalSustainStyle.") (pedalSostenutoStyle ,symbol? "see pedalSustainStyle.") + (printOctaveNames ,boolean? "Print octave marks for the NoteNames context.") (rehearsalMark ,integer? "The last rehearsal mark printed.") (repeatCommands ,list? "This property is read to find any command of the form (volta . X), where X is a string or #f") diff --git a/scm/lily.scm b/scm/lily.scm index d451954498..ab4066cd91 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -503,4 +503,3 @@ L1 is copied, L2 not. ".scm" ) "w"))) -(set-debug-cell-accesses! 1000) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 0f61658f52..e0ef92b44a 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -789,3 +789,112 @@ Rest can contain a list of beat groupings )))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; accidentals + +(define-public (set-accidentals-properties + extra-natural + auto-accs auto-cauts + context) + (context-spec-music + (make-sequential-music + (append + (if (boolean? extra-natural) (list (make-property-set 'extraNatural extra-natural)) '()) + (list + (make-property-set 'autoAccidentals auto-accs) + (make-property-set 'autoCautionaries auto-cauts) + ))) + context)) + +(define-public (set-accidental-style style . rest) + "Set accidental style to STYLE. Optionally takes a context argument, +eg. 'Staff or 'Voice. The context defaults to Voice, except for piano styles, which +use PianoStaff as a context. " + + (let + ((context (if (pair? rest) + (car rest) 'Staff)) + (pcontext (if (pair? rest) + (car rest) 'PianoStaff)) + ) + + (ly:export + + (cond + ; accidentals as they were common in the 18th century. + ((equal? style 'default) (set-accidentals-properties #t '(Staff (same-octave . 0)) '() context)) + + ; accidentals from one voice do NOT get cancelled in other voices + ((equal? style 'voice) (set-accidentals-properties #t '(Voice (same-octave . 0)) '() context)) + + ; accidentals as suggested by Kurt Stone, Music Notation in the 20th century. + ; This includes all the default accidentals, but accidentals also needs cancelling + ; in other octaves and in the next measure. + ((equal? style 'modern) (set-accidentals-properties #f '(Staff (same-octave . 0) (any-octave . 0) (same-octave . 1)) '() context)) + + ; the accidentals that Stone adds to the old standard as cautionaries + ((equal? style 'modern-cautionary) + (set-accidentals-properties #f '(Staff (same-octave . 0)) + '(Staff (any-octave . 0) (same-octave . 1)) + context)) + + ; Multivoice accidentals to be read both by musicians playing one voice + ; and musicians playing all voices. + ; Accidentals are typeset for each voice, but they ARE cancelled across voices. + ((equal? style 'modern-voice) + (set-accidentals-properties #f + '(Voice (same-octave . 0) (any-octave . 0) (same-octave . 1) + Staff (same-octave . 0) (any-octave . 0) (same-octave . 1)) + '() + context)) + + ; same as modernVoiceAccidental eccept that all special accidentals are typeset + ; as cautionaries + + ((equal? style 'modern-voice-cautionary) + (set-accidentals-properties #f + '(Voice (same-octave . 0) ) + '(Voice (any-octave . 0) (same-octave . 1) + Staff (same-octave . 0) (any-octave . 0) (same-octave . 1)) + context)) + + ; stone's suggestions for accidentals on grand staff. + ; Accidentals are cancelled across the staves in the same grand staff as well + ((equal? style 'piano) + (set-accidentals-properties #f + '( Staff (same-octave . 0) (any-octave . 0) (same-octave . 1) + PianoStaff (any-octave . 0) (same-octave . 1)) + '() + pcontext)) + ((equal? style 'piano-cautionary) + (set-accidentals-properties #f + '(Staff (same-octave . 0)) + '(Staff (any-octave . 0) (same-octave . 1) + PianoStaff (any-octave . 0) (same-octave . 1)) + pcontext)) + + ; do not set localKeySignature when a note alterated differently from + ; localKeySignature is found. + ; Causes accidentals to be printed at every note instead of + ; remembered for the duration of a measure. + ; accidentals not being remembered, causing accidentals always to be typeset relative to the time signature + ((equal? style 'forget) + (set-accidentals-properties '() + '(Staff (same-octave . -1)) + '() context)) + + ; Do not reset the key at the start of a measure. Accidentals will be + ; printed only once and are in effect until overridden, possibly many + ; measures later. + ((equal? style 'no-reset) + (set-accidentals-properties '() + '(Staff (same-octave . #t)) + '() + context)) + (else + (ly:warn (string-append "Unknown accidental style: " (symbol->string style))) + (make-sequential-music '()) + )) + ))) + diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index db8c3b5ac9..0a173719ef 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -1909,6 +1909,18 @@ def conv (str): if re.search ("ly:get-paper-variable", str): sys.stderr.write ('use (ly:paper-lookup (ly:grob-paper ))') raise FatalConversionError() + + str = re.sub (r'\\defaultAccidentals', "#(set-accidental-style 'default)", str) + str = re.sub (r'\\voiceAccidentals', "#(set-accidental-style 'voice)", str) + str = re.sub (r'\\modernAccidentals', "#(set-accidental-style 'modern)", str) + str = re.sub (r'\\modernCautionaries', "#(set-accidental-style 'modern-cautionary)", str) + str = re.sub (r'\\modernVoiceAccidental', "#(set-accidental-style 'modern-voice)", str) + str = re.sub (r'\\modernVoiceCautionaries', "#(set-accidental-style 'modern-voice-cautionary)", str) + str = re.sub (r'\\pianoAccidentals', "#(set-accidental-style 'piano)' , str)", str) + str = re.sub (r'\\pianoCautionaries', "#(set-accidental-style 'piano-cautionary)", str) + str = re.sub (r'\\forgetAccidentals', "#(set-accidental-style 'forget)", str) + str = re.sub (r'\\noResetKey', "#(set-accidental-style 'no-reset)", str) + return str conversions.append (((2,1,25), conv, """Scheme grob function renaming""")) -- 2.39.5