From eb8a73fbe69f2a5b9abdf963537f280adacce78c Mon Sep 17 00:00:00 2001 From: hanwen Date: Thu, 5 Feb 2004 11:11:51 +0000 Subject: [PATCH] * input/test/improv.ly: update: do not use Thread switching. * lily/pitch-squash-engraver.cc (acknowledge_grob): only squash if squashedPosition is a number * Documentation/user/refman.itely (Automatic note splitting): remove Thread references. * Documentation/user/refman.itely (Percussion staves): update doco. --- ChangeLog | 5 ++ Documentation/user/introduction.itely | 2 +- Documentation/user/lilypond.tely | 2 +- Documentation/user/music-glossary.tely | 51 +++++++++--------- Documentation/user/refman.itely | 22 ++++---- input/test/improv.ly | 73 ++++++++++++-------------- lily/change-iterator.cc | 4 +- lily/include/my-lily-lexer.hh | 2 +- lily/lexer.ll | 9 ++-- lily/parser.yy | 10 ++-- lily/pitch-squash-engraver.cc | 3 +- 11 files changed, 93 insertions(+), 90 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e9478e5cc..40547e3a51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2004-02-05 Han-Wen Nienhuys + * input/test/improv.ly: update: do not use Thread switching. + + * lily/pitch-squash-engraver.cc (acknowledge_grob): only squash if + squashedPosition is a number + * Documentation/user/refman.itely (Automatic note splitting): remove Thread references. diff --git a/Documentation/user/introduction.itely b/Documentation/user/introduction.itely index 22ff44c216..5e9af3ffb0 100644 --- a/Documentation/user/introduction.itely +++ b/Documentation/user/introduction.itely @@ -543,7 +543,7 @@ By adding chord names and lyrics we obtain a lead sheet: \score { << \context ChordNames \chords { c2 c f2 c } \notes \relative c' { \time 2/4 c4 c g'4 g a4 a g2 } - \context Lyrics \lyrics { twin4 kle twin kle lit tle star2 } >> } + \context LyricsVoice \lyrics { twin4 kle twin kle lit tle star2 } >> } @end lilypond Polyphonic notation and piano music can also be printed. The following diff --git a/Documentation/user/lilypond.tely b/Documentation/user/lilypond.tely index 1e3964cef8..c891847585 100644 --- a/Documentation/user/lilypond.tely +++ b/Documentation/user/lilypond.tely @@ -94,7 +94,7 @@ Copyright @copyright{} 1999--2003 by the authors @lilypond[singleline] -\score { \context Lyrics \notes { +\score { \context LyricsVoice \notes { \property Score.RehearsalMark \set #'self-alignment-X = #LEFT \mark #(ly:export (string-append "(For LilyPond version " diff --git a/Documentation/user/music-glossary.tely b/Documentation/user/music-glossary.tely index 4b2f2b0d1e..453e6895f9 100644 --- a/Documentation/user/music-glossary.tely +++ b/Documentation/user/music-glossary.tely @@ -186,7 +186,7 @@ accidental. \context Staff \notes\relative c'' { gis1 s s gisis s s ges s s geses s s g! } -\context Lyrics \lyrics { +\context LyricsVoice \lyrics { \property Lyrics . LyricText \set #'self-alignment-X = #-1 "sharp " "db. sharp " "flat " "db. flat " natural } @@ -685,7 +685,7 @@ lines. \clef tenor c s s \clef baritone c s s } -\context Lyrics \lyrics { +\context LyricsVoice \lyrics { \property Lyrics . LyricText \override #'self-alignment-X = #-1 "Soprano " "Mezzosoprano " "Alto " "Tenor " Baritone } @@ -784,7 +784,7 @@ chords are denoted open chords s s s s } -\context Lyrics \lyrics{ +\context LyricsVoice \lyrics{ \property Lyrics . LyricText \set #'self-alignment-X = #-1 "major " "minor " "diminished " "augmented " "seventh-chord " "ninth-chord " @@ -1186,7 +1186,7 @@ also to some extent in newer jazz music. \property Voice.TextScript \set #'padding = #-4 e^"~~ S" f g a b^"~~ S" c } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { Ionian } @end lilypond @@ -1201,7 +1201,7 @@ also to some extent in newer jazz music. \property Voice.TextScript \set #'padding = #-4 e^"~~ S" f g a b^"~~ S" c d } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { Dorian } @end lilypond @@ -1215,7 +1215,7 @@ also to some extent in newer jazz music. \property Voice.TextScript \set #'padding = #-4 e1^"~~ S" f g a b^"~~ S" c d e } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { Phrygian } @end lilypond @@ -1230,7 +1230,7 @@ also to some extent in newer jazz music. \property Voice.TextScript \set #'padding = #-4 b^"~~ S" c d e^"~~ S" f } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { Lydian } @end lilypond @@ -1244,7 +1244,7 @@ also to some extent in newer jazz music. g1 a \property Voice.TextScript \set #'padding = #-4 b^"~~ S" c d e^"~~ S" f g } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { Mixolydian } @end lilypond @@ -1259,7 +1259,7 @@ also to some extent in newer jazz music. \property Voice.TextScript \set #'padding = #-4 b^"~~ S" c d e^"~~ S" f g a } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { Aeolian } @end lilypond @@ -1279,7 +1279,7 @@ harmonic minor scale type an augmented second (A) occurs between the 6th and \property Voice.TextScript \set #'padding = #-4 e^"~~ S" f g a b^"~~ S" c } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { Major } @end lilypond @@ -1294,7 +1294,7 @@ harmonic minor scale type an augmented second (A) occurs between the 6th and \property Voice.TextScript \set #'padding = #-4 b^"~~ S" c d e^"~~ S" f g a } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { "ancient minor" } @end lilypond @@ -1309,7 +1309,7 @@ harmonic minor scale type an augmented second (A) occurs between the 6th and \property Voice.TextScript \set #'padding = #-4 b^"~~ S" c d e^"~~ S" f!^"~~ A" gis^"~~ S" a } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { "Harmonic minor" } @end lilypond @@ -1325,7 +1325,7 @@ harmonic minor scale type an augmented second (A) occurs between the 6th and b^"~~ S" c d e fis gis^"~~ S" a g! f!^"~~ S" e d c^"~~ S" b a } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { "Melodic minor" } @end lilypond @@ -1667,7 +1667,7 @@ but equal pitch. \context Staff \notes\relative c'' { gis1 s s as s s s s s s } -\context Lyrics \lyrics { +\context LyricsVoice \lyrics { \property Lyrics . LyricText \set #'self-alignment-X = #-1 "g sharp " "a flat " "dim fifth " "augm fourth" } @@ -1748,7 +1748,7 @@ symbol indicates playing an octave lower (for example on double bass \clef "F_8" f1 } -\context Lyrics \lyrics { +\context LyricsVoice \lyrics { \property Lyrics . LyricText \set #'self-alignment-X = #-1 "baritone " "bass " @@ -1916,7 +1916,7 @@ variants of the base chords. \context Voice \notes\relative c'' { 1 < a f d > < b g e > < d b g > < e c a > < f d b > } -\context Lyrics \lyrics { T Sp Dp S D Tp "D{\\kern-5pt}$\\mid$" } +\context LyricsVoice \lyrics { T Sp Dp S D Tp "D{\\kern-5pt}$\\mid$" } @end lilypond @aitem{G} @@ -1962,7 +1962,7 @@ scores are notated like that). \clef "G_8" g s s } -\context Lyrics \lyrics { +\context LyricsVoice \lyrics { \property Lyrics . LyricText \set #'self-alignment-X = #-1 "french violin clef " "violin clef " @@ -2083,7 +2083,7 @@ section. @aref{functional harmony}. \partial 4 c4 | f, g c2 \bar "|." } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { T S D T } >> @@ -2179,7 +2179,7 @@ of such two forms an octave. < g b! >^"major" s < g bis >^"augm" s } -\context Lyrics \lyrics { +\context LyricsVoice \lyrics { "unisone " "second " "second " "second " "third " "third " "third " "third " } @@ -2200,7 +2200,7 @@ of such two forms an octave. < g e'! >^"major" s < g eis' >^"augm" s } -\context Lyrics \lyrics { +\context LyricsVoice \lyrics { "fourth " "fourth " "fifth " "fifth " "sixth " "sixth " "sixth " "sixth " } @@ -2221,7 +2221,7 @@ of such two forms an octave. < g bes' >^"minor" s < g b'! >^"major" s } -\context Lyrics \lyrics { +\context LyricsVoice \lyrics { "seventh " "seventh " "seventh " "octave " "none " "none " "decime " "decime " } @@ -2363,7 +2363,7 @@ unlike (b) @emph{leggiero} or @emph{non-legato}, (c) @emph{portato} and c4-.-( d-. e-.-) \bar "||" c4-. d-. e-. \bar "||" } -\context Lyrics \lyrics { +\context LyricsVoice \lyrics { % \property Lyrics . LyricText \set #'font-style = #'large a b "" "" @@ -3371,7 +3371,7 @@ sub@-do@-mi@-nant (S) and V = dominant (D). \context Staff \notes\relative c' { c1 d e f g a b c } -\context Lyrics \lyrics { +\context LyricsVoice \lyrics { << { I II III IV V VI VII I } { T "" "" S D } >> } @@ -3984,9 +3984,8 @@ with figures designating the chief @aref{interval}s and \key es \major es8 c d bes c as bes16 as g f | es4 } - \context Lyrics \lyrics { -% \property Lyrics . LyricText \set #'font-style = #'Large - \property Lyrics . VerticalAlign \override #'threshold = #'(6 . 12) + \context LyricsVoiceVoice \lyrics { + \property LyricsVoiceVoice . VerticalAlign \override #'threshold = #'(6 . 12) << { "" "6" "" "4" "" "6" "" "" "6" "4" } { "" "" "" "2" "" "" "" "" "" "2" } >> } diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index a9094bb1d5..ff27436276 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -2810,7 +2810,7 @@ mus = \drums { cymc cyms cymr hh | hhc hho hhho hhp | \break cb hc Stem \set #'Y-extent-callback = ##f minimumVerticalExtent = #'(-4.0 . 5.0) } \mus - \context Lyrics \nam + \context LyricsVoice \nam >> \paper { %% need to do this, because of indented @itemize @@ -2843,7 +2843,7 @@ mus = \drums { timh ssh timl ssl cb s16 } minimumVerticalExtent = #'(-3.0 . 4.0) drumStyleTable = #timbales-style } \mus - \context Lyrics \nam + \context LyricsVoice \nam >> } @end lilypond @@ -2866,7 +2866,7 @@ mus = \drums { cgh cgho cghm ssh cgl cglo cglm ssl s16 } Stem \set #'transparent = ##t Stem \set #'Y-extent-callback = ##f } \mus - \context Lyrics \nam + \context LyricsVoice \nam >> } @end lilypond @@ -2889,7 +2889,7 @@ mus = \drums { boh boho bohm ssh bol bolo bolm ssl s16 } Stem \set #'transparent = ##t Stem \set #'Y-extent-callback = ##f } \mus - \context Lyrics \nam + \context LyricsVoice \nam >> } @end lilypond @@ -2909,7 +2909,7 @@ mus = \drums { tri trio trim gui guis guil cb cl tamb cab mar hc s16 } Stem \set #'transparent = ##t Stem \set #'Y-extent-callback = ##f } \mus - \context LyricsVoice \nam + \context LyricsVoiceVoice \nam >> } @end lilypond @@ -3368,7 +3368,7 @@ The definition of lyrics mode is too complex. Lyrics are printed by interpreting them in a @internalsref{LyricsVoice} context: @example - \context LyricsVoice \lyrics @dots{} + \context LyricsVoiceVoice \lyrics @dots{} @end example @cindex automatic syllable durations @@ -3394,9 +3394,9 @@ For different or more complex orderings, the best way is to setup the hierarchy of staves and lyrics first, e.g. @example \context ChoirStaff \notes << - \context LyricsVoice = sopranoLyrics @{ s1 @} + \context LyricsVoiceVoice = sopranoLyrics @{ s1 @} \context Voice = soprano @{ @emph{music} @} - \context LyricsVoice = tenor @{ s1 @} + \context LyricsVoiceVoice = tenor @{ s1 @} \context Voice = tenorLyrics @{ @emph{music} @} >> @end example @@ -3503,9 +3503,9 @@ that identity followed by a dash. In the preceding example, the @internalsref{Voice} identity is @code{duet}, so the identities of the @internalsref{LyricsVoice}s are marked @code{duet-1} and @code{duet-2}: @example - \context LyricsVoice = "duet-1" @{ + \context LyricsVoiceVoice = "duet-1" @{ Hi, my name is bert. @} - \context LyricsVoice = "duet-2" @{ + \context LyricsVoiceVoice = "duet-2" @{ Ooooo, ch\'e -- ri, je t'aime. @} @end example @@ -7431,7 +7431,7 @@ The following are supported _\verylongfermata r } - \context Lyrics \lyrics { + \context LyricsVoice \lyrics { "shortfermata" "fermata" "longfermata" "verylongfermata" } >> } diff --git a/input/test/improv.ly b/input/test/improv.ly index 4304dbabeb..6420562d94 100644 --- a/input/test/improv.ly +++ b/input/test/improv.ly @@ -1,56 +1,51 @@ \version "2.1.7" \header { -texidoc = + texidoc = +" +In improvisation, noteheads do not have a pitch, and have different +shapes. In this example, this is achieved by adding +@code{Pitch_squash_engraver} and setting @code{squashedPosition} when the +improvisation is active. -"@cindex improvisation - - -Noteheads for improvisation have a different shape. +" +} -" } +improOn = \notes { + \property Voice.squashedPosition = #0 + \property Voice.NoteHead \override #'style = #'slash +} -improOn = \notes {\change Voice = impro } -improOff = \notes {\change SquashVoice = melo } +improOff = \notes { + \property Voice.squashedPosition \unset + \property Voice.NoteHead \revert #'style +} global = \notes { s1*3 \bar "|." } \score { - << - \context ChordNames \chords {e8*7:m7 a2.:m7 bes4:m7 b1:m7 e8:m } - \context Staff \notes << - \context SquashVoice = impro { \global } - \context Voice = melo \transpose c c' { - e8 e g a a16(bes)(a8) g \improOn e8 - ~e2~e8 f4 fis8 - ~fis2 \improOff a16(bes) a8 g e - } + << + \context ChordNames \chords { + e8*7:m7 a2.:m7 bes4:m7 b1:m7 e8:m + } + \notes << + \context Voice = melo \transpose c c' { + e8 e g a a16(bes)(a8) g \improOn + e8 + ~e2~e8 f4 fis8 + ~fis2 \improOff a16(bes) a8 g e + } + >> >> - >> - \paper { - \translator { - \VoiceContext - \name SquashVoice - \alias Voice - \consists Pitch_squash_engraver - squashedPosition = #0 - NoteHead \override #'style = #'slash - } - - \translator { - \VoiceContext - \alias SquashVoice - } - - \translator { - \StaffContext - \remove "Accidental_engraver" - \accepts SquashVoice + \paper { + \translator { + \VoiceContext + \consists Pitch_squash_engraver + } + raggedright = ##t } - raggedright = ##t - } } diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc index 7d594273fd..1c2431b1b7 100644 --- a/lily/change-iterator.cc +++ b/lily/change-iterator.cc @@ -16,8 +16,8 @@ void Change_iterator::error (String reason) { - String to_type = ly_scm2string (get_music ()->get_mus_property ("change-to-type")); - String to_id = ly_scm2string (get_music ()->get_mus_property ("change-to-id")); + String to_type = ly_symbol2string (get_music ()->get_mus_property ("change-to-type")); + String to_id = ly_scm2string (get_music ()->get_mus_property ("change-to-id")); String warn1 = _f ("can't change `%s' to `%s'", to_type, to_id) + ": " + reason; diff --git a/lily/include/my-lily-lexer.hh b/lily/include/my-lily-lexer.hh index 68c50f332c..80c706d1eb 100644 --- a/lily/include/my-lily-lexer.hh +++ b/lily/include/my-lily-lexer.hh @@ -57,9 +57,9 @@ public: SCM lookup_identifier (String s); void push_note_state (SCM tab); + void push_chord_state (SCM tab); void push_markup_state (); void push_figuredbass_state (); - void push_chord_state (); void push_lyric_state (); void pop_state (); void LexerError (char const *); diff --git a/lily/lexer.ll b/lily/lexer.ll index bf829eab80..5aff58c66f 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -618,8 +618,9 @@ My_lily_lexer::push_figuredbass_state() yy_push_state (figures); } void -My_lily_lexer::push_chord_state () +My_lily_lexer::push_chord_state (SCM tab) { + pitchname_tab_stack_ = gh_cons (tab, pitchname_tab_stack_); yy_push_state (chords); } @@ -638,7 +639,7 @@ My_lily_lexer::push_markup_state () void My_lily_lexer::pop_state () { - if (YYSTATE == notes) + if (YYSTATE == notes || YYSTATE == chords) pitchname_tab_stack_ = gh_cdr (pitchname_tab_stack_); yy_pop_state (); } @@ -682,7 +683,9 @@ My_lily_lexer::scan_bare_word (String str) { SCM sym = ly_symbol2scm (str.to_str0 ()); if ((YYSTATE == notes) || (YYSTATE == chords)) { - SCM handle = scm_hashq_get_handle (gh_car (pitchname_tab_stack_), sym); + SCM handle = SCM_BOOL_F; + if (gh_pair_p (pitchname_tab_stack_)) + handle = scm_hashq_get_handle (gh_car (pitchname_tab_stack_), sym); if (gh_pair_p (handle)) { yylval.scm = ly_cdr (handle); diff --git a/lily/parser.yy b/lily/parser.yy index de1b8e81c1..de733ff58c 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1050,13 +1050,13 @@ basic music objects too, since the meaning is different. THIS->lexer_->pop_state (); } - | CHORDS - { + | CHORDS { SCM nn = THIS->lexer_->lookup_identifier ("chordmodifiers"); THIS->lexer_->chordmodifier_tab_ = alist_to_hashq (nn); - THIS->lexer_->push_chord_state (); } - Music - { + nn = THIS->lexer_->lookup_identifier ("pitchnames"); + THIS->lexer_->push_chord_state (alist_to_hashq (nn)); + + } Music { Music * chm = MY_MAKE_MUSIC("UnrelativableMusic"); chm->set_mus_property ("element", $3->self_scm ()); scm_gc_unprotect_object ($3->self_scm()); diff --git a/lily/pitch-squash-engraver.cc b/lily/pitch-squash-engraver.cc index 98607e15bb..b974bb8942 100644 --- a/lily/pitch-squash-engraver.cc +++ b/lily/pitch-squash-engraver.cc @@ -22,7 +22,8 @@ void Pitch_squash_engraver::acknowledge_grob (Grob_info i) { SCM newpos = get_property ("squashedPosition"); - if (Note_head::has_interface (i.grob_)) + if (gh_number_p (newpos) + && Note_head::has_interface (i.grob_)) { i.grob_->set_grob_property ("staff-position", newpos); } -- 2.39.5