]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 24 Dec 2006 15:23:17 +0000 (16:23 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 24 Dec 2006 15:23:17 +0000 (16:23 +0100)
51 files changed:
flower/include/rational.hh
flower/rational.cc
input/GNUmakefile
input/midi/GNUmakefile [new file with mode: 0644]
input/midi/midi-drums.ly [new file with mode: 0644]
input/midi/midi-grace.ly [new file with mode: 0644]
input/midi/midi-lyric-barcheck.ly [new file with mode: 0644]
input/midi/midi-scales.ly [new file with mode: 0644]
input/midi/midi-transposing.ly [new file with mode: 0644]
input/midi/midi-tuplets.ly [new file with mode: 0644]
input/midi/midi-volume-equaliser.ly [new file with mode: 0644]
input/no-notation/midi-drums.ly [deleted file]
input/no-notation/midi-grace.ly [deleted file]
input/no-notation/midi-lyric-barcheck.ly [deleted file]
input/no-notation/midi-scales.ly [deleted file]
input/no-notation/midi-transposing.ly [deleted file]
input/no-notation/midi-tuplets.ly [deleted file]
input/no-notation/midi-volume-equaliser.ly [deleted file]
lily/accidental-engraver.cc
lily/audio-item.cc
lily/beaming-pattern.cc
lily/dispatcher-scheme.cc
lily/drum-note-performer.cc
lily/duration-scheme.cc
lily/general-scheme.cc
lily/include/audio-item.hh
lily/include/pitch.hh
lily/include/score.hh
lily/include/stream-event.hh
lily/key-engraver.cc
lily/key-performer.cc
lily/midi-item.cc
lily/music.cc
lily/note-performer.cc
lily/output-def-scheme.cc
lily/paper-book.cc
lily/pitch-scheme.cc
lily/pitch.cc
lily/quote-iterator.cc
lily/scheme-listener-scheme.cc
lily/score-scheme.cc
lily/score.cc
lily/stream-event-scheme.cc
lily/stream-event.cc
lily/tie.cc
ly/music-functions-init.ly
scm/define-context-properties.scm
scm/define-grob-interfaces.scm
scm/lily-library.scm
scm/midi.scm
scm/safe-lily.scm

index bc64465cfe5db4c5758a4aa6c4bcc3de6609b449..ac1a6d12fc1e0ae01eccc2bb3d9d6ed65cfd83b1 100644 (file)
@@ -54,8 +54,9 @@ public:
      Initialize to 0.
   */
   Rational ();
-  Rational (int, int);
-  Rational (double);
+  Rational (int);
+  explicit Rational (int, int);
+  explicit Rational (double);
   Rational (Rational const &r) { copy (r);}
   Rational &operator = (Rational const &r)
   {
@@ -98,6 +99,6 @@ ostream &
 operator << (ostream &, Rational);
 #endif
 
-const Rational infinity_rat = INT_MAX;
+const Rational infinity_rat (INT_MAX);
 
 #endif // RATIONAL_HH
index 150ace0359b6eedc234a9e41c8af7f6bed71a03b..748a8698413e2b86a3569a0a25731e2bf70c7067 100644 (file)
@@ -66,6 +66,17 @@ Rational::Rational (int n, int d)
   normalize ();
 }
 
+Rational::Rational (int n)
+{
+  sign_ = ::sign (n);
+  num_ = ::abs (n);
+  den_ = 1;
+}
+
+
+/*
+  We can actually do a little better. See Knuth 4.5.2
+ */
 static inline
 int gcd (int a, int b)
 {
index e096a73471567c633caddeb03229b0acda688e60..4a45b45f4ac4c10897c93720fe8a9cf4ceb131a5 100644 (file)
@@ -1,6 +1,6 @@
 depth = ..
 
-SUBDIRS = test regression tutorial no-notation mutopia manual
+SUBDIRS = test regression tutorial midi no-notation mutopia manual
 
 examples = typography-demo les-nereides wilhelmus proportional bach-schenker cary
 
diff --git a/input/midi/GNUmakefile b/input/midi/GNUmakefile
new file mode 100644 (file)
index 0000000..37d97aa
--- /dev/null
@@ -0,0 +1,8 @@
+depth = ../..
+
+STEPMAKE_TEMPLATES=documentation texinfo tex
+LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc
+
+include $(depth)/make/stepmake.make
+TITLE=LilyPond MIDI Tests
+
diff --git a/input/midi/midi-drums.ly b/input/midi/midi-drums.ly
new file mode 100644 (file)
index 0000000..2b799be
--- /dev/null
@@ -0,0 +1,18 @@
+
+\version "2.10.0"
+
+\version "2.10.1" 
+
+\score {
+  \new DrumStaff <<
+    \drummode {
+      bd4 sn4 bd4 sn4
+      <<
+       {\voiceOne \repeat unfold 16 hh16 }
+       \new DrumVoice { \voiceTwo bd4 sn4 bd4 sn4 }
+      >> \oneVoice
+    }
+  >>
+  \layout {}
+  \midi {}
+}
diff --git a/input/midi/midi-grace.ly b/input/midi/midi-grace.ly
new file mode 100644 (file)
index 0000000..213de79
--- /dev/null
@@ -0,0 +1,22 @@
+\version "2.10.0"
+\header{ texidoc = "Tests MIDI output with grace notes. " }
+
+\score { 
+  \context Voice \relative c {
+    \new Voice = VoiceOne
+       \grace {
+  \override Stem  #'stroke-style = #"grace"
+   c8 
+  \revert Stem #'stroke-style }
+ d4 d d d d
+       \grace {
+  \override Stem  #'stroke-style = #"grace"
+   e16 f e f 
+  \revert Stem #'stroke-style }
+ d4 d d d d 
+       
+  }
+  \layout { }  
+  \midi { }
+}
+
diff --git a/input/midi/midi-lyric-barcheck.ly b/input/midi/midi-lyric-barcheck.ly
new file mode 100644 (file)
index 0000000..5c06916
--- /dev/null
@@ -0,0 +1,24 @@
+\version "2.10.0"
+\header {
+
+    texidoc = "Lyrics in MIDI are aligned to ties and beams:
+this examples causes no bar checks in MIDI.
+"
+
+
+    }
+\score {
+
+    <<\relative c'' \new Voice =  A {
+       \autoBeamOff
+       c8[ c] c2.
+       c1~c4 c2.
+       c4 ( d e) d
+       c1
+
+    }
+    \lyricsto "A" \lyrics { bla bla | bla bla | bla bla | bla }
+    >>
+    \layout {}
+      \midi {}
+    }
diff --git a/input/midi/midi-scales.ly b/input/midi/midi-scales.ly
new file mode 100644 (file)
index 0000000..d6e8ed9
--- /dev/null
@@ -0,0 +1,159 @@
+
+\version "2.10.0"
+% candidate for regression.  -gp
+\header {
+  texidoc="Converting LilyPond input to MIDI and then again back with
+  @code{midi2ly.py} is a reversible procedure in some simple cases,
+  which mean that the original @code{.ly} -file and the one converted 
+  back from the generated @code{.midi} -file do not differ.
+  Here are produced some scales.
+  
+  "
+}
+
+%{
+  This means, doing:
+
+    lilypond input/test/midi-scales.ly
+    midi2ly midi-scales.midi
+    diff -u input/test/midi-scales.ly midi-scales-midi.ly
+
+  should show no differences at all in \key commands or notes.
+
+  Therefore, do not reformat this file unless midi2ly changes.
+
+  1.7.30 reformatted, because
+  midi2ly now outpts 1 bar per line and adds bar checks and numbers.
+
+%}
+
+scales =  \relative c {
+
+  % [INSTRUMENT_NAME] bright acoustic
+  \key c \major  % sharp-major
+  c'4 d e f |
+  g a b c |
+
+  \key g \major
+  g a b c |
+  d e fis g |
+
+  \key d \major
+  d, e fis g |
+  a b cis d |
+
+  \key a \major
+  a b cis d |
+  e fis gis a |
+
+  \key e \major
+  e, fis gis a |
+  b cis dis e |
+
+  \key b \major
+  b cis dis e |
+  fis gis ais b |
+
+  \key fis \major
+  fis, gis ais b |
+  cis dis eis fis |
+
+  \key cis \major
+  cis, dis eis fis |
+  gis ais bis cis |
+
+  \key a \minor  % sharp-minor
+  a b c d |
+  e f gis a |
+
+  \key e \minor
+  e, fis g a |
+  b c dis e |
+
+  \key b \minor
+  b cis d e |
+  fis g ais b |
+
+  \key fis \minor
+  fis, gis a b |
+  cis d eis fis |
+
+  \key cis \minor
+  cis, dis e fis |
+  gis a bis cis |
+
+  \key gis \minor
+  gis ais b cis |
+  dis e fisis gis |
+
+  \key dis \minor
+  dis, eis fis gis |
+  ais b cisis dis |
+
+  \key ais \minor
+  ais bis cis dis |
+  eis fis gisis ais |
+
+  \key f \major  % flat-major
+  f, g a bes |
+  c d e f |
+
+  \key bes \major
+  bes c d ees |
+  f g a bes |
+
+  \key ees \major
+  ees,, f g aes |
+  bes c d ees |
+
+  \key aes \major
+  aes, bes c des |
+  ees f g aes |
+
+  \key des \major
+  des,, ees f ges |
+  aes bes c des |
+
+  \key ges \major
+  ges, aes bes ces |
+  des ees f ges |
+
+  \key ces \major
+  ces,, des ees fes |
+  ges aes bes ces |
+
+  \key d \minor  % flat-minor
+  d, e f g |
+  a bes cis d |
+
+  \key g \minor
+  g, a bes c |
+  d ees fis g |
+
+  \key c \minor
+  c,, d ees f |
+  g aes b c |
+
+  \key f \minor
+  f, g aes bes |
+  c des e f |
+
+  \key bes \minor
+  bes,, c des ees |
+  f ges a bes |
+
+  \key ees \minor
+  ees, f ges aes |
+  bes ces d ees |
+
+  \key aes \minor
+  aes, bes ces des |
+  ees fes g aes |
+}
+
+\score {
+  \context Voice \scales
+  \layout { }
+  \midi { }
+}
+
diff --git a/input/midi/midi-transposing.ly b/input/midi/midi-transposing.ly
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/input/midi/midi-tuplets.ly b/input/midi/midi-tuplets.ly
new file mode 100644 (file)
index 0000000..0a0f5ef
--- /dev/null
@@ -0,0 +1,35 @@
+\version "2.10.0"
+\header {
+texidoc = "
+
+Midi2ly tuplet test.
+
+@example
+  python scripts/midi2ly.py --duration-quant=32 \
+      --allow-tuplet=4*2/3 \
+      --allow-tuplet=8*2/3 \
+      --allow-tuplet=4*3/5 \
+      --allow-tuplet=8*3/5 \
+      tu.midi 
+@end example
+"
+}
+
+
+\score { 
+  \context Voice  \relative c' {
+
+    a1 a2 a2. a4 a4. a8 a8. a16 a16. a32 a32. a64
+
+    \times 2/3 { b4 b4 b4 }
+    \times 3/5 { b4 b4 b4 b4 b4 }
+
+    \times 2/3 { c8 c8 c8 }
+    \times 3/5 { c8 c8 c8 c8 c8 }
+
+  }
+  \layout { }  
+  \midi { }
+}
+
+
diff --git a/input/midi/midi-volume-equaliser.ly b/input/midi/midi-volume-equaliser.ly
new file mode 100644 (file)
index 0000000..0ad06cb
--- /dev/null
@@ -0,0 +1,161 @@
+\version "2.10.0"
+\header {
+  texidoc = "@cindex Midi Volume Equaliser
+The full orchestra plays a notes, where groups stop one after
+another. Use this to tune equalizer settings. "
+}
+
+#(set-global-staff-size 16)
+
+%{
+
+Override, see scm/midi.scm:
+
+#(set! instrument-equalizer-alist
+  (append 
+   '(
+     ("flute" . (0 . 0.7))
+   )
+   instrument-equalizer-alist))
+
+%}
+
+flauti =  \relative c' {
+  \set Staff.midiInstrument = #"flute"
+  \set Staff.instrumentName = #"2 Flauti"
+  \set Staff.shortInstrumentName = #"Fl."
+
+  c1\f R1*10
+}
+
+oboi =  \relative c' {
+  \set Staff.midiInstrument = #"oboe"
+  \set Staff.instrumentName = #"2 Oboi"
+  \set Staff.shortInstrumentName = #"Ob."
+
+  R1*1 c1\f R1*9
+}
+
+clarinetti =  \relative c' {
+  \set Staff.midiInstrument = #"clarinet"
+  \set Staff.instrumentName = #"Clarinetti"
+  \set Staff.shortInstrumentName = #"Cl"
+
+  R1*2 c1\f R1*8
+}
+
+fagotti =  \relative c' {
+  \set Staff.midiInstrument = #"bassoon"
+  \set Staff.instrumentName = #"2 Fagotti"
+  \set Staff.shortInstrumentName = #"Fg."
+
+  \clef bass
+  R1*3 c1\f R1*7
+}
+
+corni =  \relative c' {
+  \set Staff.midiInstrument = #"french horn"
+  \set Staff.instrumentName = #"Corni"
+  \set Staff.shortInstrumentName = #"Cor"
+
+  R1*4 c1\f R1*6
+}
+
+trombe =  \relative c' {
+  \set Staff.midiInstrument = #"trumpet"
+  \set Staff.instrumentName = #"Trombe"
+  \set Staff.shortInstrumentName = #"Tp."
+
+  \clef bass
+  R1*5 c1\f R1*5
+}
+
+timpani =  \relative c' {
+  \set Staff.midiInstrument = #"timpani"
+  \set Staff.instrumentName = #"Timpani"
+  \set Staff.shortInstrumentName = #"Timp."
+
+  R1*6 c1\f R1*4
+}
+
+violinoI =  \relative c' {
+  \set Staff.midiInstrument = #"violin"
+  \set Staff.instrumentName = #"Violino I "
+  \set Staff.shortInstrumentName = #"Vl. I "
+
+  R1*7 c1\f R1*3
+}
+
+violinoII =  \relative c' {
+  \set Staff.midiInstrument = #"violin"
+  \set Staff.instrumentName = #"Violino II "
+  \set Staff.shortInstrumentName = #"Vl. II "
+  
+  R1*8 c1\f R1*2
+}
+
+viola =  \relative c' {
+  \set Staff.midiInstrument = #"viola"
+  \set Staff.instrumentName = #"Viola"
+  \set Staff.shortInstrumentName = #"Vla."
+
+  \clef alto
+  R1*9 c1\f R1*1
+}
+
+violoncello =  \relative c' {
+  \set Staff.midiInstrument = #"cello"
+                               %\set Staff.midiInstrument = #"contrabass"
+  \set Staff.instrumentName = #"Violoncello"
+  \set Staff.shortInstrumentName = #"Vc."
+  
+  \clef bass
+  R1*10 c1\f
+}
+
+
+\score {
+  << 
+    \new StaffGroup = "legni" << 
+      \new Staff = "flauti" \flauti
+      \new Staff = "oboi" \oboi
+      \new Staff = "clarinetti" \clarinetti 
+      \new Staff = "fagotti" \fagotti 
+    >>
+    \new StaffGroup = "ottoni" <<
+      \new Staff = "corni" \corni
+      \new Staff = "trombe" \trombe
+    >>
+    \new StaffGroup = "timpani" <<
+      \new Staff = "timpani" \timpani
+      { 
+       \skip 1 
+       %% Hmm: this forces a staff-bracket, that's good!
+       %% However, I can't find where is decided on staff-bracket yes/no
+      }
+    >>
+    \new StaffGroup = "archi" <<
+      \new GrandStaff = "violini" <<
+        \new Staff = "violino1" \violinoI
+        \new Staff = "violino2" \violinoII
+      >>
+      \new Staff = "viola" \viola
+      \new Staff = "violoncello" \violoncello
+    >>
+  >>
+
+  \layout {
+    \context {
+      \RemoveEmptyStaffContext
+    }
+  }
+  
+  \midi {
+    \context {
+      \Score
+      tempoWholesPerMinute = #(ly:make-moment 60 1)
+    }
+  }
+}
+
+
diff --git a/input/no-notation/midi-drums.ly b/input/no-notation/midi-drums.ly
deleted file mode 100644 (file)
index 2b799be..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-
-\version "2.10.0"
-
-\version "2.10.1" 
-
-\score {
-  \new DrumStaff <<
-    \drummode {
-      bd4 sn4 bd4 sn4
-      <<
-       {\voiceOne \repeat unfold 16 hh16 }
-       \new DrumVoice { \voiceTwo bd4 sn4 bd4 sn4 }
-      >> \oneVoice
-    }
-  >>
-  \layout {}
-  \midi {}
-}
diff --git a/input/no-notation/midi-grace.ly b/input/no-notation/midi-grace.ly
deleted file mode 100644 (file)
index 108b03b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#(ly:set-option 'old-relative)
-\version "2.10.0"
-\header{ texidoc = "Tests MIDI output with grace notes. " }
-
-\score { 
-  \context Voice \relative c {
-    \new Voice = VoiceOne
-       \grace {
-  \override Stem  #'stroke-style = #"grace"
-   c8 
-  \revert Stem #'stroke-style }
- d4 d d d d
-       \grace {
-  \override Stem  #'stroke-style = #"grace"
-   e16 f e f 
-  \revert Stem #'stroke-style }
- d4 d d d d 
-       
-  }
-  \layout { }  
-  \midi { }
-}
-
diff --git a/input/no-notation/midi-lyric-barcheck.ly b/input/no-notation/midi-lyric-barcheck.ly
deleted file mode 100644 (file)
index 7c22ef1..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-\version "2.10.0"
-\header {
-
-    texidoc = "Lyrics in MIDI are aligned to ties and beams:
-this examples causes no bar checks in MIDI.
-"
-
-
-    }
-\score {
-
-    <<\relative c'' \new Voice =  A {
-       \autoBeamOff
-       c8[ c] c2.
-       c1~c4 c2.
-       c4 ( d e) d
-       c1
-
-    }
-    \lyricsto "A" \lyricmode\new Lyrics { bla bla | bla bla | bla bla | bla }
-    >>
-    \layout {}
-      \midi {}
-    }
diff --git a/input/no-notation/midi-scales.ly b/input/no-notation/midi-scales.ly
deleted file mode 100644 (file)
index d6e8ed9..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-
-\version "2.10.0"
-% candidate for regression.  -gp
-\header {
-  texidoc="Converting LilyPond input to MIDI and then again back with
-  @code{midi2ly.py} is a reversible procedure in some simple cases,
-  which mean that the original @code{.ly} -file and the one converted 
-  back from the generated @code{.midi} -file do not differ.
-  Here are produced some scales.
-  
-  "
-}
-
-%{
-  This means, doing:
-
-    lilypond input/test/midi-scales.ly
-    midi2ly midi-scales.midi
-    diff -u input/test/midi-scales.ly midi-scales-midi.ly
-
-  should show no differences at all in \key commands or notes.
-
-  Therefore, do not reformat this file unless midi2ly changes.
-
-  1.7.30 reformatted, because
-  midi2ly now outpts 1 bar per line and adds bar checks and numbers.
-
-%}
-
-scales =  \relative c {
-
-  % [INSTRUMENT_NAME] bright acoustic
-  \key c \major  % sharp-major
-  c'4 d e f |
-  g a b c |
-
-  \key g \major
-  g a b c |
-  d e fis g |
-
-  \key d \major
-  d, e fis g |
-  a b cis d |
-
-  \key a \major
-  a b cis d |
-  e fis gis a |
-
-  \key e \major
-  e, fis gis a |
-  b cis dis e |
-
-  \key b \major
-  b cis dis e |
-  fis gis ais b |
-
-  \key fis \major
-  fis, gis ais b |
-  cis dis eis fis |
-
-  \key cis \major
-  cis, dis eis fis |
-  gis ais bis cis |
-
-  \key a \minor  % sharp-minor
-  a b c d |
-  e f gis a |
-
-  \key e \minor
-  e, fis g a |
-  b c dis e |
-
-  \key b \minor
-  b cis d e |
-  fis g ais b |
-
-  \key fis \minor
-  fis, gis a b |
-  cis d eis fis |
-
-  \key cis \minor
-  cis, dis e fis |
-  gis a bis cis |
-
-  \key gis \minor
-  gis ais b cis |
-  dis e fisis gis |
-
-  \key dis \minor
-  dis, eis fis gis |
-  ais b cisis dis |
-
-  \key ais \minor
-  ais bis cis dis |
-  eis fis gisis ais |
-
-  \key f \major  % flat-major
-  f, g a bes |
-  c d e f |
-
-  \key bes \major
-  bes c d ees |
-  f g a bes |
-
-  \key ees \major
-  ees,, f g aes |
-  bes c d ees |
-
-  \key aes \major
-  aes, bes c des |
-  ees f g aes |
-
-  \key des \major
-  des,, ees f ges |
-  aes bes c des |
-
-  \key ges \major
-  ges, aes bes ces |
-  des ees f ges |
-
-  \key ces \major
-  ces,, des ees fes |
-  ges aes bes ces |
-
-  \key d \minor  % flat-minor
-  d, e f g |
-  a bes cis d |
-
-  \key g \minor
-  g, a bes c |
-  d ees fis g |
-
-  \key c \minor
-  c,, d ees f |
-  g aes b c |
-
-  \key f \minor
-  f, g aes bes |
-  c des e f |
-
-  \key bes \minor
-  bes,, c des ees |
-  f ges a bes |
-
-  \key ees \minor
-  ees, f ges aes |
-  bes ces d ees |
-
-  \key aes \minor
-  aes, bes ces des |
-  ees fes g aes |
-}
-
-\score {
-  \context Voice \scales
-  \layout { }
-  \midi { }
-}
-
diff --git a/input/no-notation/midi-transposing.ly b/input/no-notation/midi-transposing.ly
deleted file mode 100644 (file)
index 3bf8b41..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#(ly:set-option 'old-relative)
-\version "2.10.0"
-
-\header { texidoc = "@cindex Transposing
-The transposing property leaves output invariant, but has effect on MIDI. "
-}
-
-\score { 
-  \context Voice \relative c {
-    % btw: this is not how transposing is done in lilypond
-       % this is a transposing performer, i.e. for midi-output only
-       \set Staff.transposing = #0 c
-       \set Staff.transposing = #2 c
-       \set Staff.transposing = #4 c
-       \set Staff.transposing = #5 c
-       \set Staff.transposing = #7 c
-       \set Staff.transposing = #9 c
-       \set Staff.transposing = #11 c
-       \set Staff.transposing = #12 c
-       
-  }
-  \layout { ragged-right = ##t } 
-  \midi { }
-}
-
diff --git a/input/no-notation/midi-tuplets.ly b/input/no-notation/midi-tuplets.ly
deleted file mode 100644 (file)
index 8169f36..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#(ly:set-option 'old-relative)
-\version "2.10.0"
-\header {
-texidoc = "
-
-Midi2ly tuplet test.
-
-@example
-  python scripts/midi2ly.py --duration-quant=32 \
-      --allow-tuplet=4*2/3 \
-      --allow-tuplet=8*2/3 \
-      --allow-tuplet=4*3/5 \
-      --allow-tuplet=8*3/5 \
-      tu.midi 
-@end example
-"
-}
-
-
-\score { 
-  \context Voice  \relative c' {
-
-    a1 a2 a2. a4 a4. a8 a8. a16 a16. a32 a32. a64
-
-    \times 2/3 { b4 b4 b4 }
-    \times 3/5 { b4 b4 b4 b4 b4 }
-
-    \times 2/3 { c8 c8 c8 }
-    \times 3/5 { c8 c8 c8 c8 c8 }
-
-  }
-  \layout { }  
-  \midi { }
-}
-
-
diff --git a/input/no-notation/midi-volume-equaliser.ly b/input/no-notation/midi-volume-equaliser.ly
deleted file mode 100644 (file)
index 73c4f70..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-#(ly:set-option 'old-relative)
-\version "2.10.0"
-\header {
-texidoc = "@cindex Midi Volume Equaliser
-The full orchestra plays a notes, where groups stop one after
-another. Use this to tune equalizer settings. "
-}
-
-#(set-global-staff-size 16)
-
-%{
-
-Override, see scm/midi.scm:
-
-#(set! instrument-equalizer-alist
-      (append 
-       '(
-        ("flute" . (0 . 0.7))
-        )
-      instrument-equalizer-alist))
-
-%}
-
-flauti =  \relative c' {
-  \set Staff.midiInstrument = #"flute"
-  \set Staff.instrumentName = #"2 Flauti"
-  \set Staff.shortInstrumentName = #"Fl."
-
-  c1\f R1*10
-}
-
-oboi =  \relative c' {
-  \set Staff.midiInstrument = #"oboe"
-  \set Staff.instrumentName = #"2 Oboi"
-  \set Staff.shortInstrumentName = #"Ob."
-
-  R1*1 c1\f R1*9
-}
-
-clarinetti =  \relative c' {
-  \set Staff.midiInstrument = #"clarinet"
-  \set Staff.instrumentName = #"Clarinetti"
-  \set Staff.shortInstrumentName = #"Cl"
-
-  R1*2 c1\f R1*8
-}
-
-fagotti =  \relative c' {
-  \set Staff.midiInstrument = #"bassoon"
-  \set Staff.instrumentName = #"2 Fagotti"
-  \set Staff.shortInstrumentName = #"Fg."
-
-  \clef bass
-  R1*3 c1\f R1*7
-}
-
-corni =  \relative c' {
-  \set Staff.midiInstrument = #"french horn"
-  \set Staff.instrumentName = #"Corni"
-  \set Staff.shortInstrumentName = #"Cor"
-
-  R1*4 c1\f R1*6
-}
-
-trombe =  \relative c' {
-  \set Staff.midiInstrument = #"trumpet"
-  \set Staff.instrumentName = #"Trombe"
-  \set Staff.shortInstrumentName = #"Tp."
-
-  \clef bass
-  R1*5 c1\f R1*5
-}
-
-timpani =  \relative c' {
-  \set Staff.midiInstrument = #"timpani"
-  \set Staff.instrumentName = #"Timpani"
-  \set Staff.shortInstrumentName = #"Timp."
-
-  R1*6 c1\f R1*4
-}
-
-violinoI =  \relative c' {
-  \set Staff.midiInstrument = #"violin"
-  \set Staff.instrumentName = #"Violino I "
-  \set Staff.shortInstrumentName = #"Vl. I "
-
-  R1*7 c1\f R1*3
-}
-
-violinoII =  \relative c' {
-  \set Staff.midiInstrument = #"violin"
-  \set Staff.instrumentName = #"Violino II "
-  \set Staff.shortInstrumentName = #"Vl. II "
-  R1*8 c1\f R1*2
-}
-
-viola =  \relative c' {
-  \set Staff.midiInstrument = #"viola"
-  \set Staff.instrumentName = #"Viola"
-  \set Staff.shortInstrumentName = #"Vla."
-
-  \clef alto
-  R1*9 c1\f R1*1
-}
-
-violoncello =  \relative c' {
-  \set Staff.midiInstrument = #"cello"
-  %\set Staff.midiInstrument = #"contrabass"
-  \set Staff.instrumentName = #"Violoncello"
-  \set Staff.shortInstrumentName = #"Vc."
-  
-  \clef bass
-  R1*10 c1\f
-}
-
-
-\score {
-  << 
-    \new StaffGroup = "legni" << 
-      \new Staff = "flauti" \flauti
-      \new Staff = "oboi" \oboi
-      \new Staff = "clarinetti" \clarinetti 
-      \new Staff = "fagotti" \fagotti 
-    >>
-    \new StaffGroup = "ottoni" <<
-      \new Staff = "corni" \corni
-      \new Staff = "trombe" \trombe
-    >>
-    \new StaffGroup = "timpani" <<
-      \new Staff = "timpani" \timpani
-     { 
-       \skip 1 
-       % Hmm: this forces a staff-bracket, that's good!
-       % However, I can't find where is decided on staff-bracket yes/no
-     }
-    >>
-    \new StaffGroup = "archi" <<
-      \new GrandStaff = "violini" <<
-        \new Staff = "violino1" \violinoI
-        \new Staff = "violino2" \violinoII
-      >>
-      \new Staff = "viola" \viola
-      \new Staff = "violoncello" \violoncello
-    >>
-  >>
-
-  \layout {
-       \layoutSixteen
-       indent=100.0\mm
-       line-width=150.0\mm
-    \context {
-      \RemoveEmptyStaffContext
-    }
-  }
-  
-  \midi {
-    \context {
-      \Score
-      tempoWholesPerMinute = #(ly:make-moment 60 1)
-      }
-    }
-
-
-}
-
-
index a325a017d6792f0713513054052f889b3b185a5f..c7eb79955a827f3061dce6d32d5c38a823cd8846 100644 (file)
@@ -159,10 +159,10 @@ extract_alteration (SCM alteration_def)
   else if (scm_is_pair (alteration_def))
     return ly_scm2rational (scm_car (alteration_def));
   else if (alteration_def == SCM_BOOL_F)
