]> git.donarmstrong.com Git - lilypond.git/commitdiff
autochange wierdness
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 19 May 2002 13:43:09 +0000 (13:43 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 19 May 2002 13:43:09 +0000 (13:43 +0000)
ChangeLog
Documentation/user/refman.itely
Documentation/user/tutorial.itely
input/bugs/bizarre-beam.ly [new file with mode: 0644]
input/regression/collision-heads.ly
input/tutorial/sammartini.ly
lily/relative-octave-music.cc
scm/lily.scm
scm/pdf.scm
scm/pdftex.scm

index 3a2b8f4e3a261b32b45584385c7c0b059e97e1a5..b02422671483112224b3e68d443e91520742ebc0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,12 @@
 
 2002-05-19  Han-Wen  <hanwen@cs.uu.nl>
 
+       * input/tutorial/sammartini.ly: fix and document autochange
+       weirdness.
+
+       * scm/pdftex.scm: resurrect PDFTeX output. Still doesn't work, but
+       does produce .pdftex files.
+
        * lily/note-collision.cc (check_meshing_chords): move file from
        collision.cc, implement merged note heads (there you go, Drarn :-)
 
index b0baf887d70b15a243f94ceb38e73b98378e0f39..cc22005e4b8b15924a1cbca3f37da61e7a5c562d 100644 (file)
@@ -55,30 +55,30 @@ provided in @ref{Tuning output} and @ref{Interpretation context}. The
 syntactical details are described at the end of the manual.
 
 @menu
-* Overview::                    
-* Note entry::                  
-* Staff notation::              
-* Polyphony::                   
-* Beaming::                     
-* Expressive marks::            
-* Ornaments::                   
-* Repeats::                     
-* Rhythmic music::              
-* Piano music::                 
-* Lyrics::                      
-* Chords::                      
-* Writing parts::               
-* Custodes::                    
-* Figured bass::                
-* Tuning output::               
-* Page layout::                 
-* Output formats::              
-* Sound::                       
-* Music entry::                 
-* Skipping corrected music::    
-* Interpretation context::      
-* Syntactic details::           
-* Lexical details::             
+* Overview::                   
+* Note entry::                 
+* Staff notation::             
+* Polyphony::                  
+* Beaming::                    
+* Expressive marks::           
+* Ornaments::                  
+* Repeats::                    
+* Rhythmic music::             
+* Piano music::                        
+* Lyrics::                     
+* Chords::                     
+* Writing parts::              
+* Custodes::                   
+* Figured bass::               
+* Tuning output::              
+* Page layout::                        
+* Output formats::             
+* Sound::                      
+* Music entry::                        
+* Skipping corrected music::   
+* Interpretation context::     
+* Syntactic details::          
+* Lexical details::            
 @end menu
 
 @c . {Overview}
@@ -140,15 +140,15 @@ brevity we omit obligatory lint such as @code{\score} blocks and
 
 
 @menu
-* Notes::                       
-* Pitches::                     
-* Rests::                       
-* Skips::                       
-* Durations::                   
-* Ties::                        
-* Tuplets::                     
-* Defining pitch names::        
-* Easy Notation note heads ::   
+* Notes::                      
+* Pitches::                    
+* Rests::                      
+* Skips::                      
+* Durations::                  
+* Ties::                       
+* Tuplets::                    
+* Defining pitch names::       
+* Easy Notation note heads ::  
 @end menu
 
 @c . {Notes}
@@ -553,11 +553,11 @@ the @code{-f ps} option of lilypond produces the correct result.
 @cindex Staff notation
 
 @menu
-* Key signature::               
-* Clef::                        
-* Time signature::              
-* Unmetered music::             
-* Bar lines::                   
+* Key signature::              
+* Clef::                       
+* Time signature::             
+* Unmetered music::            
+* Bar lines::                  
 @end menu
 
 @c .  {Key}
@@ -1128,11 +1128,11 @@ horizontal, falls two staff spaces:
 
 @c .   {Slurs}
 @menu
-* Slurs ::                      
-* Phrasing slurs::              
-* Breath marks::                
-* Tempo::                       
-* Text spanners::               
+* Slurs ::                     
+* Phrasing slurs::             
+* Breath marks::               
+* Tempo::                      
+* Text spanners::              
 @end menu
 
 @node Slurs 
@@ -1296,11 +1296,11 @@ An application---or rather, a hack---is to fake octavation indications.
 @section Ornaments
 @cindex Ornaments
 @menu
-* Articulations::               
-* Text scripts::                
-* Grace notes::                 
-* Glissando ::                  
-* Dynamics::                    
+* Articulations::              
+* Text scripts::               
+* Grace notes::                        
+* Glissando ::                 
+* Dynamics::                   
 @end menu
 
 @c .   {Articulation}
@@ -1637,11 +1637,11 @@ Make beat or measure repeats. These look like percent signs.
 @end table  
 
 @menu
-* Repeat syntax::               
-* Manual repeat commands::      
-* Tremolo repeats::             
-* Tremolo subdivisions::        
-* Measure repeats::             
+* Repeat syntax::              
+* Manual repeat commands::     
+* Tremolo repeats::            
+* Tremolo subdivisions::       
+* Measure repeats::            
 @end menu
 
 @node Repeat syntax
@@ -1700,11 +1700,13 @@ the specified number of repeats.
 }
 @end lilypond
 
