out-scons
tags
test-output-distance
+*.gcov
+*.gcda
+*.gcno
STEPMAKE_TEMPLATES=toplevel po install
include $(depth)/make/stepmake.make
+#
+# suggested settings
+#
+# CHECK_SOURCE=<input/regression/ reference dir>
+# LILYPOND_JOBS= -djob-count=X ## for SMP/Multicore machine
+#
+include local.make
+
local-dist: dist-toplevel-txt-files dist-changelog
dist-changelog:
@false
-test:
+test-clean:
$(MAKE) -C input/regression/ out=test clean
- $(MAKE) -C input/regression/ out=test WWW ANTI_ALIAS_FACTOR=1
+
+test:
+## no aa-scaling, no PDF
+ $(MAKE) -C input/regression/ out=test LILYPOND_BOOK_LILYPOND_FLAGS="--backend=eps --formats=ps,png $(LILYPOND_JOBS) -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -dcheck-internal-types -ddump-signatures -danti-alias-factor=1" LILYPOND_BOOK_VERBOSE= out-test/collated-files.html
+ @find input ly -name '*.ly' |grep -v 'out.*/' | xargs grep '\\version' -L | sed 's/^/**** Missing version: /g'
+
-CHECK_SOURCE=$(HOME)/vc/gub/target/linux-x86/build/lilypond-master-git.sv.gnu.org-lilypond.git/input/regression/out-test/
RESULT_DIR=$(top-build-dir)/out/test-results/
-check: test
+check-test: test
rm -rf $(RESULT_DIR)
mkdir -p $(RESULT_DIR)
$(PYTHON) $(buildscript-dir)/output-distance.py --output-dir $(RESULT_DIR) $(CHECK_SOURCE) input/regression/out-test/
--- /dev/null
+#!/bin/sh
+import os
+import glob
+import re
+
+cmds = """
+./configure --enable-config=cov --disable-optimising
+make conf=cov -j2
+make conf=cov test LILYPOND_JOBS=
+
+cd out-cov
+ln ../lily/* .
+ln ../lily/out-conv/*cc .
+mkdir include
+ln ../lily/include/* include/
+for a in *[cyl] ; do gcov -o ../lily/out-cov/ -p $a > $a.gcov-summary ; done
+"""
+
+cmds = ''
+
+for c in cmds.split ('\n'):
+ os.system (c)
+
+os.chdir ('out-cov')
+
+#File 'accidental-engraver.cc'
+#Lines executed:87.70% of 252
+
+results = []
+for f in glob.glob ('*.gcov-summary'):
+ str = open (f).read ()
+ m = re.search ("File '([^']+.cc)'\s*Lines executed:([0-9.]+)% of ([0-9]+)", str)
+ if '/usr/lib' in m.group (1):
+ continue
+
+ if m:
+ cov = float (m.group (2))
+ lines = int (m.group (3))
+ pain = lines * (100.0 - cov)
+ file = m.group (1)
+ tup = (pain, locals ().copy())
+
+ results.append(tup)
+
+results.sort ()
+results.reverse()
+for (pain, d) in results:
+ print '%(cov)5.2f (%(lines)6d): %(file)s' % d
+
pictures = ['jpeg', 'png', 'xpm']
lst.write ('\n')
else:
- print cannot find" , `file_name`
+ print "cannot find" , `file_name`
list_item (base + ext, 'The input', 'ASCII')
OUTPUT_EXPRESSION_PENALTY = 1
ORPHAN_GROB_PENALTY = 1
-inspect_max_count = 0
+options = None
def shorten_string (s):
threshold = 15
return ''
class MidiFileLink (FileLink):
+ def get_midi (self, f):
+ s = open (f).read ()
+ s = re.sub ('LilyPond [0-9.]+', '', s)
+ return s
+
def __init__ (self, f1, f2):
self.files = (f1, f2)
- print 'reading', f1
- s1 = open (self.files[0]).read ()
- print 'reading', f2
- s2 = open (self.files[1]).read ()
-
+ s1 = self.get_midi (self.files[0])
+ s2 = self.get_midi (self.files[1])
+
self.same = (s1 == s2)
def name (self):
if f.endswith ('.png'):
png_linked[oldnew].append (f)
-
- for (old,new) in zip (png_linked[0], png_linked[1]):
- compare_png_images (old, new, dest_dir)
-
+
+ if options.compare_images:
+ for (old,new) in zip (png_linked[0], png_linked[1]):
+ compare_png_images (old, new, dest_dir)
+
def html_record_string (self, old_dir, new_dir):
def img_cell (ly, img, name):
if not name:
html_2 = self.base_names[1] + '.html'
name = self.original_name
+
+ cell_1 = cell (self.base_names[0], name)
+ cell_2 = cell (self.base_names[1], name)
+ if options.compare_images:
+ cell_2 = cell_2.replace ('.png', '.compare.jpeg')
html_entry = '''
<tr>
%s
%s
</tr>
-''' % (self.distance (), html_2,
- cell (self.base_names[0], name),
- cell (self.base_names[1], name).replace ('.png', '.compare.jpeg'))
+''' % (self.distance (), html_2, cell_1, cell_2)
return html_entry
self.added += [(dir2, m) for m in m2]
for p in paired:
- if (inspect_max_count
- and len (self.file_links) > inspect_max_count):
+ if (options.max_count
+ and len (self.file_links) > options.max_count):
continue
type="float",
help='threshold for geometric distance')
+ p.add_option ('--no-compare-images',
+ dest="compare_images",
+ default=True,
+ action="store_false",
+ help="Don't run graphical comparisons")
p.add_option ('-o', '--output-dir',
dest="output_dir",
type="string",
help='where to put the test results [tree2/compare-tree1tree2]')
+ global options
(options, a) = p.parse_args ()
if options.run_test:
p.print_usage()
sys.exit (2)
- global inspect_max_count
- inspect_max_count = options.max_count
-
name = options.output_dir
if not name:
name = a[0].replace ('/', '')
make$mc install to install LilyPond
make$mc help to see all possible targets
+Edit local.make for local Makefile overrides.
+
+
EOF
+
+touch local.make
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)
{
operator << (ostream &, Rational);
#endif
-const Rational infinity_rat = INT_MAX;
+const Rational infinity_rat (INT_MAX);
#endif // RATIONAL_HH
normalize ();
}
-static inline
-int gcd (int a, int b)
+Rational::Rational (int n)
{
- int t;
- while ((t = a % b))
- {
- a = b;
- b = t;
- }
- return b;
+ sign_ = ::sign (n);
+ num_ = ::abs (n);
+ den_ = 1;
}
+
void
Rational::set_infinite (int s)
{
return r;
}
+
+/*
+ copy & paste from scm_gcd (GUILE).
+ */
+static int
+gcd (long u, long v)
+{
+ long result = 0;
+ if (u == 0)
+ result = v;
+ else if (v == 0)
+ result = u;
+ else
+ {
+ long k = 1;
+ long t;
+ /* Determine a common factor 2^k */
+ while (!(1 & (u | v)))
+ {
+ k <<= 1;
+ u >>= 1;
+ v >>= 1;
+ }
+ /* Now, any factor 2^n can be eliminated */
+ if (u & 1)
+ t = -v;
+ else
+ {
+ t = u;
+ b3:
+ t = t >> 1;
+ }
+ if (!(1 & t))
+ goto b3;
+ if (t > 0)
+ u = t;
+ else
+ v = -t;
+ t = u - v;
+ if (t != 0)
+ goto b3;
+ result = u * k;
+ }
+
+ return result;
+}
+
+
void
Rational::normalize ()
{
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
--- /dev/null
+depth = ../..
+
+STEPMAKE_TEMPLATES=documentation texinfo tex
+LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc
+
+include $(depth)/make/stepmake.make
+TITLE=LilyPond MIDI Tests
+
--- /dev/null
+
+\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 {}
+}
--- /dev/null
+\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 { }
+}
+
--- /dev/null
+\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 {}
+ }
--- /dev/null
+
+\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 { }
+}
+
--- /dev/null
+\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 { }
+}
+
+
--- /dev/null
+\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)
+ }
+ }
+}
+
+
--- /dev/null
+\header
+{
+ texidoc = "should deliver f' in MIDI"
+}
+\version "2.10.5"
+
+\score {
+ {
+ \transposition f
+ c''
+ }
+ \midi{}
+ \layout{}
+}
+++ /dev/null
-
-\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 {}
-}
+++ /dev/null
-#(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 { }
-}
-
+++ /dev/null
-\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 {}
- }
+++ /dev/null
-
-\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 { }
-}
-
+++ /dev/null
-#(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 { }
-}
-
+++ /dev/null
-#(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 { }
-}
-
-
+++ /dev/null
-#(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)
- }
- }
-
-
-}
-
-
--- /dev/null
+\version "2.10.0"
+\header {
+ texidoc = "@cindex Chord Names German
+The english naming of chords (default) can be changed to german
+(@code{\germanChords} replaces B and Bes to H and B), semi-german
+(@code{\semiGermanChords} replaces B and Bes to H and Bb), italian
+(@code{\italianChords} uses Do Re Mi Fa Sol La Si), or french
+(@code{\frenchChords} replaces Re to Ré).
+
+" }
+
+scm = \chordmode {
+ e1/d c:m
+ % c/c cis/cis
+ % yeah, we get the idea. -hwn
+
+ % cisis/cisis ces/ces ceses/ceses
+ b/b bis/bis bes/bes
+ % beses/beses
+}
+
+
+\layout {
+ ragged-right = ##t
+ \context {\ChordNames \consists Instrument_name_engraver }
+}
+
+<<
+ \new ChordNames {
+ \set instrumentName = #"default"
+ \scm
+ }
+ \new ChordNames {
+ \set instrumentName = #"german"
+ \germanChords \scm }
+ \new ChordNames {
+ \set instrumentName = #"semi-german"
+ \semiGermanChords \scm }
+ \new ChordNames {
+ \set instrumentName = #"italian"
+ \italianChords \scm }
+ \new ChordNames {
+ \set instrumentName = #"french"
+ \frenchChords \scm }
+
+ \context Voice { \scm }
+>>
}
\layout {
ragged-right = ##t
- \context { \Staff
- \consists "Measure_grouping_engraver"
- }
+ \context {
+ \Staff
+ \consists "Measure_grouping_engraver"
+ }
}
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
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;
}
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)
{
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;
}
}
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;
}
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);
"(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);
}
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))
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_;
};
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));
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);
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));
Stream_event *unsmob_stream_event (SCM);
DECLARE_TYPE_P (Stream_event);
+SCM ly_event_deep_copy (SCM);
#endif /* STREAM_EVENT_HH */
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);
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);
-/* Appendable list L: the cdr contains the list, the car the last cons
- in the list. */
-SCM
-appendable_list ()
-{
- SCM s = scm_cons (SCM_EOL, SCM_EOL);
- scm_set_car_x (s, s);
-
- return s;
-}
-
-void
-appendable_list_append (SCM l, SCM elt)
-{
- SCM newcons = scm_cons (elt, SCM_EOL);
-
- scm_set_cdr_x (scm_car (l), newcons);
- scm_set_car_x (l, newcons);
-}
-
string
print_scm_val (SCM val)
}
-static int
-scm_default_compare (void const *a, void const *b)
-{
- SCM pa = *(SCM *) a;
- SCM pb = *(SCM *) b;
- if (pa == pb)
- return 0;
- return pa < pb ? -1 : 1;
-}
-
-/* Modify LST in place: qsort it.
-
-FIXME: unused, junk? */
-SCM
-ly_list_qsort_uniq_x (SCM lst)
-{
- int len = scm_ilength (lst);
- SCM *arr = new SCM[len];
- int k = 0;
- for (SCM s = lst; SCM_NNULLP (s); s = scm_cdr (s))
- arr[k++] = scm_car (s);
-
- assert (k == len);
- qsort (arr, len, sizeof (SCM), &scm_default_compare);
-
- SCM *tail = &lst;
- for (int i = 0; i < len; i++)
- if (!i || arr[i] != arr[i - 1])
- {
- SCM_SETCAR (*tail, arr[i]);
- tail = SCM_CDRLOC (*tail);
- }
-
- *tail = SCM_EOL;
- delete[] arr;
-
- return lst;
-}
-
/* Split list at member s, removing s.
Return (BEFORE . AFTER) */
SCM
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;
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
}
/*
-TODO: make transposition non-destructive
+ This mutates alist. Hence, make sure that it is not changed
*/
SCM
transpose_mutable (SCM alist, Pitch delta)
{
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 ())
{
}
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);
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?")
{
{
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)
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}.")
Rational FLAT_ALTERATION (-1, 2);
Rational SHARP_ALTERATION (1, 2);
+
+Pitch
+Pitch::negated () const
+{
+ return pitch_interval (*this, Pitch ());
+}
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_);
"\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 ();
#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,
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, "
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;
}
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.
for (vsize i = 0; i < end_slurs_.size (); i++)
- announce_end_grob (end_slurs_[i], SCM_EOL);
+ {
+ Spanner * s = dynamic_cast<Spanner*> (end_slurs_[i]);
+ if (!s->get_bound (RIGHT))
+ s->set_bound (RIGHT, unsmob_grob (get_property ("currentMusicalColumn")));
+ announce_end_grob (s, SCM_EOL);
+ }
end_slurs_.clear ();
events_[START] = events_[STOP] = 0;
}
"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 ();
}
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;
+}
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 *
"dash-period "
"details "
"direction "
+ "head-direction "
"line-thickness "
"quant-score "
"staff-position "
(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?)
$(outdir)/lilypond/index.html: $(outdir)/lilypond.nexi doc-po
mkdir -p $(dir $@)
-$(MAKEINFO) -I$(outdir) --output=$(outdir)/lilypond --css-include=$(top-src-dir)/Documentation/texinfo.css --html $<
- find $(outdir) -name '*.html' | xargs grep -L 'UNTRANSLATED NODE: IGNORE ME' | xargs $(PYTHON) $(buildscript-dir)/html-gettext.py $(buildscript-dir) $(top-src-dir)/Documentation/po/$(outdir) $(ISOLANG)
+ find $(outdir) -name '*.html' | xargs grep -L 'UNTRANSLATED NODE: IGNORE ME' | xargs $(PYTHON) $(buildscript-dir)/html-gettext.py $(buildscript-dir) $(top-build-dir)/Documentation/po/$(outdir) $(ISOLANG)
$(outdir)/lilypond.html: $(outdir)/lilypond.nexi
-$(MAKEINFO) -I$(outdir) --output=$@ --css-include=$(top-src-dir)/Documentation/texinfo.css --html --no-split --no-headers $<
ANTI_ALIAS_FACTOR=2
LILYPOND_JOBS=$(if $(CPU_COUNT),-djob-count=$(CPU_COUNT),)
LILYPOND_BOOK_LILYPOND_FLAGS=--backend=eps --formats=ps,png,pdf $(LILYPOND_JOBS) -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -dcheck-internal-types -ddump-signatures -danti-alias-factor=$(ANTI_ALIAS_FACTOR)
-
-LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) $(LILYPOND_BOOK_LILYPOND_FLAGS)"
+LILYPOND_BOOK_VERBOSE = --verbose
+LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) $(LILYPOND_BOOK_LILYPOND_FLAGS)" $(LILYPOND_BOOK_VERBOSE)
TEXINPUTS=$(top-src-dir)/tex/::
export TEXINPUTS
$(outdir)/%.latex: %.doc
- $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --verbose $(LILYPOND_BOOK_FLAGS) $<
+ $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) $(LILYPOND_BOOK_FLAGS) $<
# don't do ``cd $(outdir)'', and assume that $(outdir)/.. is the src dir.
# it is not, for --srcdir builds
$(outdir)/%.texi: %.tely
rm -f $$(grep -LF '% eof' $(outdir)/lily-*systems.*tex 2>/dev/null)
- $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) $<
+ $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) $(LILYPOND_BOOK_FLAGS) $<
$(outdir)/%.texi: $(outdir)/%.tely
rm -f $$(grep -LF '% eof' $(outdir)/lily-*systems.*tex 2>/dev/null)
- $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) $<
+ $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) $(LILYPOND_BOOK_FLAGS) $<
#
# DON'T REMOVE SOURCE FILES, otherwise the .TEXI ALWAYS OUT OF DATE.
# rm -f $<
# for plain info doco: don't run lilypond
$(outdir)/%.nexi: %.tely
rm -f $(outdir)/$*.texi
- $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) --process='true' $<
+ $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) $(LILYPOND_BOOK_FLAGS) --process='true' $<
mv -f $(outdir)/$*.texinfo $@ 2>/dev/null || mv -f $(outdir)/$*.texi $@
$(outdir)/%.info: $(outdir)/%.nexi
-local-WWW: $(outdir)/$(NAME).html $(outdir)/$(NAME).pdf
+local-WWW: $(outdir)/collated-files.html $(outdir)/collated-files.pdf
#.PRECIOUS: $(outdir)/$(NAME).texi
Entry point for the parser.
"
- (display modifications)
(let* ((flat-mods (flatten-list modifications))
(base-chord (stack-thirds (ly:make-pitch 0 4 0) the-canonical-chord))
(complete-chord '())
0.3
0.6)
(make-musicglyph-markup
- (string-append "accidentals." (number->string alteration))))))
+ (format "accidentals.~a"
+ (inexact->exact (* 4 alteration)))))))
(define (accidental->markup alteration)
"Return accidental markup for ALTERATION."
(vector-ref #("C" "D" "E" "F" "G" "A" "B") (ly:pitch-notename pitch)))
(accidental->markup (ly:pitch-alteration pitch)))))
+(define (pitch-alteration-semitones pitch)
+ (inexact->exact (round (* (ly:pitch-alteration pitch) 2))))
+
(define-safe-public ((chord-name->german-markup B-instead-of-Bb) pitch)
"Return pitch markup for PITCH, using german note names.
If B-instead-of-Bb is set to #t real german names are returned.
Otherwise semi-german names (with Bb and below keeping the british names)
"
(let* ((name (ly:pitch-notename pitch))
- (alt (ly:pitch-alteration pitch))
- (n-a (if (member (cons name alt) `((6 . ,FLAT) (6 . ,DOUBLE-FLAT)))
- (cons 7 (+ (if B-instead-of-Bb SEMI-TONE 0) alt))
- (cons name alt))))
+ (alt-semitones (pitch-alteration-semitones pitch))
+ (n-a (if (member (cons name alt-semitones) `((6 . -1) (6 . -2)))
+ (cons 7 (+ (if B-instead-of-Bb 1 0) alt-semitones))
+ (cons name alt-semitones))))
(make-line-markup
(list
(make-simple-markup
(vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a)))
(make-normal-size-super-markup
- (accidental->markup (cdr n-a)))))))
+ (accidental->markup (/ (cdr n-a) 2)))))))
(define-safe-public (note-name->german-markup pitch)
(let* ((name (ly:pitch-notename pitch))
- (alt (ly:pitch-alteration pitch))
- (n-a (if (member (cons name alt) `((6 . ,FLAT) (6 . ,DOUBLE-FLAT)))
- (cons 7 (+ SEMI-TONE alt))
- (cons name alt))))
+ (alt-semitones (pitch-alteration-semitones pitch))
+ (n-a (if (member (cons name alt-semitones) `((6 . -1) (6 . -2)))
+ (cons 7 (+ 1 alt-semitones))
+ (cons name alt-semitones))))
(make-line-markup
(list
(string-append
(list-ref '("c" "d" "e" "f" "g" "a" "h" "b") (car n-a))
(if (or (equal? (car n-a) 2) (equal? (car n-a) 5))
- (list-ref '( "ses" "s" "" "is" "isis") (+ 2 (/ (cdr n-a) 2)))
- (list-ref '("eses" "es" "" "is" "isis") (+ 2 (/ (cdr n-a) 2)))))))))
+ (list-ref '( "ses" "s" "" "is" "isis") (+ 2 (cdr n-a)))
+ (list-ref '("eses" "es" "" "is" "isis") (+ 2 (cdr n-a)))))))))
(define-public ((chord-name->italian-markup re-with-eacute) pitch)
"Return pitch markup for PITCH, using italian/french note names.
(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.")
"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"
(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))
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)
+ ))
+
+ ))))
+
+
+
;;;;;;;;;;;;;;;;
(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))
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?