-    return 0;
+    return Rational (0);
   else
     assert (0);
-  return 0;
+  return Rational (0);
 }
 
 bool
index fe8c5539e1c6e593a339553132a0abbd889e7277..4a3b9d4a41d3405d2de8e9c28f205bf23a726661 100644 (file)
@@ -21,12 +21,12 @@ Audio_item::Audio_item ()
   audio_column_ = 0;
 }
 
-Audio_note::Audio_note (Pitch p, Moment m, bool tie_event, int transposing_i)
+Audio_note::Audio_note (Pitch p, Moment m, bool tie_event, Pitch transposing)
 {
   pitch_ = p;
   length_mom_ = m;
   tied_ = 0;
-  transposing_ = transposing_i;
+  transposing_ = transposing;
   tie_event_ = tie_event;
 }
 
@@ -52,9 +52,9 @@ Audio_dynamic::Audio_dynamic (Real volume)
   volume_ = volume;
 }
 
-Audio_tempo::Audio_tempo (int per_minute_4_i)
+Audio_tempo::Audio_tempo (int per_minute_4)
 {
-  per_minute_4_ = per_minute_4_i;
+  per_minute_4_ = per_minute_4;
 }
 
 Audio_time_signature::Audio_time_signature (int beats, int one_beat)
index 8966657e4813f37b1e55343cf9efcb64ef0fd29f..092c6b673d39f9509b87d997961796553e82c6fd 100644 (file)
@@ -30,8 +30,7 @@ Beam_rhythmic_element::de_grace ()
 {
   if (start_moment_.grace_part_)
     {
-      start_moment_.main_part_ = 
-       start_moment_.grace_part_; 
+      start_moment_.main_part_ = start_moment_.grace_part_; 
       start_moment_.grace_part_ = 0;
     }
 }