-@subsection Unfolding repeats for MIDI output.
+@subsection Repeats and MIDI
+@subsection Repeats and MIDI
 
 @cindex expanding repeats
 
-See @file{input/test/unfold-all-repeats.ly}. 
+For instructions on how to unfoldi repeats for MIDI output, see
+the example file @file{input/test/unfold-all-repeats.ly}.
 
 
 @refbugs
@@ -1837,7 +1839,7 @@ with slashes, and repeating that measure with percents.
 
 
 @menu
-* Rhythmic staves::             
+* Rhythmic staves::            
 @end menu
 
 @node Rhythmic staves
@@ -1867,11 +1869,11 @@ behavior.  In this section we discuss the @internalsref{PianoStaff} and some
 other pianistic peculiarities.
 
 @menu
-* Automatic staff changes::     
-* Manual staff switches::       
-* Pedals::                      
-* Arpeggio::                    
-* Voice follower lines::        
+* Automatic staff changes::    
+* Manual staff switches::      
+* Pedals::                     
+* Arpeggio::                   
+* Voice follower lines::       
 @end menu 
 
 
@@ -1883,13 +1885,14 @@ other pianistic peculiarities.
 Voices can switch automatically between the top and the bottom
 staff. The syntax for this is
 @example
-        \autochange @var{contexttype} @var{musicexp}
-@end example
-This will switch the interpretation context of @var{musicexp} between a
-@var{contexttype} named @code{up} and @code{down}. Typically, you use
-@internalsref{Staff} for @var{contexttype}.  The autochanger switches on basis
-of pitch (central C is the turning point), and it looks ahead skipping
-over rests to switch rests in advance.
+        \autochange @var{contexttype} \context @var{childcontexttype}
+               @var{musicexp} @end example This will switch the
+interpretation context of @var{musicexp} between a @var{contexttype}
+named @code{up} and @code{down}. Typically, you use
+@internalsref{Staff} for @var{contexttype}, and @internalsref{Voice}
+for @var{childcontexttype}. The autochanger switches on basis of pitch
+(central C is the turning point), and it looks ahead skipping over
+rests to switch rests in advance.
         
 @lilypond[verbatim,singleline]
 \score { \notes \context PianoStaff <
@@ -2092,10 +2095,10 @@ The associated grob is @internalsref{VoiceFollower}.
 
 
 @menu
-* Lyrics mode::                 
-* Printing lyrics::             
+* Lyrics mode::                        
+* Printing lyrics::            
 * Automatic syllable durations::  
-* More stanzas::                
+* More stanzas::               
 @end menu
 
 @c .  {Lyrics mode}
@@ -2320,8 +2323,8 @@ not attempt to be intelligent. If you enter @code{f bes d}, it does not
 interpret this as an inversion.
 
 @menu
-* Chords mode::                 
-* Printing named chords::       
+* Chords mode::                        
+* Printing named chords::      
 @end menu
 
 @c .  {Chords mode}
@@ -2542,14 +2545,14 @@ problems in orchestral music.
 
 @c .  {Transpose}
 @menu
-* Rehearsal marks::             
-* Bar numbers::                 
-* Instrument names::            
-* Transpose::                   
+* Rehearsal marks::            
+* Bar numbers::                        
+* Instrument names::           
+* Transpose::                  
 * Sound output for transposing instruments::  
-* Multi measure rests::         
-* Automatic part combining::    
-* Hara kiri staves::            
+* Multi measure rests::                
+* Automatic part combining::   
+* Hara kiri staves::           
 @end menu
 
 @c .   {Rehearsal marks}
@@ -2935,13 +2938,13 @@ affecting a whole set of objects.  Second, you can select one specific
 object, and set a grob property in that object.
 
 @menu
-* Tuning groups of grobs ::     
-* Tuning per grob ::            
-* What to tune?::               
-* Font selection::              
-* Text markup::                 
-* Invisible grobs::             
-* Dirty tricks::                
+* Tuning groups of grobs ::    
+* Tuning per grob ::           
+* What to tune?::              
+* Font selection::             
+* Text markup::                        
+* Invisible grobs::            
+* Dirty tricks::               
 @end menu
 
 @node Tuning groups of grobs 
@@ -3487,13 +3490,13 @@ and (La)@TeX{} putting the notation on a page, including page breaks.
 The part of LilyPond is documented here.
 
 @menu
-* Paper block::                 
-* Paper variables::             
-* Font Size::                   
-* Paper size::                  
-* Line break::                  
-* Page break::                  
-* Output scaling::              
+* Paper block::                        
+* Paper variables::            
+* Font Size::                  
+* Paper size::                 
+* Line break::                 
+* Page break::                 
+* Output scaling::             
 @end menu
 
 @c .  {Paper block}
@@ -3743,10 +3746,10 @@ meaning that you don't have access to continuously scaled fonts.
 LilyPond can output processed music in different output formats.  
 
 @menu
-* TeX output::                  
-* PostScript output::           
-* Scheme output::               
-* ASCIIScript output::          
+* TeX output::                 
+* PostScript output::          
+* Scheme output::              
+* ASCIIScript output::         
 @end menu
 
 @node TeX output
@@ -3930,8 +3933,8 @@ It is currently not possible to use the percussion channel (generally
 channel 10 of a MIDI file).
 
 @menu
-* MIDI block::                  
-* MIDI instrument names::       
+* MIDI block::                 
+* MIDI instrument names::      
 @end menu
 
 @c .  {MIDI block}
@@ -3991,9 +3994,9 @@ number.
 @section Music entry
 @cindex Music entry
 @menu
-* Relative::                    
-* Bar check::                   
-* Point and click::             
+* Relative::                   
+* Bar check::                  
+* Point and click::            
 @end menu
 
 When entering music with LilyPond, it is easy to introduce errors. This
@@ -4211,12 +4214,12 @@ c d b bes a g c2 }
 @section Interpretation context
 
 @menu
-* Creating contexts::           
-* Default contexts::            
-* Context properties::          
-* Engravers and performers::    
+* Creating contexts::          
+* Default contexts::           
+* Context properties::         
+* Engravers and performers::   
 * Changing context definitions::  
-* Defining new contexts::       
+* Defining new contexts::      
 @end menu
 
 
@@ -4563,13 +4566,13 @@ such an identifier outside of @code{\score}, you must do
 This section describes details that were too boring to be put elsewhere.
 
 @menu
-* Top level::                   
-* Identifiers::                 
-* Music expressions::           
+* Top level::                  
+* Identifiers::                        
+* Music expressions::          
 * Manipulating music expressions::  
-* Assignments::                 
-* Lexical modes::               
-* Ambiguities::                 
+* Assignments::                        
+* Lexical modes::              
+* Ambiguities::                        
 @end menu
 
 @c .  {Top level}
@@ -4808,7 +4811,7 @@ More examples are given in the distributed example files in
 
 @c .   {Span requests}
 @menu
-* Span requests::               
+* Span requests::              
 @end menu
 
 @node Span requests
@@ -4967,15 +4970,15 @@ right time between
 Even more boring details, now on lexical side of the input parser.
 
 @menu
-* Comments::                    
-* Direct Scheme::               
-* Keywords::                    
-* Integers::                    
-* Reals::                       
-* Strings::                     
-* Main input::                  
-* File inclusion::              
-* Version information::         
+* Comments::                   
+* Direct Scheme::              
+* Keywords::                   
+* Integers::                   
+* Reals::                      
+* Strings::                    
+* Main input::                 
+* File inclusion::             
+* Version information::                
 @end menu
 
 