index 2a2720656c888e082a44adaaa1320781fbf2723a..8500cf9811d6ae347ae26e5a2dff62ce338fe03a 100644 (file)
@@ -38,10 +38,11 @@ LY_DEFINE (ly_add_listener, "ly:add-listener",
   SCM_ASSERT_TYPE (l, list, SCM_ARG1, __FUNCTION__, "listener");
   SCM_ASSERT_TYPE (d, disp, SCM_ARG2, __FUNCTION__, "dispatcher");
   
-  for (int arg=SCM_ARG3; scm_is_pair (cl); cl = scm_cdr (cl), arg++)
+  for (int arg = SCM_ARG3; scm_is_pair (cl); cl = scm_cdr (cl), arg++)
     {
-      SCM_ASSERT_TYPE (scm_symbol_p (cl), cl, arg, __FUNCTION__, "symbol");
-      d->add_listener (*l, scm_car (cl));
+      SCM sym = scm_car (cl);
+      SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, arg, __FUNCTION__, "symbol");
+      d->add_listener (*l, sym);
     }
 
   return SCM_UNDEFINED;
index 7aa463b5767f6af2aad4193fccc26a356dcef13c..49a8d270018a4b08cc5c80916b7a05769b0a3395 100644 (file)
@@ -65,7 +65,7 @@ Drum_note_performer::process_music ()
             }
 
          Audio_note *p = new Audio_note (*pit, get_event_length (n), 
-                                          tie_event, 0);
+                                          tie_event, Pitch (0, 0, 0));
          Audio_element_info info (p, n);
          announce_element (info);
          notes_.push_back (p);