index 62cb86775f3fcb49f01191ad98c06002027f8e2c..8fa404fa62b64bf4ca24f301e388138a048d44a3 100644 (file)
@@ -1019,6 +1019,10 @@ The following piece of music is played twice.  The first argument
 indicates the type of repeat.  In this case, @code{"volta"} means that
 prima volta/secunda volta brackets are used for the alternative
 endings---if there were any.
+
+A special notation for repeats allows you to get correct repeats in
+MIDI output. However, some extra trickery is needed to get this
+working, See @ref{Repeats and MIDI}.  
 @separate
 @example 
 
@@ -1822,10 +1826,10 @@ will be at the left.
 @node A piano excerpt
 @section A piano excerpt
 
-Our fourth subject is a piece of piano music.  The fragment in the input
-file is a piano reduction of the G major Sinfonia by Giovanni Battista
-Sammartini.  It was composed around 1740.  It's in the source package
-under  the name @file{sammartini.ly}.
+Our fourth subject is a piece of piano music.  The fragment in the
+input file is a piano reduction of the G major Sinfonia by Giovanni
+Battista Sammartini.  It was composed around 1740.  It's in the source
+package under the name @file{sammartini.ly}.
 
 @lilypond[verbatim]
 \include "paper16.ly"
@@ -1864,11 +1868,11 @@ oboes = \notes \relative c'' \context Voice = oboe {
 }
 
 hoomPah = \repeat unfold 8 \notes
-    \transpose c' { \stemUp c8 \stemBoth \stemDown c'8 \stemBoth }
+    \transpose c' { \stemUp c8 \stemBoth \stemDown g'8 \stemBoth }
 
 bassvoices = \notes \relative c' {
     c4 g8. b,16
-    \autochange Staff \hoomPah
+    \autochange Staff \context Voice \hoomPah
     \translator Staff = down
     \stemDown [c8 c'8] r4
     <g d'> r4
@@ -2135,7 +2139,7 @@ having to worry about getting the motive in a wrong octave.
 @example 
 bassvoices = \notes \relative c' @{
 c4 g8. b,16
-\autochange Staff \hoomPah 
+\autochange Staff \hoomPah \context Voice
 @end example
 @cindex staff switch, automatic
 @cindex cross staff voice, automatic
diff --git a/input/bugs/bizarre-beam.ly b/input/bugs/bizarre-beam.ly
new file mode 100644 (file)
index 0000000..2a8ecf7
--- /dev/null
@@ -0,0 +1,3 @@
+
+
+\score{ \notes {[g'' <e'''8 g> g''] }}
index 04ef2f7326b83e61f51aba2b113094115d23a1fe..7726cac13109ca99609a81c9d1ef3de95b3e0341 100644 (file)
@@ -14,7 +14,7 @@ if the black note heads are from 8th or shorter notes.
     
     \property Staff.NoteCollision \override #'merge-differently-headed = ##t
     c2
-    c4. c8
+    c8 c4.
     c2
 }
 \context Voice = VB {
index c8ff8a10f070a7fcea71753b3b471dcccd9cefca..d9f648fa17e6adb1d633228e141053eca8b953fe 100644 (file)
@@ -33,11 +33,11 @@ oboes = \notes \relative c'' \context Voice = oboe {
 }
 
 hoomPah = \repeat unfold 8 \notes
-    \transpose c' { c8 \stemDown c'8 \stemUp }
+    \transpose c' { c8 \stemDown g'8 \stemUp }
 
 bassvoices = \notes \relative c' {
     c4 g8. b,16
-    \autochange Staff \hoomPah
+    \autochange Staff \context Voice \hoomPah
     \translator Staff = down
     \stemDown [c8 c'8] r4
     <g d'> r4
index 4d7251166d9c5fcdeb66660a9806da1857ef54c0..b9aeb445a33a9ba388a52c831812a94d40834865 100644 (file)
@@ -25,7 +25,7 @@ Relative_octave_music::Relative_octave_music (SCM l)
 
 Relative_octave_music::Relative_octave_music ()
 {
-    set_mus_property ("type", ly_symbol2scm ("relative-octave-music"));
+  set_mus_property ("type", ly_symbol2scm ("relative-octave-music"));
 }
 
 ADD_MUSIC (Relative_octave_music);
index 656c8a7bd6746c871f6678ad79628b68fe80db2e..7506323a653a25b222a997e058da32f777062f7e 100644 (file)
             (scm pysk)
             (scm ascii-script)
             (scm sketch)
+            (scm pdftex)
             )
 
 (define output-alist
     ("as" . ,as-output-expression)
     ("pysk" . ,pysk-output-expression)
     ("sketch" . ,sketch-output-expression)
+    ("pdftex" . ,pdftex-output-expression)
 ))
 
 
index 044fd5b097c498628e3e98ecce4baca68b27cac5..15b37c91b89f87f06a610e3605fe2cf4f2039a39 100644 (file)
 (define (define-origin a b c ) "")
 (define (no-origin) "")
 
+(define my-eval-in-module eval)
+
+(if (or (equal? (minor-version) "4")
+       (equal? (minor-version) "3.4"))
+    (begin
+      (set! my-eval-in-module eval-in-module)
+
+    ))
+
+(define-public (pdf-output-expression expr port)
+  (display (my-eval-in-module expr this-module) port) )
 
-(define (scm-pdf-output)
-  (primitive-eval (pdf-scm 'all-definitions)))
 
 ; Local Variables:
 ; scheme-program-name: "guile"
index b2c22ba52d9bf00cead8b34bcc6936cdd4c58fb3..04d15ba650f73bae430bfe24272b1d820f50c918 100644 (file)
 
 (define-module (scm pdftex))
 
+(use-modules (scm pdf)
+            (guile)
+            (ice-9 regex)
+            (ice-9 string-fun)   
+            )
+
+(define this-module (current-module))
 (define (unknown) 
   "%\n\\unknown%\n")
 
     ))
 
 (define (beam width slope thick)
-  (embedded-pdf ((pdf-scm 'beam) width slope thick)))
+  (embedded-pdf (list 'beam  width slope thick)))
 
 (define (bracket arch_angle arch_width arch_height height arch_thick thick)
-  (embedded-pdf ((pdf-scm 'bracket) arch_angle arch_width arch_height height arch_thick thick)))
+  (embedded-pdf (list 'bracket  arch_angle arch_width arch_height height arch_thick thick)))
 
 (define (dashed-slur thick dash l)
-  (embedded-pdf ((pdf-scm 'dashed-slur)  thick dash l)))
+  (embedded-pdf (list 'dashed-slur   thick dash l)))
 
 (define (char i)
   (string-append "\\char" (inexact->string i 10) " "))
 
 (define (dashed-line thick on off dx dy)
-  (embedded-pdf ((pdf-scm 'dashed-line) thick on off dx dy)))
+  (embedded-pdf (list 'dashed-line  thick on off dx dy)))
 
 (define (font-load-command name-mag command)
   (string-append
    "\n"))
 
 (define (ez-ball c l b)
-  (embedded-pdf ((pdf-scm 'ez-ball) c  l b)))
+  (embedded-pdf (list 'ez-ball  c  l b)))
+
+
+
+(if (or (equal? (minor-version) "4")
+       (equal? (minor-version) "3.4"))
+    (define (embedded-pdf expr)
+      (let ((ps-string
+            (with-output-to-string
+              (lambda () (pdf-output-expression expr (current-output-port))))))
+       (string-append "\\embeddedpdf{" ps-string "}")))
+    (define (embedded-pdf expr)
+      (let
+         ((os (open-output-string)))
+       (pdf-output-expression expr os)
+       (string-append "\\embeddedpdf{" (get-output-string os) "}"))))
 
-(define (embedded-pdf s)
-  (string-append "\\embeddedpdf{ " s "}"))
 
 (define (comment s)
-  (string-append "% " s))
+  (simple-format #f "% ~a\n" s))
 
 (define (end-output) 
   (begin
   "")
 
 (define (repeat-slash w a t)
-  (embedded-pdf ((pdf-scm 'repeat-slash) w a t)))
+  (embedded-pdf (list 'repeat-slash w a t)))
+(define (fontify name-mag-pair exp)
+  (string-append (select-font name-mag-pair)
+                exp))
+
+
+(define (tex-encoded-fontswitch name-mag)
+  (let* ((iname-mag (car name-mag))
+        (ename-mag (cdr name-mag)))
+    (cons iname-mag
+         (cons ename-mag
+               (string-append  "magfont"
+                         (string-encode-integer
+                          (hashq (car ename-mag) 1000000))
+                         "m"
+                         (string-encode-integer
+                          (inexact->exact (* 1000 (cdr ename-mag)))))))))
+(define (define-fonts internal-external-name-mag-pairs)
+  (set! font-name-alist (map tex-encoded-fontswitch
+                            internal-external-name-mag-pairs))
+  (apply string-append
+        (map (lambda (x)
+               (font-load-command (car x) (cdr x)))
+             (map cdr font-name-alist))))
+
 
 (define (font-switch i)
   (string-append
    (number->dim y) "}{" (number->dim x) "}{" s "}\n"))
 
 (define (bezier-sandwich l thick)
-  (embedded-pdf ((pdf-scm 'bezier-sandwich) l thick)))
+  (embedded-pdf (list 'bezier-sandwich  `(quote ,l) thick)))
 
 (define (start-system ht)
   (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
    "height " (number->dim height) " "))
 
 (define (roundfilledbox x width y height blotdiam)
-  (embedded-pdf ((pdf-scm 'roundfilledbox) x width y height blotdiam)))
+  (embedded-pdf (list 'roundfilledbox  x width y height blotdiam)))
 
 (define (text s)
   (string-append "\\hbox{" (output-tex-string s) "}"))
 (define (no-origin) "")
 
 
-(define (scm-pdftex-output)
-  (primitive-eval (pdftex-scm 'all-definitions)))
+
+(define my-eval-in-module eval)
+
+(if (or (equal? (minor-version) "4")
+       (equal? (minor-version) "3.4"))
+    (begin
+      (set! my-eval-in-module eval-in-module)
+
+    ))
+
+(define-public (pdftex-output-expression expr port)
+  (display (my-eval-in-module expr this-module) port) )