index fb4bb102632b9946286d07abc048dfb4308b306a..361036256d3642d70328db3614eda2f471f43615 100644 (file)
@@ -53,13 +53,13 @@ LY_DEFINE (ly_make_duration, "ly:make-duration",
           "(whole, half, quarter, etc.) and a number of augmentation\n"
           "dots. \n")
 {
-  SCM_ASSERT_TYPE (scm_integer_p (length) == SCM_BOOL_T,
+  SCM_ASSERT_TYPE (scm_is_integer (length),
                   length, SCM_ARG1, __FUNCTION__, "integer");
 
   int dots = 0;
   if (dotcount != SCM_UNDEFINED)
     {
-      SCM_ASSERT_TYPE (scm_integer_p (dotcount) == SCM_BOOL_T,
+      SCM_ASSERT_TYPE (scm_is_integer (dotcount),
                       dotcount, SCM_ARG2, __FUNCTION__, "integer");
       dots = scm_to_int (dotcount);
     }
index 59fc0bafb7868898e700a647f1413ede5d587a0c..1cb51a10ff27b34cea174434eee275511b1fa529 100644 (file)
@@ -296,7 +296,7 @@ LY_DEFINE (ly_stderr_redirect, "ly:stderr-redirect",
           1, 1, 0, (SCM file_name, SCM mode),
           "Redirect stderr to FILE-NAME, opened with MODE.")
 {
-  SCM_ASSERT_TYPE (scm_string_p (file_name), file_name, SCM_ARG1,
+  SCM_ASSERT_TYPE (scm_is_string (file_name), file_name, SCM_ARG1,
                   __FUNCTION__, "file_name");
   char const *m = "w";
   if (mode != SCM_UNDEFINED && scm_string_p (mode))
index 43009195c3cf1db2608bcea5f918df9727a339ff..e6f0c9ad91615b9d93a46f5e6977f4067a031468 100644 (file)
@@ -55,13 +55,14 @@ public:
 class Audio_note : public Audio_item
 {
 public:
-  Audio_note (Pitch p, Moment m, bool tie_event, int transposing);
+  Audio_note (Pitch p, Moment m, bool tie_event, Pitch transposition);
 
   void tie_to (Audio_note *);
 
   Pitch pitch_;
   Moment length_mom_;
-  int transposing_;
+  Pitch transposing_;
+  
   Audio_note *tied_;
   bool tie_event_;
 };
index 0e3be73917886a59c632908038478616b6c1f78f..65883d6345052096b9b17f595b0c6986dbcd5a7e 100644 (file)
@@ -53,7 +53,7 @@ public:
   Rational tone_pitch () const;
   int rounded_semitone_pitch () const;
   int rounded_quartertone_pitch () const;
-
+  Pitch negated () const;
   string to_string () const;
 
   DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b));
index 71b2037efb6e8035fee2a906baf9b957ea26be2c..bcd967cda108991715b6bb21b6ad8a6aec0b0860 100644 (file)
@@ -43,7 +43,6 @@ public:
 
 DECLARE_UNSMOB (Score, score);
 
-void default_rendering (SCM, SCM, SCM, SCM, SCM, SCM);
 SCM ly_render_output (SCM, SCM);
 SCM ly_run_translator (SCM, SCM, SCM);
 
index 4e1688f6f466a7fa3436b3ebfd082f67845f1181..9f226f48db8d66017bcac533c21f06655a17ecdc 100644 (file)
@@ -18,15 +18,16 @@ class Stream_event : public Prob
 public:
   Stream_event ();
   VIRTUAL_COPY_CONSTRUCTOR (Stream_event, Stream_event);
-  // todo: remove unneeded constructors
+
   Stream_event (SCM event_class, SCM mutable_props=SCM_EOL);
   Stream_event (SCM class_name, Input *);
-  Stream_event (Stream_event *ev);
 
   Input *origin () const;
   void set_spot (Input *i);
   bool internal_in_event_class (SCM class_name);
 
+  virtual SCM copy_mutable_properties () const;
+
   DECLARE_SCHEME_CALLBACK (undump, (SCM));
   DECLARE_SCHEME_CALLBACK (dump, (SCM));
 
@@ -36,5 +37,6 @@ public:
 
 Stream_event *unsmob_stream_event (SCM);
 DECLARE_TYPE_P (Stream_event);
+SCM ly_event_deep_copy (SCM);
 
 #endif /* STREAM_EVENT_HH */
index b317764fecfb0f29695bf12b4978845dbd34e952..8bd0d1305fc89936907e4246b6a9c3b5878ec4db 100644 (file)
@@ -197,10 +197,16 @@ Key_engraver::read_event (Stream_event const *r)
 
   if (scm_is_pair (alist))
     {
-      r->origin ()->warning ("No ordering for key signature alterations");
+      bool warn = false;
       for (SCM s = alist; scm_is_pair (s); s = scm_cdr (s))
        if (ly_scm2rational (scm_cdar (s)))
-         accs = scm_cons (scm_car (s), accs);
+         {
+           warn = true;
+           accs = scm_cons (scm_car (s), accs);
+         }
+
+      if (warn)
+       r->origin ()->warning ("No ordering for key signature alterations");      
     }
   
   context ()->set_property ("keySignature", accs);
index 9bb8b11a48edcabdfbb3330ebb24d85a2f60bee0..762e8c48086269c86739ef92db2c878ee012c1ea 100644 (file)
@@ -52,7 +52,7 @@ Key_performer::process_music ()
 
       Pitch key_do (0,
                    scm_to_int (scm_caar (pitchlist)),
-                   scm_to_int (scm_cdar (pitchlist)));
+                   ly_scm2rational (scm_cdar (pitchlist)));
 
       Pitch c_do (0, 0, 0);
 
index 10b7f2715c0c1674c322fd795056367c489db336..3fcdb4ca223d6c7ebea4a3b6e983cfc6cab6001d 100644 (file)
@@ -258,7 +258,8 @@ Midi_note::get_length () const
 int
 Midi_note::get_fine_tuning () const
 {
-  Rational tune = audio_->pitch_.tone_pitch () * Rational (2);
+  Rational tune = (audio_->pitch_.tone_pitch ()
+                  + audio_->transposing_.tone_pitch ()) * Rational (2);
   tune -= Rational (get_semitone_pitch ());
 
   tune *= 100;
@@ -268,8 +269,8 @@ Midi_note::get_fine_tuning () const
 int
 Midi_note::get_semitone_pitch () const
 {
-  return int (rint (double (audio_->pitch_.tone_pitch () *  Rational (2, 1))))
-    + audio_->transposing_;
+  return int (double ((audio_->pitch_.tone_pitch ()
+                      + audio_->transposing_.tone_pitch ()) * Rational (2)));
 }
 
 string
index 864507edf3a4c9420a7a60d42be81576b3e676e8..83f88fbcd91a06e66988d8c6f52b6de4264d5f2f 100644 (file)
@@ -184,7 +184,7 @@ Music::compress (Moment factor)
 }
 
 /*
-TODO: make transposition non-destructive
+  This mutates alist.  Hence, make sure that it is not changed 
 */
 SCM
 transpose_mutable (SCM alist, Pitch delta)
index e5c2ef9e050d83b60b5338d21dbfb5f5aab2addf..6bfc82211b73724e7104fa121558bfb903b06776 100644 (file)
@@ -38,11 +38,10 @@ Note_performer::process_music ()
 {
   if (note_evs_.size ())
     {
-      int transposing = 0;
-
+      Pitch transposing;
       SCM prop = get_property ("instrumentTransposition");
       if (unsmob_pitch (prop))
-       transposing = unsmob_pitch (prop)->rounded_semitone_pitch ();
+       transposing = *unsmob_pitch (prop);
 
       while (note_evs_.size ())
        {
@@ -67,7 +66,7 @@ Note_performer::process_music ()
                 }
 
              Audio_note *p = new Audio_note (*pitp, get_event_length (n), 
-                                              tie_event, - transposing);
+                                              tie_event, transposing.negated ());
              Audio_element_info info (p, n);
              announce_element (info);
              notes_.push_back (p);
index 95fd4a578245d6e9cd4a66b7a9994fcf6a38bcd1..4bf03f2e13d84001138d1f0d29a6059d8b998e21 100644 (file)
@@ -82,7 +82,7 @@ LY_DEFINE (ly_output_description, "ly:output-description",
   return ell;
 }
 
-LY_DEFINE (ly_layout_def_p, "ly:layout-def?",
+LY_DEFINE (ly_output_def_p, "ly:output-def?",
           1, 0, 0, (SCM def),
           "Is @var{def} a layout definition?")
 {
index bddeffe15084c1370ae85d611a368067357f7e07..c66d1d6ae989cda7c6392a49a3096a9efea068f8 100644 (file)
@@ -91,9 +91,9 @@ Paper_book::output (SCM output_channel)
 {
   if (scm_is_pair (performances_))
     {
-      SCM proc = ly_lily_module_constant ("paper-book-write-midis");
-
-      scm_call_2 (proc, self_scm (), output_channel);
+      SCM proc = ly_lily_module_constant ("write-performances-midis");
+      scm_call_2 (proc, performances (), output_channel);
     }
 
   if (scores_ == SCM_EOL)
index 16b78e9420348422935fb6cba17ed3a505389de2..e45cd841b7d5bf5666a99b29eb0dc9e3087becbc 100644 (file)
@@ -40,6 +40,15 @@ LY_DEFINE (ly_make_pitch, "ly:make-pitch",
   return p.smobbed_copy ();
 }
 
+LY_DEFINE (ly_pitch_negate, "ly:pitch-negate", 1, 0, 0,
+          (SCM p),
+          "Negate @var{p}.")
+{
+  Pitch *pp = unsmob_pitch (p);
+  SCM_ASSERT_TYPE (pp, p, SCM_ARG1, __FUNCTION__, "Pitch");
+  return pp->negated ().smobbed_copy ();
+}
+
 LY_DEFINE (ly_pitch_steps, "ly:pitch-steps", 1, 0, 0,
           (SCM p),
           "Number of steps counted from middle C of the pitch @var{p}.")
index 4d983ab6d5e4e6a729e0440c51d9e6e302426285..880dc79edfdb4339ab99dba99d54d11338a32f92 100644 (file)
@@ -304,3 +304,9 @@ Pitch::transposed (Pitch d) const
 
 Rational FLAT_ALTERATION (-1, 2);
 Rational SHARP_ALTERATION (1, 2);
+
+Pitch
+Pitch::negated () const
+{
+  return pitch_interval (*this, Pitch ());
+}
index 849472c329a34a52ca1e594740231e6281cb34a9..c55aae34285f006177111621362ee3a4b9ea1cd6 100644 (file)
@@ -244,7 +244,8 @@ Quote_iterator::process (Moment m)
                    mp = *me_pitch;
 
                  Pitch diff = pitch_interval (qp, mp);
-
+                 ev = ev->clone ();
+                 
                  SCM props =  transpose_mutable (ev->get_property_alist (true), diff);
                  ev = new Stream_event (ev->get_property ("class"), props);
                  transposed_musics_ = scm_cons (ev->unprotect (), transposed_musics_);
index b8946871c0061bb7c44a3f484fdca08477801541..7e8370068f3afe1d87ff898b1bbc795fcd25e99d 100644 (file)
@@ -16,7 +16,7 @@ LY_DEFINE (ly_make_listener, "ly:make-listener",
           "\n"
           " @var{callback} should take exactly one argument." )
 {
-  SCM_ASSERT_TYPE (scm_procedure_p (callback), callback, SCM_ARG1, __FUNCTION__, "procedure");
+  SCM_ASSERT_TYPE (ly_is_procedure (callback), callback, SCM_ARG1, __FUNCTION__, "procedure");
   Scheme_listener *l = new Scheme_listener (callback);
   SCM listener = GET_LISTENER (l->call).smobbed_copy ();
   l->unprotect ();
index c188de3704d9e1a7ea9d32d16250ad363cbe3f87..b48219ad44895e36a0f1ec77a705ba0563186014 100644 (file)
@@ -12,6 +12,9 @@
 #include "output-def.hh"
 #include "global-context.hh"
 #include "lilypond-key.hh"
+#include "music-output.hh"
+#include "paper-score.hh"
+#include "paper-book.hh"
 
 LY_DEFINE (ly_make_score, "ly:make-score",
           1, 0, 0,
@@ -27,6 +30,49 @@ LY_DEFINE (ly_make_score, "ly:make-score",
   return score->unprotect ();
 }
 
+LY_DEFINE (ly_score_output_defs, "ly:score-output-defs",
+          1, 0, 0, (SCM score),
+          "All output defs in a score.")
+{
+  Score *sc = unsmob_score (score);
+  SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score");
+
+  SCM l = SCM_EOL;
+  for (vsize i = 0; i < sc->defs_.size (); i++)
+    l = scm_cons (sc->defs_[i]->self_scm(), l);
+  return scm_reverse_x (l, SCM_EOL);
+}
+
+
+
+LY_DEFINE (ly_score_header, "ly:score-header",
+          1, 0, 0, (SCM score),
+          "return score header.")
+{
+  Score *sc = unsmob_score (score);
+  SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score");
+  return sc->header_;
+}
+
+
+LY_DEFINE (ly_score_music, "ly:score-music",
+          1, 0, 0, (SCM score),
+          "return score music.")
+{
+  Score *sc = unsmob_score (score);
+  SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score");
+  return sc->get_music ();
+}
+
+LY_DEFINE (ly_score_error_p, "ly:score-error?",
+          1, 0, 0, (SCM score),
+          "Was there an error in the score?")
+{
+  Score *sc = unsmob_score (score);
+  SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score");
+  return scm_from_bool (sc->error_found_);
+}
+
 LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format",
           2, 1, 0, (SCM score, SCM layout, SCM key),
           "Run @var{score} through @var{layout}, an output definition, "
@@ -69,47 +115,66 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format",
   return output;
 }
 
-LY_DEFINE (ly_score_process, "ly:score-process",
-          5, 0, 0,
-          (SCM score_smob,
-           SCM default_header,
-           SCM default_paper,
-           SCM default_layout,
-           SCM basename),
-          "Print score without page-layout: just print the systems.")
+LY_DEFINE (ly_score_process, "ly:render-music-as-systems",
+          5, 0, 0, (SCM music,
+                    SCM outdef,
+                    SCM book_outputdef,
+                    SCM header,
+                    SCM outname),
+          "Create output using a default \\book block. ")
 {
-  Score *score = unsmob_score (score_smob);
+  SCM_ASSERT_TYPE(unsmob_music(music), music,
+                 SCM_ARG1, __FUNCTION__, "music");
+  SCM_ASSERT_TYPE(unsmob_output_def (outdef), outdef,
+                 SCM_ARG2, __FUNCTION__, "output def");
+  SCM_ASSERT_TYPE(unsmob_output_def (book_outputdef), book_outputdef,
+                 SCM_ARG3, __FUNCTION__, "output def");
+  SCM_ASSERT_TYPE(scm_is_string (outname), outname,
+                 SCM_ARG5, __FUNCTION__, "string");
+  
+  
+  SCM scaled_def = outdef;
+  SCM scaled_bookdef = book_outputdef;
+
+  Output_def *bpd = unsmob_output_def (book_outputdef);
+
+  /* ugh .  */
+  assert (bpd->c_variable ("is-paper") == SCM_BOOL_T);
+
+  Real scale = scm_to_double (bpd->c_variable ("output-scale"));
+
+  Output_def *def = scale_output_def (unsmob_output_def (outdef), scale);
+  Output_def *bdef = scale_output_def (bpd, scale);
+  def->parent_ = bdef;
+
+  scaled_def = def->self_scm ();
+  scaled_bookdef = bdef->self_scm ();
 
-  SCM_ASSERT_TYPE (score, score_smob, SCM_ARG1, __FUNCTION__, "score");
+  def->unprotect ();
+  bdef->unprotect ();
 
-  // allow header to be undefined.
-  SCM_ASSERT_TYPE (unsmob_output_def (default_paper),
-                  default_header, SCM_ARG3, __FUNCTION__, "\\paper block");
-  SCM_ASSERT_TYPE (unsmob_output_def (default_layout),
-                  default_header, SCM_ARG4, __FUNCTION__, "\\layout block");
+  SCM context = ly_run_translator (music, scaled_def, SCM_BOOL_F);
+  SCM output_as_scm = ly_format_output (context);
+  Music_output *output = unsmob_music_output (output_as_scm);
 
-  Object_key *key = new Lilypond_general_key (0, score->user_key_, 0);
+  Paper_score *pscore = dynamic_cast<Paper_score *> (output);
+  assert (pscore);
 
-  if (score->error_found_)
-    return SCM_UNSPECIFIED;
+  /* ugh, this is strange, Paper_book without a Book object. */
+  Paper_book *paper_book = new Paper_book ();
+  paper_book->header_ = header;
+  paper_book->paper_ = unsmob_output_def (scaled_bookdef);
 
-  SCM header = ly_is_module (score->header_)
-    ? score->header_
-    : default_header;
+  if (ly_is_module (header))
+    paper_book->add_score (header);
 
-  for (vsize i = 0; i < score->defs_.size (); i++)
-    default_rendering (score->get_music (), score->defs_[i]->self_scm (),
-                      default_paper, header, basename, key->self_scm ());
+  paper_book->add_score (pscore->self_scm ());
+  paper_book->classic_output (outname);
+  paper_book->unprotect ();
 
-  if (score->defs_.empty ())
-    {
-      default_rendering (score->get_music (),
-                        default_layout,
-                        default_paper,
-                        header, basename, key->self_scm ());
-    }
+  scm_remember_upto_here_1 (scaled_def);
+  scm_remember_upto_here_1 (scaled_bookdef);
 
-  key->unprotect ();
   return SCM_UNSPECIFIED;
 }
 
index 52a48538b8d8d3cf2630bc77fcfbd66b7cc27aea..63169ca4620dbb8da7dc7b03ad55f1cbc8694543 100644 (file)
@@ -106,58 +106,6 @@ Score::Score (Score const &s)
     ly_module_copy (header_, s.header_);
 }
 
-void
-default_rendering (SCM music, SCM outdef,
-                  SCM book_outputdef,
-                  SCM header,
-                  SCM outname,
-                  SCM key)
-{
-  SCM scaled_def = outdef;
-  SCM scaled_bookdef = book_outputdef;
-
-  Output_def *bpd = unsmob_output_def (book_outputdef);
-
-  /* ugh.  */
-  if (bpd->c_variable ("is-paper") == SCM_BOOL_T)
-    {
-      Real scale = scm_to_double (bpd->c_variable ("output-scale"));
-
-      Output_def *def = scale_output_def (unsmob_output_def (outdef), scale);
-      Output_def *bdef = scale_output_def (bpd, scale);
-      def->parent_ = bdef;
-
-      scaled_def = def->self_scm ();
-      scaled_bookdef = bdef->self_scm ();
-
-      def->unprotect ();
-      bdef->unprotect ();
-    }
-
-  SCM context = ly_run_translator (music, scaled_def, key);
-  
-  SCM output_as_scm = ly_format_output (context);
-  Music_output *output = unsmob_music_output (output_as_scm);
-
-  if (Paper_score *pscore = dynamic_cast<Paper_score *> (output))
-    {
-      /* ugh, this is strange, Paper_book without a Book object. */
-      Paper_book *paper_book = new Paper_book ();
-      paper_book->header_ = header;
-      paper_book->paper_ = unsmob_output_def (scaled_bookdef);
-
-      if (ly_is_module (header))
-       paper_book->add_score (header);
-
-      paper_book->add_score (pscore->self_scm ());
-      paper_book->classic_output (outname);
-      paper_book->unprotect ();
-    }
-
-  scm_remember_upto_here_1 (scaled_def);
-  scm_remember_upto_here_1 (output_as_scm);
-  scm_remember_upto_here_1 (scaled_bookdef);
-}
 
 /*
   Format score, return list of Music_output objects.
index 1f890782a44cbfc09dca7c79626ac050b32c80ec..46f19b2ee2f31ccc90b5f0951b7fa3000e826790 100644 (file)
@@ -13,12 +13,13 @@ LY_DEFINE (ly_make_stream_event, "ly:make-stream-event",
           "Creates a stream event of class @var{cl} with the given mutable property list.\n" )
 {
   SCM_ASSERT_TYPE (scm_is_symbol (cl), cl, SCM_ARG1, __FUNCTION__, "symbol");
-  if (proplist != SCM_UNDEFINED)
-    {
-      SCM_ASSERT_TYPE (scm_list_p (proplist), proplist, SCM_ARG2, __FUNCTION__, "association list");
-    }
-  else
+
+  /* should be scm_list_p, but scm_list_p is expensive. */
+  SCM_ASSERT_TYPE (scm_is_pair (proplist), proplist, SCM_ARG2, __FUNCTION__, "association list");
+  
+  if (proplist == SCM_UNDEFINED)
     proplist = SCM_EOL;
+
   Stream_event *e = new Stream_event (cl, proplist);
   return e->unprotect ();
 }
@@ -42,3 +43,20 @@ LY_DEFINE (ly_event_set_property, "ly:event-set-property!",
   SCM_ASSERT_TYPE (sc, ev, SCM_ARG1, __FUNCTION__, "event");
   return ly_prob_set_property_x (ev, sym, val);
 }
+
+LY_DEFINE (ly_event_deep_copy, "ly:event-deep-copy",
+          1, 0, 0, (SCM m),
+          "Copy @var{m} and all sub expressions of @var{m}")
+{
+  SCM copy = m;
+  if (Stream_event *ev = unsmob_stream_event (m))
+    {
+      ev = ev->clone ();
+      copy = ev->unprotect ();
+    }
+  else if (scm_is_pair (m))
+    copy = scm_cons (ly_event_deep_copy (scm_car (m)),
+                    ly_event_deep_copy (scm_cdr (m)));
+
+  return copy;
+}
index ff736d88323809227888f6b74037107ec21827d1..12219884b1071d40e9919e4cf13b771b515d2148 100644 (file)
@@ -35,11 +35,10 @@ Stream_event::Stream_event (SCM class_name, Input *origin)
     set_spot (origin);
 }
 
-Stream_event::Stream_event (Stream_event *ev)
-  : Prob (ly_symbol2scm ("Stream_event"), SCM_EOL)
+SCM
+Stream_event::copy_mutable_properties () const
 {
-  mutable_property_alist_ = scm_copy_tree (ev->mutable_property_alist_);
-  immutable_property_alist_ = ev->immutable_property_alist_;
+  return ly_event_deep_copy (mutable_property_alist_);
 }
 
 Input *
index 2aab6ac2b16b513e747d066410048409bdec9a68..73041c6a837f6fdb7482f14b02a7c65f57ae9a08 100644 (file)
@@ -300,6 +300,7 @@ ADD_INTERFACE (Tie,
               "dash-period "
               "details "
               "direction "
+              "head-direction "
               "line-thickness " 
               "quant-score "
               "staff-position "
index 077c965bd545137645fd35ce7c6c771816f6bae3..05ed471320d93d629567448e51ef7afe8a035df8 100644 (file)
@@ -610,9 +610,8 @@ transposition =
 
    (context-spec-music
     (make-property-set 'instrumentTransposition
-                      (ly:pitch-diff (ly:make-pitch 0 0 0) (pitch-of-note pitch-note)))
-        'Staff
-))
+                      (ly:pitch-negate (pitch-of-note pitch-note)))
+        'Staff))
 
 tweak = #(define-music-function (parser location sym val arg)
           (symbol? scheme? ly:music?)
index fe32b4ecd96cd923114968a4f19f440e073921e8..43a738d6ae25a2a6241aaad830af50a63785d91e 100644 (file)
@@ -260,6 +260,10 @@ the @code{instr} property labels following lines.")
      (instrumentEqualizer ,procedure? "
 Function taking a string (instrument name), and returning a (@var{min} . @var{max}) pair of numbers for the loudness range of the instrument.
 ")
+
+     ;; the definition is reversed wrt  traditional transposition
+     ;; this because \transpose { \transposition .. } won't work
+     ;; otherwise.
      (instrumentTransposition ,ly:pitch? "Defines the transposition of
 the instrument. Its value is the pitch that sounds like middle C. This
 is used to transpose the MIDI output, and @code{\\quote}s.")
index ddb9f7f057add0a26eebdcf4c3a770cc7de0647e..fe584ad40dca4cc6cdbcfe1a74aa3570fc34dbe9 100644 (file)
  "A ligature"
  '())
 
+(ly:add-interface
+ 'key-cancellation-interface
+ "A key cancellation"
+ '())
+
 (ly:add-interface
  'ligature-bracket-interface
  "A bracket indicating a ligature in the original edition"
index cb240332ca0bab1aaf547ba141c6d67229fea44e..1e8fe97e477809c669338cb9072e8594a31adb16 100644 (file)
@@ -61,6 +61,9 @@
 (define-public default-script-alist '())
 
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; parser <-> output hooks.
+
 ;; parser stuff.
 (define-public (print-music-as-book parser music)
   (let* ((head (ly:parser-lookup parser '$defaultheader))
@@ -85,7 +88,6 @@
    parser 'toplevel-scores
    (cons score (ly:parser-lookup parser 'toplevel-scores))))
 
-
 (define-public (scorify-music music parser)
   
   (for-each (lambda (func)
 (define-public (print-score-with-defaults parser score)
   (let*
       ((paper (ly:parser-lookup parser '$defaultpaper))
-       (layout (ly:parser-lookup parser '$defaultlayout))
-       (header (ly:parser-lookup parser '$defaultheader))
        (count (ly:parser-lookup parser 'output-count))
        (base (ly:parser-output-name parser)))
 
        (set! base (format #f "~a-~a" base count)))
 
     (ly:parser-define! parser 'output-count (1+ count))
-    (ly:score-process score header paper layout base)
-    ))
+
+    (if (not (ly:score-error? score))
+       (let*
+           ((header (ly:score-header score))
+            (output-defs (ly:score-output-defs score))
+            (layout-defs (filter  (lambda (d) (eq? #t (ly:output-def-lookup d 'is-layout)))
+                                 output-defs))
+            (midi-defs (filter (lambda (d)  (eq? #t (ly:output-def-lookup d 'is-midi)))
+                               output-defs))
+            (music (ly:score-music score))
+            (layout-def (if (null? layout-defs)
+                            (ly:parser-lookup parser '$defaultlayout)
+                            (car layout-defs))))
+
+         (if (not (module? header))
+             (set! header (ly:parser-lookup parser '$defaultheader)))
+            
+         (ly:render-music-as-systems
+          music layout-def paper header base)
+
+         (if (pair? midi-defs)
+             (ly:performance-write (ly:format-output (ly:run-translator music (car midi-defs)))
+                                   (format #f "~a.midi" base)
+                                   ))
+             
+    ))))
+
+
+
 
 
 ;;;;;;;;;;;;;;;;
index dee999868e7a22f2eaf1a5699d8fa2878931827a..cef0fae28b07d31369ec4860f2eae14120131f43 100644 (file)
@@ -276,17 +276,18 @@ returns the program of the instrument
 
 (define-public (alterations-in-key pitch-list)
   "Count number of sharps minus number of flats"
-  (/ (apply + (map cdr pitch-list)) 2))
+  
+  (* (apply + (map cdr pitch-list)) 2))
 
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 
-(define-public (paper-book-write-midis paper-book basename)
+(define-public (write-performances-midis performances basename)
   (let
       loop
-    ((perfs (ly:paper-book-performances paper-book))
+    ((perfs performances)
      (count 0))
 
 
index 370bfea2a8dcb78ef84060c0c59390a0a6d6d562..ac89b1e2790177f1bb87d206bc516bddeb58a6c7 100644 (file)
@@ -97,7 +97,7 @@
    ly:output-description
    ly:paper-book?
    ly:prob-property
-   ly:layout-def?
+   ly:output-def?
    ly:paper-get-font
    ly:paper-get-number
    ly:paper-system?