Beam 0
Change_iterator 0
Chord 0
-Chord_iterator 1
+Chord_iterator 0
Clef_item 0
Col_configuration 0
Colinfo 0
Colinfo 0
Collision 0
-Engraver 1
-Engraver_group_engraver 1
+Engraver 0
+Engraver_group_engraver 0
Group_change_req 0
Head_column 0
Idealspacing 0
Midi_def 0
Mixed_qp 0
Music 0
-Music_iterator 1
+Music_iterator 0
My_lily_lexer 1
Note_head 0
Note_performer 0
lily/midi-*, mi2mu/*, parts flower/string*.cc,
make/*.make, */Makefile parts of
Documentation/mudela.pod, lib/*source-file*,
- lib/duration.cc, lib/source, flower/*{list,cursor}*,
+ lib/duration.cc, lib/source*, flower/*{list,cursor}*,
lily/rest-collision*, conflily, cygnus w32 stuff,
- lily/*perf*
+ lily/*perf*, some input files
and corresponding header files.
+\bo Anthony Fok <foka@gpu.srv.ualberta.ca>, debian
package: make/debian/*
+ +\bo Franc,ois Pinard <pinard@iro.umontreal.ca>, Neil
+ Jerram <nj104@cus.cam.ac.uk>. Documentation/Vocab*
+
Your name could be here! If you want to help, then take a
look at the SMALLISH PROJECTS section of in the file _\bT_\bO_\bD_\bO.
Some do not involve coding C++
+ [And of course, J.S.Bach, F.Schubert, T. Merula and
+ W.A.Mozart]
-
-
-
-
-
-12/Aug/97 LilyPond 0.1.10 1
+30/Aug/97 LilyPond 0.1.11 1
That's a nice thought, Wendy. I've got a few too, to spread
the credits a bit (Again, no particular order) Michelle, Illushka,
Ruth, Eva, Fro/ydis, Monique, Noor, Sascha, Monique, Ilse, Monique,
-Eva, Roos, Judith, and, of course, Wendy!
+Eva, Roos, Judith, Tim, and, of course, Wendy!
JCN
lily/midi-*, mi2mu/*, parts flower/string*.cc, make/*.make, */Makefile
parts of Documentation/mudela.pod, lib/*source-file*, lib/duration.cc,
-lib/source, flower/*{list,cursor}*, lily/rest-collision*, conflily,
-cygnus w32 stuff, lily/*perf*
+lib/source*, flower/*{list,cursor}*, lily/rest-collision*, conflily,
+cygnus w32 stuff, lily/*perf*, some input files
and corresponding header files.
Anthony Fok <foka@gpu.srv.ualberta.ca>, debian package: make/debian/*
+=item *
+
+Franc,ois Pinard <pinard@iro.umontreal.ca>, Neil Jerram
+<nj104@cus.cam.ac.uk>. Documentation/Vocab*
+
=back
Your name could be here! If you want to help, then take a look at the
SMALLISH PROJECTS section of in the file F<TODO>. Some do not involve
coding C++
+
+[And of course, J.S.Bach, F.Schubert, T. Merula and W.A.Mozart]
gifs: $(addprefix $(outdir)/, $(giffiles))
-EXTRA_DISTFILES = $(XPMS) $(DOCFILES) $(wildcard Vocab*)
+EXTRA_DISTFILES = $(XPMS) $(DOCFILES) vocabulary-data vocabulary-forms.el
# don't do DVI files. They can only be made if lily is installed
do-doc: $(TEXTFILES)
gzip -c9 $< > $@
name-stem= $(notdir $(basename $<))
-$(outdir)/%.dvi: $(depth)/input/%.ly
+$(outdir)/%.dvi: $(depth)/input/%.ly $(depth)/VERSION
(cd $(outdir); \
lilypond -o $(name-stem) ../$< )
(cd $(outdir); \
+++ /dev/null
-# Musical vocabulary, correspondance from British.
-# Copyright (C) 1993 Free Software Foundation, Inc.
-# Neil Jerram <nj104@cus.cam.ac.uk>, 1993.
-
-British American
-
-breve double whole note
-crotchet quarter note
-crotchet rest quarter rest
-demisemiquaver thirty-second note
-demisemiquaver rest thirty-second rest
-hemidemisemiquaver sixty-fourth note
-hemidemisemiquaver rest sixty-fourth rest
-minim half note
-minim rest half rest
-quaver eighth note
-quaver rest eighth rest
-semibreve whole note
-semibreve rest whole rest
-semiquaver sixteenth note
-semiquaver rest sixteenth rest
+++ /dev/null
-# Musical vocabulary, correspondance from French.
-# Copyright (C) 1993 Free Software Foundation, Inc.
-# Francois Pinard <pinard@iro.umontreal.ca>, 1993.
-
-# Thanks to Neil Jerram <nj104@cus.cam.ac.uk>.
-
-French American
-
-accentuation accentuation
-accolade brace
-accord chord
-accord de neuvième dominante chord of the dominant ninth
-accord de septième dominante chord of the dominant seventh
-accord parfait majeur perfect major chord
-accord parfait mineur perfect minor chord
-alto alto
-altération accidentelle accident; accidental alteration
-altération essentielle essential alteration
-appogiature appoggiatura
-appogiature brève short appoggiatura
-appogiature double double appoggiatura
-appogiature longue long appoggiatura
-appogiature simple simple appoggiatura
-armature [de la clé] key signature
-armure [de la clé] key signature
-arpège arpeggio
-augmenté (intervalle) augmented (interval)
-bariton baritone
-barre de mesure bar line
-barre de reprise repeat
-basse bass
-blanche half note
-bâton de pause (arbitrary number of bars' rest)
-bâton de pause four-bar rest
-bâton de pause two-bar rest
-bécarre natural sign
-bémol flat
-cadence cadence
-cadence harmonique harmonic cadence
-cadence mélodique melodic cadence
-caractère character
-chaîne de trilles chain of trills
-chevron chevron
-chiffrage time signature
-chiffre inférieur lower number
-chiffre supérieur upper number
-chiffres indicateurs time signature
-clé clef
-clé d'octave octave line
-clé d'ut middle C clef
-clé de fa bass clef
-clé de sol treble clef
-comma comma
-comma enharmonique
-comma pythagoricien
-comma syntonique
-consonance consonant interval; consonance
-contralto contralto
-contre-temps contro-time
-contre-temps irrégulier irregular contro-time
-contre-temps régulier regular contro-time
-coulé slur
-courbe rythmique rythmic curve
-cresendo opening angular bracket
-croche eighth note
-decrescendo closing angular bracket
-degré [de la gamme] degree [of the scale]
-demi-pause half rest
-demi-soupir eighth rest
-demi-ton semitone
-demi-ton chromatique chromatic semitone
-demi-ton diatonique diatonic semitone
-diapason pitch pipe; tuning fork
-diminué (intervalle) diminished (interval)
-dissonance dissonant interval; dissonance
-dièse sharp
-do C
-do central middle C
-doigté
-doigté de pédale
-dominante dominant
-double barre double bar line
-double bémol double flat
-double croche sixteenth note
-double dièse double sharp
-double triolet double triplet
-duolet duplet
-durée duration
-échelle d'octave octave line
-échelle musicale Musical Ladder
-enharmonie enharmony
-espace space
-extension d'intervalle extension of interval
-fa F
-figure de note kind of note
-figure de silence kind of rest
-fioriture cadenza
-forme du mode mineur ancien ancient form (diatonic minor scale)
-forme harmonique harmonic form (diatonic minor scale)
-forme mélodique melodic form (diatonic minor scale)
-gamme scale
-gamme chromatique chromatic scale
-gamme diatonique majeure diatonic major scale
-gamme diatonique mineure diatonic minor scale
-gammes enharmoniques enharmonic scales
-gammes relatives relative scales
-genre chromatique chromatic type
-genre diatonique diatonic type
-genre enharmonique enharmonic type
-groupe irrégulier irregular group
-grupetto turn; gruppetto
-hauteur pitch
-huitième de soupir thirty-second rest
-incise motive
-indication de pédale
-indication métronomique metronomic indication
-intervalle interval
-intervalle ascendant ascending interval
-intervalle composé compound interval
-intervalle descendant descending interval
-intervalle harmonique harmonic interval
-intervalle simple simple interval
-intervalles enharmoniques enharmonic intervals
-juste (intervalle) perfect (interval)
-la A
-liaison tie
-liaison rythmique legato curve
-ligne line
-ligne supplémentaire ledger line
-majeur (intervalle) major (interval)
-membre de phrase phrase member
-mesure bar; measure
-mesure artificielle artificial measure
-mesure composée compound measure
-mesure incomplète incomplete measure
-mesure irrégulière irregular measure
-mesure simple simple measure
-mezzo-soprano mezzo-soprano
-mi E
-mineur (intervalle) minor (interval)
-mode mode
-mode ecclésiastique
-mode majeur major mode
-mode mineur minor mode
-modulation modulation
-mordant mordent
-mouvement tempo; movement
-mouvement conjoint conjunct movement
-mouvement disjoint disjunct movement
-mouvement lent slow tempo
-mouvement modéré moderate tempo
-mouvement rapide fast tempo
-médiante mediant
-métronome metronome
-noire quarter note
-note note
-note doublement pointée double dotted note
-note modale modal note
-note pointée dotted note
-note tonale tonal note
-notes enharmoniques enharmonic notes
-nuance shading
-octave octave
-ornement embellishment; accessory
-partition score
-pause whole rest
-phrase phrase
-phrasé phrasing
-pizzicato dash over/below
-point dot
-point d'orgue pause
-point et liaison combinés dot and curved line combined
-pointillés
-portamento underline over/below
-portée staff
-portées staves
-quadruple croche sixty-fourth note
-quart de soupir sixteenth rest
-quarte fourth
-quartolet quadruplet
-quinte fifth
-registre register
-renversement d'intervalle inversion of interval
-renvoi return sign
-respiration artificial rest
-ronde whole note
-rythme rythm
-ré D
-seconde second
-seizième de soupir sixty-fourth rest
-sensible leading note
-septième seventh
-sextolet sextuplet
-si B
-signes indicateurs de nuance shading signs
-silence rest
-sixain sextuplet
-sixte sixth
-sol G
-soprano soprano
-soupir quarter rest
-sous-dominante subdominant
-sous-tonique subtonic
-staccato dot over/below
-sus-dominante superdominant
-sus-tonique supertonic
-syncope syncopation; upbeat
-syncope irrégulière irregular syncopation
-syncope régulière regular syncopation
-temps beat
-temps binaire binary beat
-temps faible weak beat
-temps fort strong beat
-temps ternaire ternary beat
-tempérament mésotonique meantone tuning
-tempérament égal tempered tuning
-tierce third
-ton tone
-tonalité tonality
-tonique tonic
-tons relatifs relative scales
-tons voisins adjacent keys
-transposition transposition
-transposition chromatique chromatic transposition
-transposition enharmonique enharmonic transposition
-trille trill; shake
-trille double double trill
-triolet triplet
-triple croche thirty-second note
-triton tritone
-ténor tenor
-tétracorde tetrachord
-unisson unison
-unité de mesure unit of measure
-unité de temps unit of beat
-ut C
-voix voice
+++ /dev/null
-# Musical vocabulary, correspondance from German.
-# Copyright (C) 1993 Free Software Foundation, Inc.
-# Francois Pinard <pinard@iro.umontreal.ca>, 1993.
-
-German American
-
-B B flat
-H B
=head1 DESCRIPTION
-Random ranting about the GNU Music project.
-
-=head2 History of the GNU Music Project
-
-Please note that this all happened when I wasn't around yet. If you
-think that I am a biased, unfair, predisposed hypocrite, then don't
-bother flaming me; I already know that.
-
-The GNU Music project is a project which aims to create free software
-for music printing and composing. It was started in november '92 by a
-core team of four members (Bryan Ford <baford@cs.utah.edu>, David Linn
-<drl@vuse.vanderbilt.edu>, Francois Pinard <pinard@iro.umontreal.ca>,
-Neil Jerram <nj104@cus.cam.ac.uk> and in January '93 Robert Strandh
-<Robert.Strandh@labri.u-bordeaux.fr> joined.
-
-After serious disputes with Robert Strandh
-<Robert.Strandh@labri.u-bordeaux.fr> and the FSF staff in '94, the
-project core team got divided. The development efforts of GMP stopped.
-
-Independently, I (HWN) started LilyPond. When I showed it to
-RMS, he was very enthousiastic about having LilyPond in the GNU
-project. I subsequently learned about the GNU Music project, and
-contacted them.
-
-What was left of the GMP (Robert Strandh) and us, LilyPond people,
-agreed that cooperation would be desirable. Although merging of both
-efforts was and is technically infeasible, we did decide that LilyPond
-should also be part of the GNU Music project.
-
-Only later did I discover the previous quarrels about the GMP-"take
-1". To show that I am aware of the history, and to make sure nobody
-gets me wrong or is angry at me because I stole a project or a
-project's name, I wrote this note.
-
-In summary, LilyPond is now the only substantial embodiment of the GNU Music
-Project, and it is part of the GNU project.
-
-For completeness' sake, I will mention the other efforts here:
-
-=over 4
-
-=item G Sharp, http://dept-info.labri.u-bordeaux.fr/~strandh/Gsharp
-
-An alpha version notation editor for X in Scheme. Source available on
-request.
-
-=item GNU music,
-
-An alpha version of a music editing system with Musictex
-output. Pretest versions of GNU Music (v0.3) can still be obtained from
-Francois Pinard.
-
-=back
-
-This history note is probably biased in some way, because I wrote it.
-The rest of this document is also entirely mine, and is not meant to
-reflect anyone else's opinion.
+Random ranting about the GNU Music project.
=head1 GOAL
=back
+
+
+=head1 HISTORY
+
+
+Please note that this all happened when I wasn't around yet. If you
+think that I am a biased, unfair, predisposed hypocrite, then don't
+bother flaming me; I already know that.
+
+The GNU Music project is a project which aims to create free software
+for music printing and composing. It was started in november '92 by a
+core team of four members (Bryan Ford <baford@cs.utah.edu>, David Linn
+<drl@vuse.vanderbilt.edu>, Francois Pinard <pinard@iro.umontreal.ca>,
+Neil Jerram <nj104@cus.cam.ac.uk> and in January '93 Robert Strandh
+<Robert.Strandh@labri.u-bordeaux.fr> joined.
+
+After serious disputes with Robert Strandh
+<Robert.Strandh@labri.u-bordeaux.fr> and the FSF staff in '94, the
+project core team got divided. The development efforts of GMP stopped.
+
+Independently, I (HWN) started LilyPond. When I showed it to
+RMS, he was very enthousiastic about having LilyPond in the GNU
+project. I subsequently learned about the GNU Music project, and
+contacted them.
+
+What was left of the GMP (Robert Strandh) and us, LilyPond people,
+agreed that cooperation would be desirable. Although merging of both
+efforts was and is technically infeasible, we did decide that LilyPond
+should also be part of the GNU Music project.
+
+Only later did I discover the previous quarrels about the GMP-"take
+1". To show that I am aware of the history, and to make sure nobody
+gets me wrong or is angry at me because I stole a project or a
+project's name, I wrote this note.
+
+In summary, LilyPond is now the only substantial embodiment of the GNU Music
+Project, and it is part of the GNU project.
+
+For completeness' sake, I will mention the other efforts here:
+
+=over 4
+
+=item G Sharp, http://dept-info.labri.u-bordeaux.fr/~strandh/Gsharp
+
+An alpha version notation editor for X in Scheme. Source available on
+request.
+
+=item GNU music,
+
+An alpha version of a music editing system with Musictex
+output. Pretest versions of GNU Music (v0.3) can still be obtained from
+Francois Pinard.
+
+=back
+
+This history note is probably biased in some way, because I wrote it.
+The rest of this document is also entirely mine, and is not meant to
+reflect anyone else's opinion.
+
</a
>
+=back
=head2 Why: Background Information
=item http://www.ssc.com/linux/
-The Number One Free OS-Kernel: Linux
+The Number One Free Operating System Kernel: Linux
=item http://www.bright.net/~dlphilp/linux_soundapps.html
=item http://www.emry.net/webwatcher/
-The Linux webwatcher.
+The Linux webwatcher: this site logs changes in important Linux sites.
=item http://www.pbm.com/~lindahl/ravenscroft/modern
\section{Overview}
+
Mudela is a language for specifying music. LilyPond is a
-program which converts such a specification into formatted sheet
+program which converts such a specification into formatted sheet
music, or MIDI output.
Please note that some examples not only demonstrate features but also
\end{mudela}
-LilyPond is designed to handle complicated stuff
-automatically. Expertise should be in the program, not in the user.
+LilyPond is designed to handle complicated stuff automatically.
+Expertise should be in the program, not in the user.
-The following example shows how multiple voice on the same staff are
+The following example shows how multiple voices on the same staff are
handled graciously (well, somewhat). If the noteheads of different
-voices collide, they are moved horizontally. The same goes for the rests.
+voices collide, they are moved horizontally. Rests are moved
+vertically.
\begin[verbatim]{mudela}
two_voice = \melodic
--- /dev/null
+Francais:US English:Deutsch:UK English:Nederlands:Italiaans
+accentuation:accentuation:::accent:
+accolade:brace::::
+accord:chord:::akkoord:
+accord de neuvième dominante:chord of the dominant ninth:::dominant akkoord:
+accord de septième dominante:chord of the dominant seventh:::septiem akkoord:
+accord parfait majeur:perfect major chord::::
+accord parfait mineur:perfect minor chord::::
+alto:alto:::alt:
+altération accidentelle:accident; accidental alteration:::toevallig teken:
+altération essentielle:essential alteration::::
+appogiature:appoggiatura::::
+appogiature brève:short appoggiatura::::
+appogiature double:double appoggiatura::::
+appogiature longue:long appoggiatura::::
+appogiature simple:simple appoggiatura::::
+armature [de la clé]:key signature:::toonsoort (voortekens):
+armure [de la clé]:key signature::::
+arpège:arpeggio::::
+augmenté (intervalle):augmented (interval)::::
+bariton:baritone::::
+barre de mesure:bar line::::
+barre de reprise:repeat::::
+basse:bass::::
+blanche:half note::::
+bâton de pause:(arbitrary number of bars' rest)::::
+bâton de pause:four-bar rest::::
+bâton de pause:two-bar rest::::
+bécarre:natural sign:::herstellingsteken:
+bémol:flat:::mol:
+cadence:cadence::::
+cadence harmonique:harmonic cadence::::
+cadence mélodique:melodic cadence::::
+caractère:character::::
+chaîne de trilles:chain of trills::::
+chevron:chevron::::
+chiffrage (chiffres indicateurs):time signature:::maatsoort:
+chiffre inférieur:lower number::::
+chiffre supérieur:upper number::::
+clé:clef:::sleutel:
+clé d'octave:octave line::::
+clé d'ut:middle C clef:::C sleutel:
+clé de fa:bass clef::::
+clé de sol:treble clef::::
+comma:comma::::
+comma enharmonique::::
+comma pythagoricien::::
+comma syntonique::::
+consonance:consonant interval; consonance:::consonant:
+contralto:contralto::::
+contre-temps:contro-time::::
+contre-temps irrégulier:irregular contro-time::::
+contre-temps régulier:regular contro-time::::
+coulé:slur:::binding, bindingsboog:
+courbe rythmique:rythmic curve::::
+cresendo:opening angular bracket::::
+croche:eighth note::::
+decrescendo:closing angular bracket::::
+degré [de la gamme]:degree [of the scale]::::
+demi-pause:half rest::::
+demi-soupir:eighth rest::::
+demi-ton:semitone::::
+demi-ton chromatique:chromatic semitone::::
+demi-ton diatonique:diatonic semitone::::
+diapason:pitch pipe; tuning fork::::
+diminué (intervalle):diminished (interval)::::
+dissonance:dissonant interval; dissonance::::
+dièse:sharp::::
+do:C::::
+do central:middle C:::::
+doigté:::::
+doigté de pédale:::::
+dominante:dominant::::
+double barre:double bar line::::
+double bémol:double flat::::
+double croche:sixteenth note::::
+double dièse:double sharp::::
+double triolet:double triplet::::
+duolet:duplet::::
+durée:duration::::
+échelle d'octave:octave line::::
+échelle musicale:Musical Ladder::::
+enharmonie:enharmony::::
+espace:space::::
+extension d'intervalle:extension of interval::::
+fa:F::::
+figure de note:kind of note::::
+figure de silence:kind of rest::::
+fioriture:cadenza::::
+forme du mode mineur ancien:ancient form (diatonic minor scale)::::
+forme harmonique:harmonic form (diatonic minor scale)::::
+forme mélodique:melodic form (diatonic minor scale)::::
+gamme:scale::::
+gamme chromatique:chromatic scale::::
+gamme diatonique majeure:diatonic major scale::::
+gamme diatonique mineure:diatonic minor scale::::
+gammes enharmoniques:enharmonic scales::::
+gammes relatives:relative scales::::
+genre chromatique:chromatic type::::
+genre diatonique:diatonic type::::
+genre enharmonique:enharmonic type::::
+groupe irrégulier:irregular group::::
+grupetto:turn; gruppetto::::
+hauteur:pitch::::
+huitième de soupir:thirty-second rest::::
+incise:motive::::
+indication de pédale::::
+indication métronomique:metronomic indication::::
+intervalle:interval::::
+intervalle ascendant:ascending interval::::
+intervalle composé:compound interval::::
+intervalle descendant:descending interval::::
+intervalle harmonique:harmonic interval::::
+intervalle simple:simple interval::::
+intervalles enharmoniques:enharmonic intervals::::
+juste (intervalle):perfect (interval)::::
+la:A::::
+liaison:tie::::
+liaison rythmique:legato curve::::
+ligne:line::::
+ligne supplémentaire:ledger line::::
+majeur (intervalle):major (interval)::::
+membre de phrase:phrase member::::
+mesure:bar; measure:::maat, maatstreep:
+mesure artificielle:artificial measure::::
+mesure composée:compound measure::::
+mesure incomplète:incomplete measure::::
+mesure irrégulière:irregular measure::::
+mesure simple:simple measure::::
+mezzo-soprano:mezzo-soprano::::
+mi:E::::
+mineur (intervalle):minor (interval)::::
+mode:mode::::
+mode ecclésiastique::::
+mode majeur:major mode::::
+mode mineur:minor mode::::
+modulation:modulation::::
+mordant:mordent::::
+mouvement:tempo; movement::::
+mouvement conjoint:conjunct movement::::
+mouvement disjoint:disjunct movement::::
+mouvement lent:slow tempo::::
+mouvement modéré:moderate tempo::::
+mouvement rapide:fast tempo::::
+médiante:mediant::::
+métronome:metronome::::
+noire:quarter note::::
+note:note::::
+note doublement pointée:double dotted note::::
+note modale:modal note::::
+note pointée:dotted note::::
+note tonale:tonal note::::
+notes enharmoniques:enharmonic notes::::
+nuance:shading::::
+octave:octave::::
+ornement:embellishment; accessory::::
+partition:score::::
+pause:whole rest::::
+phrase:phrase::::
+phrasé:phrasing::::
+pizzicato:dash over/below::::
+point:dot::::
+point d'orgue:pause::::
+point et liaison combinés:dot and curved line combined::::
+pointillés::::
+portamento:underline over/below::::
+portée:staff::::
+portées:staves::::
+quadruple croche:sixty-fourth note::::
+quart de soupir:sixteenth rest::::
+quarte:fourth::::
+quartolet:quadruplet::::
+quinte:fifth::::
+registre:register::::
+renversement d'intervalle:inversion of interval::::
+renvoi:return sign::::
+respiration:artificial rest::::
+:double whole note::breve:brevis:breve
+ronde:whole note::::
+rythme:rythm::::
+ré:D::::
+seconde:second::::
+seizième de soupir:sixty-fourth rest::::
+sensible:leading note::::
+septième:seventh::::
+sextolet:sextuplet::::
+si:B::::
+signes indicateurs de nuance:shading signs::::
+silence:rest::::
+sixain:sextuplet::::
+sixte:sixth::::
+sol:G::::
+soprano:soprano::::
+soupir:quarter rest::::
+sous-dominante:subdominant::::
+sous-tonique:subtonic::::
+staccato:dot over/below::::
+sus-dominante:superdominant::::
+sus-tonique:supertonic::::
+syncope:syncopation; upbeat::::
+syncope irrégulière:irregular syncopation::::
+syncope régulière:regular syncopation::::
+temps:beat::::
+temps binaire:binary beat::::
+temps faible:weak beat::::
+temps fort:strong beat::::
+temps ternaire:ternary beat::::
+tempérament mésotonique:meantone tuning::::
+tempérament égal:tempered tuning::::
+tierce:third::::
+ton:tone::::
+tonalité:tonality::::
+tonique:tonic::::
+tons relatifs:relative scales::::
+tons voisins:adjacent keys::::
+transposition:transposition::::
+transposition chromatique:chromatic transposition::::
+transposition enharmonique:enharmonic transposition::::
+trille:trill; shake::::
+trille double:double trill::::
+triolet:triplet::::
+triple croche:thirty-second note::::
+triton:tritone::::
+ténor:tenor::::
+tétracorde:tetrachord::::
+unisson:unison::::
+unité de mesure:unit of measure::::
+unité de temps:unit of beat::::
+ut:C::::
+voix:voice::::
+:quarter note::crotchet::
+:quarter rest::crotchet rest::
+:thirty-second note::demisemiquaver::
+:thirty-second rest::demisemiquaver rest::
+:sixty-fourth note::hemidemisemiquaver::
+:sixty-fourth rest::hemidemisemiquaver rest::
+:half note::minim::
+:half rest::minim rest::
+:eighth note::quaver::
+:eighth rest::quaver rest::
+:whole note::semibreve::
+:whole rest::semibreve rest::
+:sixteenth note::semiquaver::
+:sixteenth rest::semiquaver rest::
--- /dev/null
+; Musical vocabularies are Copyright (C) 1993 Free Software Foundation, Inc.
+; Francois Pinard <pinard@iro.umontreal.ca>,
+; Neil Jerram <nj104@cus.cam.ac.uk>.
+; Forms by Han-Wen Nienhuys
+
+(setq forms-file "vocabulary-data")
+(setq forms-number-of-fields 6)
+(setq forms-read-only nil) ; to make sure
+(setq forms-field-sep ":")
+(setq forms-multi-line nil)
+
+(setq forms-format-list
+ (list
+ "*** Musical vocabulary ***\n"
+ "\nItalian: " 6
+ "\nFrench: " 1
+ "\nUS English: " 2
+ "\nGerman: " 3
+ "\nBritish English: " 4
+ "\nDutch: " 5
+ ))
-8/Aug/97 LilyPond 0.1.10 1
+8/Aug/97 LilyPond 0.1.11 1
-8/Aug/97 LilyPond 0.1.10 2
+8/Aug/97 LilyPond 0.1.11 2
-8/Aug/97 LilyPond 0.1.10 3
+8/Aug/97 LilyPond 0.1.11 3
-8/Aug/97 LilyPond 0.1.10 4
+8/Aug/97 LilyPond 0.1.11 4
-8/Aug/97 LilyPond 0.1.10 5
+8/Aug/97 LilyPond 0.1.11 5
-8/Aug/97 LilyPond 0.1.10 6
+8/Aug/97 LilyPond 0.1.11 6
+
+pl 11
+ - forms for Musical vocabulary
+ - ignore \r for windows
+ - Now paper{score,def} & midi{def,score} derived of class
+Music_output[_def]. Score is almost empty.
+ - Engraver hacking:
+ * junk Text_engraver
+ * Timing_engraver
+ * barnumber now really counts the number of bars
+ * Separated Stem_engraver and Beam_engraver
+ * junk Stem_beam_engraver
+ * no need for Stem_reqs
+ - use Direction = {LEFT, RIGHT, UP, DOWN} iso. -1, 1 throughout source
+ - ties and slurs with Drul_array
+ - junked Spanner_elem_group
+ - bf: w32 fixes
+ - Spanner now spans items.
+ - more GNITting ( bla ) -> (bla), indentation
+ - Drul_array
+ - Paper_column now is derived of Horizontal_group_item. Items
+are no longer hardwired into a Paper_column
+ - bf: stdin input
+ - PCol -> Paper_column
+ - Wtk-i, fugue1, prelude1 (SR)
+
+*******
+aug 21
pl 10
- bf: init pending_indent_i_
- output header to TeX file. Who wants to write TeX to make it work?
-This is the toplevel README to LilyPond
+This is the toplevel README to LilyPond -*-Text-*-
GNU LilyPond which converts music definition files into visual or
without -O2, but with purify, it dumps core)
+Linux (intel)
+LilyPond occasionally crashes while parsing the initialisation files.
+This is a very obscure bug, and usually entering the commandline
+differently "fixes" it.
+
+ lilypond input.ly
+
+and
+
+ lilypond -I. ./input.ly
+
+makes a difference
+
+Typical stacktrace:
+
+ SIGSEGV
+ __libc_malloc (bytes=16384)
+ ?? ()
+ yyFlexLexer::yy_create_buffer ()
+ Includable_lexer::new_input (this=0x8209a00, s={strh_ = {
+ :
+
+
+I get bitten by this every once in a while, and I am very interested
+in hints what might be wrong.
Most of the items are marked in the code as well, with full explanation.
grep for TODO and ugh/ugr
+ * check out egcs
+
+ * give Items/Spanners access to unbroken originals
+
3RD PARTY BUGS:
* ICE: spring-spacer::calcideal()
- have make dist produce tarball in out/ directory.
- Use Automake
- shared lib on Solaris too.
- - check libtool, automake
+ - check libtool
- generate stuff in out/default, out/sun5-irix etc iso out/
and out-sun5/
+ * Add mudela-output to Rosegarden.
- * Add mudela to Rosegarden.
-
- * a musical dictionary. See Documentation/Vocab*
- - other languages
- - emacs forms mode for editing it.
-
+ * a musical dictionary. See Documentation/vocabulary-*, other
+languages:
+ - italian
+ - german
+ - dutch
+ - swedish
+ .. ?
* chords
- guitar chords
- MIDI output?
- typesetting
- * integrate midi-elts from mi2mu and lily
+ * integrate midi-elts from mi2mu and lily?
* Debug logs:
- derive lily_stream, Dstream, texstream from ostream?
- adapt for multiple font sizes.
- make separate class for Grace_*_engravers
(which is at Voice_gravs level)
- - move stem, beam, slur into baseclass to adapt for (fixed
- size) grace notes.
+ - make encapsulated spacing problems.
* accidentals per Voice_group
- NIFF ?
- Common Music Notation
- PostScript output (esp. Beams, Slurs, etc)
- - Move PScore, Items, Spanners etc. into libmutype.a
+ - Move all Score_elems, into libmutype.a
* Documentation
- rewrite : make a metafont iso font
* Font support:
- - update 20 pt table
- mixed fontsizes
* lines:
- redo Notehead to allow digits as heads
- add a \tablature {} lexer mode for easy entering
-
* should adjust stemlength for flag number.
* breaking:
* Rhythmic staff.
+ * Baroque superstaff
+
SEVERELY LACKING:
* SPEED!
* lyric in staff (sharpsharp in staff, text below)
- * replace Score_elem member access by get()/set() methods, to enable
- future embedded code.
-
* write Dynamic_line (to group dynamics horizontally)
* write Rest_collision
- String hash
- Pointer hash
-
* binsearch/hash for identifiers
* stafftypes: voice names/ instrument names.
* textspanner: center position
-
* Brackets
- * Scricts:
+ * Scripts:
- stack scripts in chords:
% fingering: footing:
< a-4 c-2 g-1 > < c-\ltoe e-\lheel >
% --|--- --|---
(where "to" is a tiny bow)
-DOC
- * all errors
-
- * hacking-HOWTO
-
-FUTURE
-
* auxilliary file for caching info.
* Text_crescendo
* volta
+DOC
+ * all errors
+
+ * hacking-HOWTO
+
IDEAS
* scoping in Lexer: do general id- assignments in mudela.
* move towards incremental algorithms.
- * design meta-language like TeX and Metafont
+ * far fetched language ideas
+ - design meta-language like TeX and Metafont
+ - programming/macros input
* Global type registration.
if ( t <= get_type( q ))
..
-
- * virtualise PCols to make encapsulated spacing problems
-
- * don't count bars which are not on first beat.
-
* naming of Voice_group/Voice
* benchmark band_matrices.
* lyrics in chords still fuck up.
- * rewire acknowledge_element() logic with a process_acknowledged()
-
+ *
+ - rewire acknowledge_element() logic with a process_acknowledged()
+ - construct Stem upon receiving Notehead. Junk Stem_req
+
+
* pushgroup/popgroup
* whole head on ledger line
TOPLEVEL_MAJOR_VERSION = 0
TOPLEVEL_MINOR_VERSION = 1
-TOPLEVEL_PATCH_LEVEL = 10
+TOPLEVEL_PATCH_LEVEL = 11
# use to send patches, always empty for released version:
-TOPLEVEL_MY_PATCH_LEVEL = .jcn1
+TOPLEVEL_MY_PATCH_LEVEL =
local $base="lilypond/";
-local @examples=("twinkle-pop", "twinkle", "multi", "wohltemperirt"
- ,"standchen-16", "standchen-20", "toccata-fuga-E", "scsii-menuetto",
- "cadenza", "scales", "rhythm", "gallina");
+local @examples=("twinkle-pop", "twinkle", "multi", "wohltemperirt",
+ #"standchen-16",
+ #"standchen-20",
+ "toccata-fuga-E", "scsii-menuetto",
+ "cadenza", "scales",
+ #"rhythm",
+ "gallina");
# rhythm, scales,
MAJOR_VERSION = 1
MINOR_VERSION = 1
-PATCH_LEVEL = 26
+PATCH_LEVEL = 27
# use to send patches, always empty for released version:
MY_PATCH_LEVEL = # include separator: "-1" or ".a"
#
//#define PARANOID
void
-Choleski_decomposition::full_matrix_solve (Vector &out, Vector const &rhs)const
+Choleski_decomposition::full_matrix_solve (Vector &out, Vector const &rhs) const
{
int n= rhs.dim();
assert (n == L.dim());
}
void
-Choleski_decomposition::band_matrix_solve (Vector &out, Vector const &rhs)const
+Choleski_decomposition::band_matrix_solve (Vector &out, Vector const &rhs) const
{
int n= rhs.dim();
int b = L.band_i();
}
void
-Choleski_decomposition::solve (Vector &x, Vector const &rhs)const
+Choleski_decomposition::solve (Vector &x, Vector const &rhs) const
{
if (L.band_b())
{
}
Vector
-Choleski_decomposition::solve (Vector rhs)const
+Choleski_decomposition::solve (Vector rhs) const
{
Vector r;
solve (r, rhs);
#include "full-storage.icc"
int
-Diagonal_storage::dim()const
+Diagonal_storage::dim() const
{
return band_.rows();
}
}
int
-Diagonal_storage::band_size_i()const
+Diagonal_storage::band_size_i() const
{
return (band_.cols()-1)/2;
}
bool
-Diagonal_storage::band_elt_b (int i,int j)const
+Diagonal_storage::band_elt_b (int i,int j) const
{
return abs (i-j) <= band_size_i();
}
void
-Diagonal_storage::assert_valid (int i,int j)const
+Diagonal_storage::assert_valid (int i,int j) const
{
assert (band_elt_b (i,j));
assert (i >=0 && j >=0 && i < dim() && j < dim ());
bool
-Diagonal_storage::mult_ok (int i,int)const
+Diagonal_storage::mult_ok (int i,int) const
{
return i < dim();
}
void
-Diagonal_storage::mult_next (int &i, int &j)const
+Diagonal_storage::mult_next (int &i, int &j) const
{
j++;
if ( j < i - band_size_i())
}
bool
-Diagonal_storage::trans_ok (int ,int j)const
+Diagonal_storage::trans_ok (int ,int j) const
{
return j < dim();
}
void
-Diagonal_storage::trans_next (int &i, int& j)const
+Diagonal_storage::trans_next (int &i, int& j) const
{
i++;
if ( i < j - band_size_i())
static Real nul_entry=0.0;
Real
-Diagonal_storage::elem (int i, int j)const
+Diagonal_storage::elem (int i, int j) const
{
if (abs ( i-j) > band_size_i())
return 0;
bool
Diagonal_storage::try_right_multiply (Matrix_storage*dest,
- const Matrix_storage*right)const
+ const Matrix_storage*right) const
{
if ( right->name() != Diagonal_storage::static_name ())
return false;
}
Link_array<Directed_graph_node> const &
-Directed_graph_node::get_out_edge_arr()const
+Directed_graph_node::get_out_edge_arr() const
{
return edge_out_l_arr_;
}
}
bool
-Directed_graph_node::contains_b (const Directed_graph_node *d)const
+Directed_graph_node::contains_b (const Directed_graph_node *d) const
{
return edge_out_l_arr_.find_l ((Directed_graph_node*)d);
}
PARANOID_OK();
}
bool
-Directed_graph_node::linked_b()const
+Directed_graph_node::linked_b() const
{
return edge_out_l_arr_.size() || edge_in_l_arr_.size ();
}
}
bool
-Full_storage::try_right_multiply (Matrix_storage * dest, Matrix_storage const * right)const
+Full_storage::try_right_multiply (Matrix_storage * dest, Matrix_storage const * right) const
{
if (dest->name() != Full_storage::static_name () ||
right->name() != Full_storage::static_name ())
bool ok() const {
return i < assoc_.arr.size();
}
- void OK()const {
+ void OK() const {
assert (!ok() || !assoc_.arr[i].free);
}
void operator++(int) { i++; i = next (i); }
solve Px = rhs
*/
Vector solve (Vector rhs) const;
- void solve (Vector &dest, Vector const &rhs)const;
+ void solve (Vector &dest, Vector const &rhs) const;
Vector operator * (Vector rhs) const { return solve (rhs); }
/**
return the inverse of the matrix P.
*/
Matrix original() const;
private:
- void full_matrix_solve (Vector &,Vector const&)const;
- void band_matrix_solve (Vector &, Vector const&)const;
+ void full_matrix_solve (Vector &,Vector const&) const;
+ void band_matrix_solve (Vector &, Vector const&) const;
void full_matrix_decompose (Matrix const & P);
void band_matrix_decompose (Matrix const &P);
Cursor<T> operator --( int);
/// point to link?
- bool ok()const;
+ bool ok() const;
/// ++ items left?
- bool forward()const;
+ bool forward() const;
/// -- items left?
- bool backward()const;
+ bool backward() const;
/** put (copy) after me in List.
analogously to editor. ok() interpreted as at end
template<class T>
inline bool
-Cursor<T>::backward()const
+Cursor<T>::backward() const
{
return ( pointer_ != 0);
}
template<class T>
inline bool
-Cursor<T>::forward()const
+Cursor<T>::forward() const
{
return ( pointer_ != 0);
}
template<class T>
inline bool
-Cursor<T>::ok()const
+Cursor<T>::ok() const
{
return ( pointer_ != 0);
}
public:
void set_band_size (int b);
- int band_size_i()const;
+ int band_size_i() const;
void assert_valid (int i, int j) const;
- bool band_elt_b (int,int)const;
+ bool band_elt_b (int,int) const;
void resize_dim (int);
virtual void resize_rows (int d) { resize_dim (d); }
virtual void delete_column (int k);
~Diagonal_storage();
- virtual bool mult_ok (int i, int j)const;
+ virtual bool mult_ok (int i, int j) const;
virtual void mult_next (int &i, int &j) const ;
virtual bool trans_ok (int i, int j) const;
virtual void trans_next (int &i, int &j) const;
DECLARE_VIRTUAL_COPY_CONS(Diagonal_storage, Matrix_storage);
DECLARE_MY_RUNTIME_TYPEINFO;
- virtual bool try_right_multiply (Matrix_storage * dest, Matrix_storage const *)const;
+ virtual bool try_right_multiply (Matrix_storage * dest, Matrix_storage const *) const;
};
#endif // DIAGONAL_STORAGE_HH
bool contains_b (Directed_graph_node const*) const;
Directed_graph_node (Directed_graph_node const &);
- void OK()const;
+ void OK() const;
Directed_graph_node();
~Directed_graph_node();
virtual void resize (int i, int j);
virtual void resize (int i);
virtual Real& elem (int i,int j);
- virtual Real elem (int i, int j)const ;
- int dim()const;
+ virtual Real elem (int i, int j) const ;
+ int dim() const;
Full_storage (Matrix_storage*);
Full_storage();
Full_storage (int i, int j);
virtual void delete_column (int k);
~Full_storage();
- virtual bool mult_ok (int i, int j)const;
+ virtual bool mult_ok (int i, int j) const;
virtual void mult_next (int &i, int &j) const ;
virtual bool trans_ok (int i, int j) const;
virtual void trans_next (int &i, int &j) const;
DECLARE_VIRTUAL_COPY_CONS(Full_storage,Matrix_storage);
DECLARE_MY_RUNTIME_TYPEINFO;
- virtual bool try_right_multiply (Matrix_storage * dest, Matrix_storage const *)const;
+ virtual bool try_right_multiply (Matrix_storage * dest, Matrix_storage const *) const;
};
#endif // FULL_STORAGE_HH
height_i_=width_i_=max_height_i_=max_width_i_=0;
}
INLINE bool
-Full_storage::valid (int i, int j)const
+Full_storage::valid (int i, int j) const
{
return (i>=0 && i < height_i_)
&& (j < width_i_ && j >=0);
return width_i_;
}
INLINE int
-Full_storage::dim()const
+Full_storage::dim() const
{
assert (rows()==cols ());
return rows();
return ((Interval_t<T> *)this)->idx (j);
}
T &max() { return right;}
- T max()const { return right;}
- T min()const{ return left; }
+ T max() const { return right;}
+ T min() const{ return left; }
T &min(){ return left; }
/**
PRE
template<class T>
bool
-Interval_t<T>::contains_b (Interval_t<T> const& a)const
+Interval_t<T>::contains_b (Interval_t<T> const& a) const
{
int c_i= _Interval__compare (*this, a);
if (c_i == -2)
template<class T>
T
-Interval_t<T>::length() const {
- assert (right >= left);
- return right-left;
+Interval_t<T>::length() const
+{
+ if (right < left)
+ return 0;
+ else
+ return right-left;
}
template<class T>
char const * longname;
char shortname;
- void printon (ostream &errorout)const ;
+ void printon (ostream &errorout) const ;
};
void next();
const Long_option_init *parselong();
const Long_option_init *parseshort();
- void OK()const;
+ void OK() const;
bool ok() const;
/// report an error and abort
template<class T>
inline Cursor<T>
-List<T>::top()const
+List<T>::top() const
{
return Cursor<T>( *this, top_);
}
template<class T>
inline Cursor<T>
-List<T>::bottom()const
+List<T>::bottom() const
{
return Cursor<T>( *this, bottom_);
}
// instantiate a template: explicit instantiation.
-#define L_INSTANTIATE(a) class List<a>; template class Cursor<a>; \
+#define LIST_INSTANTIATE(a) class List<a>; template class Cursor<a>; \
template class Link<a>
#include "list.hh"
virtual void delete_row (int k)=0;
virtual void delete_column (int k)=0;
virtual ~Matrix_storage() { }
- virtual Matrix_storage *clone()const=0;
+ virtual Matrix_storage *clone() const=0;
static void set_band (Matrix_storage*&, int band);
static void set_full (Matrix_storage*&);
virtual bool try_right_multiply (Matrix_storage *dest,
- const Matrix_storage *fact)const ;
+ const Matrix_storage *fact) const ;
/**
RTTI.
*/
0 <= band_i() <= dim
*/
int band_i() const;
- bool band_b()const;
- void set_full()const;
- void try_set_band()const;
+ bool band_b() const;
+ void set_full() const;
+ void try_set_band() const;
~Matrix() { delete dat; }
/// set entries to r
return i;
return -1;
}
- T *find_l (T const *t)const
+ T *find_l (T const *t) const
{
int i = find_i (t);
if (i >= 0)
{
public:
/// locate a file in the search path
- String find (String nm)const;
+ String find (String nm) const;
/// add to end of path.
Array<String>::push;
#define PLIST_INL
template<class T>
-void
+inline void
PL_copy (Pointer_list<T*> &to, Pointer_list<T*> const&src)
{
for (PCursor<T*> pc (src); pc.ok(); pc++)
}
}
+
+template<class T>
+inline PCursor<T>
+Link_list<T>::find (T what) const
+{
+ PCursor<T> i (*this);
+ for (; i.ok(); i++)
+ if (i.ptr() == what)
+ break;
+ return i;
+}
#endif
+/*
+ plist.tcc -- implement Pointer_list
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef PLIST_TCC
+#define PLIST_TCC
+
#include "plist.hh"
-#define PL_INSTANTIATE(a) class Link_list<a*>; \
+#define POINTERLIST_INSTANTIATE(a) class Pointer_list<a*>;\
template class PCursor<a*>;
-#define IPL_INSTANTIATE(a) PL_INSTANTIATE(a); \
- template class Pointer_list<a*>
template<class T>
void
}
}
-template<class T>
-PCursor<T>
-Link_list<T>::find (T what) const
-{
- PCursor<T> i (*this);
- for (; i.ok(); i++)
- if (i.ptr() == what)
- break;
- return i;
-}
+#endif // PLIST_TCC
template<class T>
inline
T *
-P<T>::copy_p()const
+P<T>::copy_p() const
{
return t_p? new T(*t_p) : 0;
}
#String_data# knowing it. */
Byte &operator [](int j);
Byte operator [](int j) const;
- bool is_binary_bo()const;
+ bool is_binary_bo() const;
};
}
INLINE bool
-String_data::is_binary_bo()const
+String_data::is_binary_bo() const
{
// return !memchr (data_byte_p_, length_i_, 0);
return ( (int)strlen ((char const*)data_byte_p_) != length_i_ );
char const* ch_C() const;
Byte* byte_l();
char* ch_l();
- bool is_binary_bo()const;
+ bool is_binary_bo() const;
void operator =(String_handle const &src);
void operator += (char const *s);
Byte operator[](int j) const;
#define DECLARE_MY_RUNTIME_TYPEINFO \
static char const *static_name();\
static bool static_is_type_b (const char*s);\
-virtual bool is_type_b (const char *s)const { return static_is_type_b (s); } \
+virtual bool is_type_b (const char *s) const { return static_is_type_b (s); } \
virtual char const *name() const{ return static_name (); } \
int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out()
void
-Long_option_init::printon (ostream &errorout)const
+Long_option_init::printon (ostream &errorout) const
{
if (shortname)
errorout <<"-" << shortname;
}
bool
-Getopt_long::ok()const
+Getopt_long::ok() const
{
return array_index_i_ < argument_count_i_;
}
bool
Matrix_storage::try_right_multiply (Matrix_storage *,
- const Matrix_storage *)const
+ const Matrix_storage *) const
{
return false;
}
#include "diagonal-storage.hh"
bool
-Matrix::band_b()const
+Matrix::band_b() const
{
return dat->is_type_b (Diagonal_storage::static_name());
}
}
void
-Matrix::try_set_band()const
+Matrix::try_set_band() const
{
if (band_b())
return;
}
int
-Matrix::band_i()const
+Matrix::band_i() const
{
if ( band_b())
{
in any other added path, in this order.
*/
String
-File_path::find (String nm)const
+File_path::find (String nm) const
{
fdebug << "looking for " << nm << ": ";
Engraver "Voice_group_engravers"
\alias "Voice_group";
\consists "Dynamic_engraver";
- \consists "Stem_beam_engraver";
+ \consists "Stem_engraver";
+ \consists "Beam_engraver";
\consists "Script_engraver";
\consists "Note_column_engraver";
\consists "Slur_engraver";
Engraver Score_engraver
\alias "Score";
+ \consists "Timing_engraver";
\consists "Bar_column_engraver";
\consists "Bar_number_grav";
\contains \requesttranslator { \piano_staff_engraver }
}
+stupid_engraver = \requesttranslator {
+ Engraver Score_engraver
+ \consists "Staff_sym_engraver";
+}
+
--- /dev/null
+\header{
+filename fugue1.ly
+title Fuga a 4
+description Das Wohltemperierte Clavier I, Fuga I (c-major)
+opus BWV 846
+composer Johann Sebastian Bach (1685-1750)
+enteredby Shay Rojansky
+copyright Public Domain
+}
+
+%{
+
+%}
+\version "0.1.1";
+
+
+global =
+ \melodic {
+ \meter 4/4; % should be \meter C
+ }
+
+tenor =
+ \melodic {
+ \clef "violin";
+ \octave c';
+
+ \stem \down;
+ r8 [c8 d e] [f. g32 f] [e8 a] |
+ [d g] ~ [g16 a g f] [e f e d] [c d c 'b] |
+ ['a8 fis] g4 ~ [g8 fis16 e] [f8 d] |
+ [g f! e d] c r r g ~ |
+%% 5
+ [g f16 e] f4 ~ [f16 f e8] d4 |
+ [c8 f] r16 [g f e] [f8 d] g4 ~ |
+ g4 r4 r2 |
+ r1 |
+ r8 [g8 a b] [c'. d'32 c'] [b8 e']
+%% 10
+ [a d'] ~ [d'16 e' d' c'] b8 r8 r d |
+ [e fis] [g. a32 g] [fis8 b e a] ~ |
+ [a16 b a gis] [fis8 f!] [e d] ~ [d16 e fis gis] |
+ [a gis a b] [gis fis gis a] b8 r8 r4 |
+ r8 [c8 d e] \stem 1; [f. g32 f] [e8 a] |
+%% 15
+ [d g] ~ [g16 a g f] e8 \stem -1; [e fis g] ~ |
+ [g8 fis] [gis8 a] ~ [a g! a b] |
+ \stem 0;
+ [c'. d'32 c'] [b8 e'] [a d'] ~ [d'16 e' d' c'] |
+ [b8 g' cis' d'] [e' cis' d' e' ] |
+ \stem -1; a8 r8 r e [fis g] \stem 0; [a. b32 a] |
+%% 20
+ [g8 c' fis b] ~ [b16 c' b a] \stem -1; [g fis e d] \stem 0; |
+ e4 \stem -1; d ~ [d16 a g f!] [e g f! a] |
+ g4 ~ [g16 a bes8] c'4 [d'8 g] |
+ \stem 0; g4. f8 ~ [f e] d4 |
+ \stem -1; e8 a4 g8 ~ [g8 f g a] |
+%% 25
+ [bes8. c'32 b] [a8 d'] [g c'] ~ [c'16 d' c' bes] |
+ [a bes a g] [f g f e] d4 ~ [d8. g16] |
+ a4 r16 [f'16 d'8] e'2 |
+ }
+
+
+soprane =
+ \melodic {
+ \octave c';
+ \stem \up;
+ r1 |
+ r2 r8 [g8 a b] |
+ [c'. d'32 c'] [b8 e'] [a d'] ~ [d'16 e' d' c'] |
+ [b g a b] [c' b c' d'] [e' d' e' fis'] [g'8 b] |
+%% 5
+ [c' a] [d'16 c' b a] [g8. g16] [f e f g] |
+ [a g a b] c'2 b4 |
+ \octave c'';
+ r8 [c8 d e] [f. g32 f] [e8 a] |
+ [d g] ~ [g16 a g f] [e8 a] ~ [a16 b a g] |
+ f2 [e8. fis16] g4 ~
+%% 10
+ g4 fis [g16 f! e d] [c d c 'b] |
+ ['a16 c 'b 'a] 'g8 r8 r16 [c16 'b 'a] ['gis8 e] |
+ [d c16 'b16] ['a 'gis 'a 'b] [c 'fis 'a 'gis] ['b8 'a16 'b]
+ [c8 f e d] ~ [d c16 'b] ['b8. 'a16] |
+ 'a4 r4 r2 |
+%% 15
+ r2 r8 ['g8 'a 'b] |
+ [c8. d32 c] ['b8 c] [d e] [f!. g32 f!] |
+ [e8 a d g] ~ [g16 a g f] [e8 a] |
+ [d8 bes] [a g16 f] [g f g e] [f g g f32 g] |
+ [a16 cis d g] [e8. d16] d8 r8 r4 |
+%% 20
+ r2 r4 r8 'g |
+ ['a 'b] [c. d32 c] ['b8 e 'a d] ~ |
+ [e16 e d c] ['b c d e] [f g a g] [f e d c] |
+ 'b4 [c8 d] 'g c4 'b8 |
+ c4 ['b8 'bes8] 'a d4 c8 |
+%% 25
+ [d8 e] f4 ~ [f16 a g f] [e f e d] |
+ c2 r16 ['g32 'a 'b!16 c] [d e f8] ~ |
+ [f32 c d e f16 g] [a8. b16] <g2 c'2> |
+ }
+
+alt =
+ \melodic {
+ \clef "bass";
+ \octave c;
+
+ \stem 1;
+ r1 |
+ r |
+ r |
+ r8 [g8 a b] [c'. d'32 c'] [b8 e'] |
+%% 5
+ [a d'] ~ [d'16 e' d' c'] [b8 c' ~ c' bes8] |
+ [a d' g c'] r16 [a16 b c'] d'4 |
+ g4 r8 g8 [a b] [c'. d'32 c'] |
+ [b8 e' a d'] ~ [d'16 e' d' c'!] [b!8 e'] ~ |
+ e'4 d'4 [c'16 b c' a] [e' d' c' b] |
+%% 10
+ [c'16 a b c'] [d' c' b a] g4 r4 |
+ r1 |
+ r8 [e8 fis gis] [a. b32 a] [gis8 c'] |
+ [fis b] ~ [b16 c' b a] gis8 a4 gis8 |
+ a4 r8 g8 [a b] c'. [d'32 c'] |
+%% 15
+ [b8 e' a d'] ~ [d' g] d'4 |
+ [c'8 a] e'4 d'8 r8 r4 |
+ r8 [a8 b cis'] [d'. e'32 d'] [c'!8 f'] |
+ [b8 e'] ~ [e'16 f' e' d'] cis'8 r8 r4 |
+ r8 [a8 b cis'] [d'. e'32 d'] [c'!8 fis'] |
+%% 20
+ [b e'] ~ [e'16 fis' e' d'] c'2 ~ |
+ [c'16 d' c' b] [a g a fis] [g8 b c' d'] |
+ [e'. f'32 e'] [d'8 g'] [c' f'] ~ [f'16 g' f' e'] |
+ d'4 [e'8 d'] ~ [d' g] g4 ~
+ [g8 c d e] [f. g32 f] [e8 a] |
+%% 25
+ [d g] ~ [g16 a g f] [e d e f] [g a bes g] |
+ [a e f g] [a b c' a] b2 |
+ c'1 |
+ }
+
+bass =
+ \melodic {
+ \clef "bass";
+ \octave c;
+
+ \stem -1;
+ r1 |
+ r |
+ r |
+ r |
+%% 5
+ r2 r8 [c8 d e] |
+ [f. g32 f] [e8 a] [d g] ~ [g16 a g f] |
+ [e f e d] [c d c 'b] ['a8 d a fis] |
+ [g16 a bes g] [cis8 d] a4 e4 |
+ [a16 b c' d'] [c' b a g] c'8 r8 r4 |
+%% 10
+ r2 r8 ['g8 'a 'b] |
+ [c. d32 c] ['b8 e] ['a d] ~ [d16 e d c] |
+ 'b8 e4 d8 c f!4 e8 ~ |
+ e d4 e8 [f! e16 d] e4 |
+ 'a4 r4 r2 |
+%% 15
+ r8 ['g8 'a 'b] [c. d32 c] ['b8 e] |
+ ['a8 d] ~ [d16 e d c] ['b8 'bes 'a g'] |
+ ['a8 fis g e] d4 [e8 f!] |
+ [g8. a32 g] [f8 bes] [e a] ~ [a16 bes a g] |
+ [f e f d] [g8 a] d2 ~ |
+%% 20
+ [d16 e d c] ['b 'a 'g 'fis] ['e8 e fis g] ~ |
+ [g a16 g16] [fis8 d] g2 ~ |
+ g2 a4 [b8 c'] |
+ [f16 a g f] [e d c 'b] [c d e f] [g8 'g] |
+ c1 ~ |
+%% 25
+ c1 ~ |
+ c1 ~ |
+ c1 |
+ }
+
+
+\score {
+ \melodic < \id "Piano" "";
+ \multi 1;
+ < \multi 2;
+ \global
+ \soprane
+ \tenor
+ >
+ < \multi 2;
+ \global
+ \alt
+ \bass
+ >
+ >
+
+ \paper{
+ gourlay_maxmeasures =5.;
+% castingalgorithme = \Wordwrap
+ }
+ \midi {
+ \tempo 4 = 84;
+ }
+}
+
+% EOF
--- /dev/null
+\header{
+filename prelude1.ly
+title Preludium
+description Das Wohltemperierte Clavier I, Prelude I (c-major)
+opus BWV 846
+source
+composer Johann Sebastian Bach (1685-1750)
+enteredby Shay Rojansky
+copyright Public Domain"
+}
+
+\version "0.1.1";
+
+ % should add \need{dutch.ini} for
+ % correct parsing of note names
+
+global =
+ \melodic {
+ \meter 4/4; % should be \meter C
+ }
+
+
+% should do programmable input.
+
+soprane =
+ \melodic {
+ \clef "violin";
+ \octave c';
+
+ <\multi 2;
+ % Real soprane
+ {\stem 1;
+ r8 [g16 c'] [e' g c' e'] r8 [g16 c'] [e' g c' e'] |
+ r8 [a16 d'] [f' a d' f'] r8 [a16 d'] [f' a d' f'] |
+ r8 [g16 d'] [f' g d' f'] r8 [g16 d'] [f' g d' f'] |
+ r8 [g16 c'] [e' g c' e'] r8 [g16 c'] [e' g c' e'] |
+ r8 [a16 e'] [a' a e' a'] r8 [a16 e'] [a' a e' a'] |
+ r8 [fis16 a] [d' fis a d'] r8 [fis16 a] [d' fis a d'] |
+ r8 [g16 d'] [g' g d' g'] r8 [g16 d'] [g' g d' g'] |
+ r8 [e16 g] [c' e g c'] r8 [e16 g] [c' e g c'] |
+ r8 [e16 g] [c' e g c'] r8 [e16 g] [c' e g c'] |}
+ % Tenor
+ {\stem -1;
+ r16 e8. ~ e4 r16 e8. ~ e4 |
+ r16 d8. ~ d4 r16 d8. ~ d4 |
+ r16 d8. ~ d4 r16 d8. ~ d4 |
+ r16 e8. ~ e4 r16 e8. ~ e4 |
+ r16 e8. ~ e4 r16 e8. ~ e4 |
+ r16 d8. ~ d4 r16 d8. ~ d4 |
+ r16 d8. ~ d4 r16 d8. ~ d4 |
+ r16 c8. ~ c4 r16 c8. ~ c4 |
+ r16 c8. ~ c4 r16 c8. ~ c4 |}>
+%% 10
+ r8 [d16 fis] [c' d fis c'] r8 [d16 fis] [c' d fis c'] |
+ r8 [d16 g] [b d g b] r8 [d16 g] [b d g b] |
+ r8 [e16 g] [cis' e g cis'] r8 [e16 g] [cis' e g cis'] |
+ r8 [d16 a] [d' d a d'] r8 [d16 a] [d' d a d'] |
+ r8 [d16 f] [b d f b] r8 [d16 f] [b d f b] |
+ r8 [c16 g] [c' c g c'] r8 [c16 g] [c' c g c'] |
+ r8 ['a16 c] [f 'a c f] r8 ['a16 c] [f 'a c f] |
+ r8 ['a16 c] [f 'a c f] r8 ['a16 c] [f 'a c f] |
+ r8 ['g16 'b] [f 'g 'b f] r8 ['g16 'b] [f 'g 'b f] |
+ r8 ['g16 c] [e 'g c e] r8 ['g16 c] [e 'g c e] |
+%% 20
+ r8 ['bes16 c] [e 'bes c e] r8 ['bes16 c] [e 'bes c e] |
+ r8 ['a16 c] [e 'a c e] r8 ['a16 c] [e 'a c e] |
+ r8 ['a16 c] [ees 'a c ees] r8 ['a16 c] [ees 'a c ees] |
+ r8 ['b16 c] [d 'b c d] r8 ['b16 c] [d 'b c d] |
+ r8 ['g16 'b] [d 'g 'b d] r8 ['g16 'b] [d 'g 'b d] |
+ r8 ['g16 c] [e 'g c e] r8 ['g16 c] [e 'g c e] |
+ r8 ['g16 c] [f 'g c f] r8 ['g16 c] [f 'g c f] |
+ r8 ['g16 'b] [f 'g 'b f] r8 ['g16 'b] [f 'g 'b f] |
+ r8 ['a16 c] [fis 'a c fis] r8 ['a16 c] [fis 'a c fis] |
+ r8 ['g16 c] [g 'g c g] r8 ['g16 c] [g 'g c g] |
+%% 30
+ r8 ['g16 c] [f 'g c f] r8 ['g16 c] [f 'g c f] |
+ r8 ['g16 'b] [f 'g 'b f] r8 ['g16 'b] [f 'g 'b f] |
+ r8 ['g16 'bes] [e 'g 'bes e] r8 ['g16 'bes] [e 'g 'bes e] |
+
+ r8 ['f16 'a] [c f c 'a] [c 'a 'f 'a] ['f 'd 'f 'd] |
+ r8 [g16 b] [d' f' d' b] [d' b g b] [d f e d] |
+ <e1 g c'> ||
+ }
+
+bass =
+ \melodic {
+ \clef "bass";
+ \octave c;
+
+ \stem -1;
+ c'2 c' |
+ c' c' |
+ b b |
+ c' c' |
+ c' c' |
+ c' c' |
+ b b |
+ b b |
+ a a |
+%% 10
+ <\multi 2;
+ % Alt
+ {\stem 1;
+ r16 a8. ~ a4 r16 a8. ~ a4 |
+ r16 b8. ~ b4 r16 b8. ~ b4 |
+ r16 bes8. ~ bes4 r16 bes8. ~ bes4 |
+ r16 a8. ~ a4 r16 a8. ~ a4 |
+ r16 aes8. ~ aes4 r16 aes8. ~ aes4 |
+ r16 g8. ~ g4 r16 g8. ~ g4 |
+ r16 f8. ~ f4 r16 f8. ~ f4 |
+ r16 f8. ~ f4 r16 f8. ~ f4 |
+ r16 d8. ~ d4 r16 d8. ~ d4 |
+ r16 e8. ~ e4 r16 e8. ~ e4 |
+%% 20
+ r16 g8. ~ g4 r16 g8. ~ g4 |
+ r16 f8. ~ f4 r16 f8. ~ f4 |
+ r16 c8. ~ c4 r16 c8. ~ c4 |
+ r16 f8. ~ f4 r16 f8. ~ f4 |
+ r16 f8. ~ f4 r16 f8. ~ f4 |
+ r16 e8. ~ e4 r16 e8. ~ e4 |
+ r16 d8. ~ d4 r16 d8. ~ d4 |
+ r16 d8. ~ d4 r16 d8. ~ d4 |
+ r16 ees8. ~ ees4 r16 ees8. ~ ees4 |
+ r16 e!8. ~ e4 r16 e8. ~ e4 |
+%% 30
+ r16 d8. ~ d4 r16 d8. ~ d4 |
+ r16 d8. ~ d4 r16 d8. ~ d4 |
+ r16 c8. ~ c4 r16 c8. ~ c4 |
+
+ r16 c8. ~ c4 ~ c2 |
+ r16 'b8. ~ 'b4 ~ 'b2 |
+ c1 ||}
+
+ % Bass
+ {\stem -1;
+ d2 d |
+ g g |
+ g g |
+ f f |
+ f f |
+ e e |
+ e e |
+ d d |
+ 'g 'g |
+ c c |
+%% 20
+ c c |
+ 'f 'f |
+ 'fis 'fis |
+ 'aes 'aes |
+ 'g 'g |
+ 'g 'g |
+ 'g 'g |
+ 'g 'g |
+ 'g 'g |
+ 'g 'g |
+%% 30
+ 'g 'g |
+ 'g 'g |
+ 'c 'c |
+
+ 'c 'c |
+ 'c 'c |
+ 'c1 }>
+ }
+
+
+\score {
+ \melodic < \id "Piano" "";
+ \multi 1;
+ < \multi 2;
+ \global
+ \soprane
+ >
+ < \multi 2;
+ \global
+ \bass
+ >
+ >
+
+ \paper{
+ gourlay_maxmeasures =5.;
+
+ }
+ \midi {
+ \tempo 4 = 84;
+ }
+}
+
+% EOF
-%{MudelaHeader
- filename:rhythm.ly
- title:
- description:
- composers:
- entered-by:HWN
- copyright:public domain
-
- Tested Features: multiple meters, beaming
+\header{
+ filename rhythm.ly
+ entered-by HWN
+ copyright public domain
+ Tested Features multiple meters, beaming
unsynced bars
-EndMudelaHeader
+}
+%{
+has to be revised for 0.1.12
%}
+++ /dev/null
-%{
-16-point version of "leise flehen meine lieder"
-%}
-
-\include "standchen-part.ly"
-
-\score{
- \themusic
- \paper{
- % 16pt mustn't use whole page width
- linewidth= 160.\mm;
- % we want gourlay, don't set geometric
- % geometric= 1.4;
- gourlay_maxmeasures = 9.;
- \output "standchen.out";
- }
- \midi{
- \tempo 4 = 54;
- }
-}
\instrument{M\"a\ss ig} % heu
%#%\tempo{M\"a\ss ig}
\maketit
-\input standchen.out
+\input{standchen-16.out}
%\input lelie.tex
\end{document}
+++ /dev/null
-%{
-20-point version of "leise flehen meine lieder"
-%}
-
-\include "standchen-part.ly"
-
-\score{
- \themusic
- \paper{
- \paper_twenty
- % 20pt music uses whole pagewidth
- linewidth= 195.\mm;
-
- % we want gourlay, don't set geometric
- % geometric= 1.4;
- gourlay_maxmeasures = 9.;
- \output "standchen.out";
- }
- \midi{
- \tempo 4 = 54;
- }
-}
\instrument{M\"a\ss ig} % heu
%#%\tempo{M\"a\ss ig}
\maketit
-\input standchen.out
+\input{standchen-20.out}
%\input lelie.tex
\end{document}
+++ /dev/null
-\header{
-filename standchen-part.ly
-title St\"andchen (Serenade) "Leise flehen meine Lieder"
-opus D. 957 No. 4
-composers Franz Schubert (1797-1828)
- Text by Ludwig Rellstab (1799-1860)
-enteredby JCN
-copyright public domain
-}
-%{
- Tested Features: multivoice, accents, lyrics, chords, piano music
-%}
-
-\version "0.1.1";
-
-commands = \melodic{
- \skip 2.*4;
- \bar "|:";
- \skip 2.*24;
-% volta1
- \skip 2.*8;
-% volta2
- \bar ":|";
- \skip 2.*22;
- \bar "|.";
- }
-
-melodie = \melodic{
- \meter 3/4;
- \clef "violin";
- \key bes;
- \octave c';
- \duration 8;
- r \pp < [ d 'a-| > f-| < d 'a-| > f-| < d 'a-| ] > |
-%%2
- r < [ d 'bes-| > f-| < d 'bes-| > f-| < d 'bes-| ] > |
-%%3
- \textstyle "italic";
- r_"simile" < [ d 'bes > e < d 'bes > e < d 'bes ] >|
- \textstyle "roman";
-
-%%4
- r < [ 'a cis > e < 'a cis > e < 'a cis ] > |
-%%5
- [2/3 a~ bes a ]1/1 d'4. a |
-%%6
- [2/3 g~ a g ]1/1 d'4 g r |
-
-%%7
- a4.^> g [2/3 g~ f e ]1/1 |
-%%8
- f2 r4 |
-%%9
-
- < { a'4.~ g' [2/3 g'( f' )e' ]1/1 }
- { cis'4. e'_"dolce" \plet 2/3; e' \plet 1/1; } > |
-%%10
- < f'2. d'2. > |
-%%11
- [2/3 a ~ bes a ]1/1 f'4. a |
-%%12
- [2/3 g~ a g ]1/1 e'4. d' |
-%%13
- c'4. bes [2/3 bes~ a g ]1/1 |
-%%14
- a2 r
- < { d'~ c'4. g [2/3 bes a g ]1/1 }
- { f \p ~ e4._"dolce" bes
- \plet 2/3; g
- \plet 1/1;
- } > |
-%%16
- < a2. f2. > |
-%%17
- \textstyle "italic";
- [ a8._"cresc." cis'16 ] f'4. e'
- \textstyle "roman";|
-%%18
- [ d'8. a16 ] f4. d |
-%%19
-%#% c'\grace\stemup
- [2/3 bes ~ a bes ]1/1 d'4. bes |
-%%20
- a2. |
-%%21
-%#% a\grace
- [2/3 g~ fis g ]1/1 bes4.^> g |
-%%22
- f!2. |
-%%23
- [ a8. \mf cis'16 ] f'4. e' |
-%%24
- [ d'8. a16 ] fis4. d |
-%%25
- [2/3 b \mf~ ais b ]1/1 d'4. b |
-%%26
- < a2. fis2. > |
-%%27
- [2/3 e' \f~ dis' e' ]1/1 g'4. cis' |
-%%28
- < d'2. fis2. > |
-%#%\volta1
-%%29
- < { bes2( [ d'8.~ )bes16 ] }
- { g2 \mf [ bes8. g16 ] } > |
-%%30
- < { a4. [ a-. a-. a-. ] }
- { fis4. [ fis-.( fis-. )fis-. ] } > |
-%%31
- < { a4. [ a-. a-. a-. ] }
- { g4. [ cis-.( e-. )g-. ] } > |
-%%32
- < a2 fis2 \pp > < a4 fis4 > |
-%%33
- < { b2( [ d'8.~ )b16 ] }
- { g2 [ b8. g16 ] } > |
-%%34
- < { a4. [ a-. a-. a-. ] }
- { fis4. [ fis-.( fis-. )fis-. ] } > |
-%%35
- < { a4. [ a-. a-. a-. ] }
- { g4. [ cis-.( e-. )g-. ] } > |
-%%36
- < a2. fis2. > |
-%#%\volta2
-%%37
- [ a8. a16 ] [ cis'8. cis'16 ] [ e'8. e'16 ] |
-%%38
- d'4~ cis'4 r4 |
-%%39
-%#% > a4. [ cis' e'8. >! d'16 ] |
- a4. \> [ cis' e'8. \! d'16 ] |
-%%40
- cis'2 r4 |
-%%41
- < fis'4. \> cis'4. \f > e' [2/3 e'~ d' \! cis' ]1/1 |
-%%42
- [ b8. cis'16 ] d'4^> b r |
-%%43
-
- [ b8. \f cis'16 ] d'4^> b r |
-%%44
- [ b8. \> cis'16 ] d'4^> b \! r |
-%%45
- [2/3 b \p ~ ais b ]1/1 d'4. b |
-%%46
- <a!2. fis2. > |
-%%47
- [2/3 e' \f~ dis' e' ]1/1 g'4.^> cis' |
-%%48
- \textstyle "italic";
- <
- { fis2.~
- %\group "+1";
- \stem \down; f2. }
- { d'2. ~ \stem \up;
- d'4 r4_"decresc." d'4 }
- >
- \textstyle "roman"; |
-%%50
- < bes2. e2. > |
-%%51
- < a2. cis2. > |
-%%52
- < fis2 d2 > < a4 fis4 \pp > |
-%%53
-
- < bes2 g2 > < [ d'8.^> bes8. > < bes16 g16 ] > |
-%%54
- < { a4. [ a-. a-. a-. ] }
- { fis4. [ fis-.( fis-. )fis-.] } > |
-%%55
- < { a4. [ a-. a-. a-. ] }
- { g4. [ cis-.( e-. )g-. ] } > |
-%%56
- \textstyle "italic";
- < a2. fis2._"dim." >
- \textstyle "roman"; |
-%%57
- < a2. fis2. > |
-%%58
- < a2.^\fermata fis2. > |
-%#%\tighten
-}
-
-begeleiding = \melodic{
- \meter 3/4;
- \clef"bass";
- \key bes;
- \octave c';
- \duration 2;
- 'd r4 |
-%%2
- ''bes r4 |
-
-%%3
- ''g r4 |
-
-%%4
- ''a r4 |
-%%5
-\duration 8;
- < \multi 2; { \stem \up;
- [ 'f 'a d 'a d 'a ]
- [ 'd 'e 'g 'e 'g 'e ]
- [ 'cis 'e 'g 'e 'g 'e ]
- [ 'd 'a d 'a d 'a ]
- }
- { \stem \down;
- 'd2 r4
- ''bes2 r4
- ''a2 r4
- 'd2 r4
- } >
-%%9
- \stem 0;
- [ 'a e g e g e ] |
-%%10
- [ 'd 'a d 'a d 'a ] |
-%%11
- < \multi 2;
- { \stem \up;
- [ 'f 'a d 'a d 'a ]
- [ 'd 'e 'g 'e 'g 'e ]
- [ 'e 'g 'bes 'g 'bes 'g ]
- [ 'a c f c f c ]
- } { \stem \down;
- 'd2 r4
- ''bes2 r4
- 'c2 r4
- 'f2 r4 }
- >
-%%15
- \stem 0;
- [ 'c 'g 'bes 'g 'bes 'g ] |
-%%16
- [ ''f 'c 'f 'c 'f 'c ] |
- < \multi 2;
- { \stem \up;
- [ ''a 'e 'g 'e 'g 'e ][ 'd 'a d 'a d 'a ]
- [ ''bes 'f 'bes 'f 'bes 'f ][ ''f 'c 'f 'c 'f 'c ] }
- { \stem \down;
- ''a2 r4
- 'd2 r4
- ''bes2 r4
- ''f2 r4
- } >
-%%21
- \stem 0;
- < [ 'e 'c > 'g c 'g c 'g ] |
-%%22
- [ 'f 'a c 'a 'f 'c ] |
- < \multi 2; {
- \stem \up;
- [ ''a 'e 'g 'e 'g 'e ]
- [ 'd 'fis 'a 'fis 'a 'fis ]
- [ ''g 'd 'b 'd 'b 'd ]
- [ 'd 'a d 'a d 'a ]
- }
- {\stem \down;
- ''a2 r4
- 'd2 r4
- ''g2 r4
- 'd2 r4
- }
- >
- \stem 0;
- < [ 'cis ''a > 'e 'a 'e 'a 'e ] |
-%%28
- [ 'd 'a d 'a d 'a ] |
-%%29
- [ 'd 'g 'bes 'g 'bes 'g ] |
-%#%\volta1
-%%30
- [ 'd 'fis 'a 'fis 'a 'fis ] |
-%%31
- [ ''a 'e 'a 'e 'a 'e ] |
-%%32
- [ 'd 'fis 'a 'fis 'a 'fis ] |
-%%33
- [ 'd 'g 'b 'g 'b 'g ] |
-%%34
- [ 'd 'fis 'a 'fis 'a 'fis ] |
-%%35
- [ ''a 'e 'a 'e 'a 'e ] |
-%%36
- [ 'd 'fis 'a 'fis 'a 'fis ] |
-%#%\volta2
-%%37
- [ ''a 'e 'g 'e ''bes^> 'e ] |
-%%38
- [ ''a < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a ] > |
-%%39
- [ ''a 'e 'g 'e ''bes^> 'e ] |
-%%40
- [ ''a < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a ] > |
-%%41
- [ ''ais 'e 'fis 'e 'fis 'e ] |
-%%42
- < [ 'd ''b > 'fis 'b 'fis 'b 'fis ] |
-%%43
- < [ 'e ''b > 'g 'b 'g 'b 'g ] |
-%%44
- < [ 'd ''b > 'fis 'b 'fis 'b 'fis ] |
-%%45
- < \multi 2; { \stem \up;
- [ ''g 'd 'b 'd 'b 'd ]
- [ 'd 'a d 'a d 'a ]
- } {
- \stem \down;
- ''g2 r4
- 'd2 r4
- } >
-
-%%47
- \stem 0;
- < [ 'cis ''a > 'e 'a 'e 'a 'e ] |
-%%48
- [ 'd 'fis 'a 'fis 'a 'fis ] |
-%%49
- [ 'd 'a d 'a d 'a ] |
-%%50
- [ ''g 'e 'g 'e 'g 'e ] |
-%%51
- [ ''a 'e 'g 'e 'g 'e ] |
-%%52
- [ ''d 'd 'fis 'd 'fis 'd ] |
-%%53
- [ 'd 'g 'bes 'g 'bes 'g ] |
-%%54
- [ 'd 'fis 'a 'fis 'a 'fis ] |
-%%55
- [ ''a 'e 'g 'e 'g 'e ] |
-%%56
- [ ''d ''a 'd ''a 'd ''a ] |
-%%57
- [ ''d ''a 'd ''a 'd ''a ]
-%%58
- < 'd2.^\fermata ''d2. > |
- }
-
-
-tekstI = \lyric{
- \meter 3/4;
- \duration 4;
- _ _ _
- _ _ _
- _ _ _
- _ _ _
-% 5
- [2/3 Lei- se8 ]1/1 fleh-4. en8
- [2/3 mei- ne8 ]1/1 Lie- der8 _8
- Durch4. die8 [2/3 Nacht zu8 ]1/1
- dir;2 _
- _ _ _
- _ _ _
-% 11
- [2/3 In den8 ]1/1 stil-4. len8
- [2/3 Hain her-8 ]1/1 nie-4. der,8
- Lieb4. chen,8 [2/3 komm zu8 ]1/1
- mir!2 _
- _ _ _
- _ _ _
-
-% 17
- Fl\"us-8. ternd16 schlan-4. ke8
- Wip-8. fel16 rau-4. schen8
- [2/3 In des8 ]1/1 Mon-4. des8
- Licht;2.
- _ _ _
- _ _ _
-
-% 23
- Des8. Ver-16 r\"a-4. ters8
- feind-8. lich16 Lau-4. schen8
- [2/3 F\"urch- te,8 ]1/1 Hol-4. de,8
- nicht.2.
- _ _ _
- _ _ _
-
-% volta 1
-% 29
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
-
-% volta 2
-% 37
- La\ss8. auch16 dir8. die16 Brust8. be-16
- we- gen, _
- Lieb-4. chen,8 h\"o-8. re16
- mich!2 _
- Be-8. bend16 harr' ich8 _8
- dir8. ent-16 ge- gen!8 _8
- [2/3 Komm, be-8 ]1/1 gl\"u4. cke8
- mich!2.
- _ _ _ _ _ _
-% 47
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
-% 57
- _ _ _ _ _ _
-
-}
-
-tekstII = \lyric{
- \meter 3/4;
- \duration 4;
- _ _ _
- _ _ _
- _ _ _
- _ _ _
-% 5
- [2/3 H\"orst die8 ]1/1 Nach-4. ti-8
- [2/3 gal- len8 ]1/1 schla- gen?8 _8
- Ach!4. sie8 [2/3 fleh- en8 ]1/1
- dich,2 _
- _ _ _
- _ _ _
-
-% 11
- [2/3 Mit der8 ]1/1 T\"o-4. ne8
- [2/3 s\"u\ss- en8 ]1/1 Kla-4. gen8
- Fleh-4. en8 [2/3 sie f\"ur8 ]1/1
- mich.2 _
- _ _ _
- _ _ _
-
-% 17
- Sie-8. ver-16 stehn4. des8
- Bus-8. ens16 Seh-4. nen,8
- [2/3 Ken- nen8 ]1/1 Lieb-4. es-8
- schmerz,2.
- _ _ _
- _ _ _
-
-% 23
- R\"uh-8. ren16 mit4. den8
- Sil-8. ber-16 t\"o-4. nen8
- [2/3 Jed- es8 ]1/1 wei-4. che8
- Herz.2.
- _ _ _
- _ _ _
-% volta 1
-% 29
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
-
-% volta 2
-% 37
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
-% 47
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
- _ _ _ _ _ _
-% 57
- _ _ _ _ _ _
-
-}
-
-themusic =
- <
- < \id "Lyric" "1";
- \tekstI
- \tekstII
- >
- < \id "Piano" "";
- \multi 2;
- \melodic < \melodie \commands >
- \melodic < \begeleiding \commands >
- >
- >
--- /dev/null
+\header{
+filename standchen.ly
+title St\"andchen (Serenade) "Leise flehen meine Lieder"
+opus D. 957 No. 4
+composers Franz Schubert (1797-1828)
+ Text by Ludwig Rellstab (1799-1860)
+enteredby JCN
+copyright public domain
+}
+
+%{
+ Tested Features: multivoice, accents, lyrics, chords, piano music,
+multiple \paper{}s in one \score
+%}
+
+\version "0.1.1";
+
+commands = \melodic{
+ \skip 2.*4;
+ \bar "|:";
+ \skip 2.*24;
+% volta1
+ \skip 2.*8;
+% volta2
+ \bar ":|";
+ \skip 2.*22;
+ \bar "|.";
+ }
+
+melodie = \melodic{
+ \meter 3/4;
+ \clef "violin";
+ \key bes;
+ \octave c';
+ \duration 8;
+ r \pp < [ d 'a-| > f-| < d 'a-| > f-| < d 'a-| ] > |
+%%2
+ r < [ d 'bes-| > f-| < d 'bes-| > f-| < d 'bes-| ] > |
+%%3
+ \textstyle "italic";
+ r_"simile" < [ d 'bes > e < d 'bes > e < d 'bes ] >|
+ \textstyle "roman";
+
+%%4
+ r < [ 'a cis > e < 'a cis > e < 'a cis ] > |
+%%5
+ [2/3 a~ bes a ]1/1 d'4. a |
+%%6
+ [2/3 g~ a g ]1/1 d'4 g r |
+
+%%7
+ a4.^> g [2/3 g~ f e ]1/1 |
+%%8
+ f2 r4 |
+%%9
+
+ < { a'4.~ g' [2/3 g'( f' )e' ]1/1 }
+ { cis'4. e'_"dolce" \plet 2/3; e' \plet 1/1; } > |
+%%10
+ < f'2. d'2. > |
+%%11
+ [2/3 a ~ bes a ]1/1 f'4. a |
+%%12
+ [2/3 g~ a g ]1/1 e'4. d' |
+%%13
+ c'4. bes [2/3 bes~ a g ]1/1 |
+%%14
+ a2 r
+ < { d'~ c'4. g [2/3 bes a g ]1/1 }
+ { f \p ~ e4._"dolce" bes
+ \plet 2/3; g
+ \plet 1/1;
+ } > |
+%%16
+ < a2. f2. > |
+%%17
+ \textstyle "italic";
+ [ a8._"cresc." cis'16 ] f'4. e'
+ \textstyle "roman";|
+%%18
+ [ d'8. a16 ] f4. d |
+%%19
+%#% c'\grace\stemup
+ [2/3 bes ~ a bes ]1/1 d'4. bes |
+%%20
+ a2. |
+%%21
+%#% a\grace
+ [2/3 g~ fis g ]1/1 bes4.^> g |
+%%22
+ f!2. |
+%%23
+ [ a8. \mf cis'16 ] f'4. e' |
+%%24
+ [ d'8. a16 ] fis4. d |
+%%25
+ [2/3 b \mf~ ais b ]1/1 d'4. b |
+%%26
+ < a2. fis2. > |
+%%27
+ [2/3 e' \f~ dis' e' ]1/1 g'4. cis' |
+%%28
+ < d'2. fis2. > |
+%#%\volta1
+%%29
+ < { bes2( [ d'8.~ )bes16 ] }
+ { g2 \mf [ bes8. g16 ] } > |
+%%30
+ < { a4. [ a-. a-. a-. ] }
+ { fis4. [ fis-.( fis-. )fis-. ] } > |
+%%31
+ < { a4. [ a-. a-. a-. ] }
+ { g4. [ cis-.( e-. )g-. ] } > |
+%%32
+ < a2 fis2 \pp > < a4 fis4 > |
+%%33
+ < { b2( [ d'8.~ )b16 ] }
+ { g2 [ b8. g16 ] } > |
+%%34
+ < { a4. [ a-. a-. a-. ] }
+ { fis4. [ fis-.( fis-. )fis-. ] } > |
+%%35
+ < { a4. [ a-. a-. a-. ] }
+ { g4. [ cis-.( e-. )g-. ] } > |
+%%36
+ < a2. fis2. > |
+%#%\volta2
+%%37
+ [ a8. a16 ] [ cis'8. cis'16 ] [ e'8. e'16 ] |
+%%38
+ d'4~ cis'4 r4 |
+%%39
+%#% > a4. [ cis' e'8. >! d'16 ] |
+ a4. \> [ cis' e'8. \! d'16 ] |
+%%40
+ cis'2 r4 |
+%%41
+ < fis'4. \> cis'4. \f > e' [2/3 e'~ d' \! cis' ]1/1 |
+%%42
+ [ b8. cis'16 ] d'4^> b r |
+%%43
+
+ [ b8. \f cis'16 ] d'4^> b r |
+%%44
+ [ b8. \> cis'16 ] d'4^> b \! r |
+%%45
+ [2/3 b \p ~ ais b ]1/1 d'4. b |
+%%46
+ <a!2. fis2. > |
+%%47
+ [2/3 e' \f~ dis' e' ]1/1 g'4.^> cis' |
+%%48
+ \textstyle "italic";
+ <
+ { fis2.~
+ %\group "+1";
+ \stem \down; f2. }
+ { d'2. ~ \stem \up;
+ d'4 r4_"decresc." d'4 }
+ >
+ \textstyle "roman"; |
+%%50
+ < bes2. e2. > |
+%%51
+ < a2. cis2. > |
+%%52
+ < fis2 d2 > < a4 fis4 \pp > |
+%%53
+
+ < bes2 g2 > < [ d'8.^> bes8. > < bes16 g16 ] > |
+%%54
+ < { a4. [ a-. a-. a-. ] }
+ { fis4. [ fis-.( fis-. )fis-.] } > |
+%%55
+ < { a4. [ a-. a-. a-. ] }
+ { g4. [ cis-.( e-. )g-. ] } > |
+%%56
+ \textstyle "italic";
+ < a2. fis2._"dim." >
+ \textstyle "roman"; |
+%%57
+ < a2. fis2. > |
+%%58
+ < a2.^\fermata fis2. > |
+%#%\tighten
+}
+
+begeleiding = \melodic{
+ \meter 3/4;
+ \clef"bass";
+ \key bes;
+ \octave c';
+ \duration 2;
+ 'd r4 |
+%%2
+ ''bes r4 |
+
+%%3
+ ''g r4 |
+
+%%4
+ ''a r4 |
+%%5
+\duration 8;
+ < \multi 2; { \stem \up;
+ [ 'f 'a d 'a d 'a ]
+ [ 'd 'e 'g 'e 'g 'e ]
+ [ 'cis 'e 'g 'e 'g 'e ]
+ [ 'd 'a d 'a d 'a ]
+ }
+ { \stem \down;
+ 'd2 r4
+ ''bes2 r4
+ ''a2 r4
+ 'd2 r4
+ } >
+%%9
+ \stem 0;
+ [ 'a e g e g e ] |
+%%10
+ [ 'd 'a d 'a d 'a ] |
+%%11
+ < \multi 2;
+ { \stem \up;
+ [ 'f 'a d 'a d 'a ]
+ [ 'd 'e 'g 'e 'g 'e ]
+ [ 'e 'g 'bes 'g 'bes 'g ]
+ [ 'a c f c f c ]
+ } { \stem \down;
+ 'd2 r4
+ ''bes2 r4
+ 'c2 r4
+ 'f2 r4 }
+ >
+%%15
+ \stem 0;
+ [ 'c 'g 'bes 'g 'bes 'g ] |
+%%16
+ [ ''f 'c 'f 'c 'f 'c ] |
+ < \multi 2;
+ { \stem \up;
+ [ ''a 'e 'g 'e 'g 'e ][ 'd 'a d 'a d 'a ]
+ [ ''bes 'f 'bes 'f 'bes 'f ][ ''f 'c 'f 'c 'f 'c ] }
+ { \stem \down;
+ ''a2 r4
+ 'd2 r4
+ ''bes2 r4
+ ''f2 r4
+ } >
+%%21
+ \stem 0;
+ < [ 'e 'c > 'g c 'g c 'g ] |
+%%22
+ [ 'f 'a c 'a 'f 'c ] |
+ < \multi 2; {
+ \stem \up;
+ [ ''a 'e 'g 'e 'g 'e ]
+ [ 'd 'fis 'a 'fis 'a 'fis ]
+ [ ''g 'd 'b 'd 'b 'd ]
+ [ 'd 'a d 'a d 'a ]
+ }
+ {\stem \down;
+ ''a2 r4
+ 'd2 r4
+ ''g2 r4
+ 'd2 r4
+ }
+ >
+ \stem 0;
+ < [ 'cis ''a > 'e 'a 'e 'a 'e ] |
+%%28
+ [ 'd 'a d 'a d 'a ] |
+%%29
+ [ 'd 'g 'bes 'g 'bes 'g ] |
+%#%\volta1
+%%30
+ [ 'd 'fis 'a 'fis 'a 'fis ] |
+%%31
+ [ ''a 'e 'a 'e 'a 'e ] |
+%%32
+ [ 'd 'fis 'a 'fis 'a 'fis ] |
+%%33
+ [ 'd 'g 'b 'g 'b 'g ] |
+%%34
+ [ 'd 'fis 'a 'fis 'a 'fis ] |
+%%35
+ [ ''a 'e 'a 'e 'a 'e ] |
+%%36
+ [ 'd 'fis 'a 'fis 'a 'fis ] |
+%#%\volta2
+%%37
+ [ ''a 'e 'g 'e ''bes^> 'e ] |
+%%38
+ [ ''a < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a ] > |
+%%39
+ [ ''a 'e 'g 'e ''bes^> 'e ] |
+%%40
+ [ ''a < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a ] > |
+%%41
+ [ ''ais 'e 'fis 'e 'fis 'e ] |
+%%42
+ < [ 'd ''b > 'fis 'b 'fis 'b 'fis ] |
+%%43
+ < [ 'e ''b > 'g 'b 'g 'b 'g ] |
+%%44
+ < [ 'd ''b > 'fis 'b 'fis 'b 'fis ] |
+%%45
+ < \multi 2; { \stem \up;
+ [ ''g 'd 'b 'd 'b 'd ]
+ [ 'd 'a d 'a d 'a ]
+ } {
+ \stem \down;
+ ''g2 r4
+ 'd2 r4
+ } >
+
+%%47
+ \stem 0;
+ < [ 'cis ''a > 'e 'a 'e 'a 'e ] |
+%%48
+ [ 'd 'fis 'a 'fis 'a 'fis ] |
+%%49
+ [ 'd 'a d 'a d 'a ] |
+%%50
+ [ ''g 'e 'g 'e 'g 'e ] |
+%%51
+ [ ''a 'e 'g 'e 'g 'e ] |
+%%52
+ [ ''d 'd 'fis 'd 'fis 'd ] |
+%%53
+ [ 'd 'g 'bes 'g 'bes 'g ] |
+%%54
+ [ 'd 'fis 'a 'fis 'a 'fis ] |
+%%55
+ [ ''a 'e 'g 'e 'g 'e ] |
+%%56
+ [ ''d ''a 'd ''a 'd ''a ] |
+%%57
+ [ ''d ''a 'd ''a 'd ''a ]
+%%58
+ < 'd2.^\fermata ''d2. > |
+ }
+
+
+tekstI = \lyric{
+ \meter 3/4;
+ \duration 4;
+ _ _ _
+ _ _ _
+ _ _ _
+ _ _ _
+% 5
+ [2/3 Lei- se8 ]1/1 fleh-4. en8
+ [2/3 mei- ne8 ]1/1 Lie- der8 _8
+ Durch4. die8 [2/3 Nacht zu8 ]1/1
+ dir;2 _
+ _ _ _
+ _ _ _
+% 11
+ [2/3 In den8 ]1/1 stil-4. len8
+ [2/3 Hain her-8 ]1/1 nie-4. der,8
+ Lieb4. chen,8 [2/3 komm zu8 ]1/1
+ mir!2 _
+ _ _ _
+ _ _ _
+
+% 17
+ Fl\"us-8. ternd16 schlan-4. ke8
+ Wip-8. fel16 rau-4. schen8
+ [2/3 In des8 ]1/1 Mon-4. des8
+ Licht;2.
+ _ _ _
+ _ _ _
+
+% 23
+ Des8. Ver-16 r\"a-4. ters8
+ feind-8. lich16 Lau-4. schen8
+ [2/3 F\"urch- te,8 ]1/1 Hol-4. de,8
+ nicht.2.
+ _ _ _
+ _ _ _
+
+% volta 1
+% 29
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+
+% volta 2
+% 37
+ La\ss8. auch16 dir8. die16 Brust8. be-16
+ we- gen, _
+ Lieb-4. chen,8 h\"o-8. re16
+ mich!2 _
+ Be-8. bend16 harr' ich8 _8
+ dir8. ent-16 ge- gen!8 _8
+ [2/3 Komm, be-8 ]1/1 gl\"u4. cke8
+ mich!2.
+ _ _ _ _ _ _
+% 47
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+% 57
+ _ _ _ _ _ _
+
+}
+
+tekstII = \lyric{
+ \meter 3/4;
+ \duration 4;
+ _ _ _
+ _ _ _
+ _ _ _
+ _ _ _
+% 5
+ [2/3 H\"orst die8 ]1/1 Nach-4. ti-8
+ [2/3 gal- len8 ]1/1 schla- gen?8 _8
+ Ach!4. sie8 [2/3 fleh- en8 ]1/1
+ dich,2 _
+ _ _ _
+ _ _ _
+
+% 11
+ [2/3 Mit der8 ]1/1 T\"o-4. ne8
+ [2/3 s\"u\ss- en8 ]1/1 Kla-4. gen8
+ Fleh-4. en8 [2/3 sie f\"ur8 ]1/1
+ mich.2 _
+ _ _ _
+ _ _ _
+
+% 17
+ Sie-8. ver-16 stehn4. des8
+ Bus-8. ens16 Seh-4. nen,8
+ [2/3 Ken- nen8 ]1/1 Lieb-4. es-8
+ schmerz,2.
+ _ _ _
+ _ _ _
+
+% 23
+ R\"uh-8. ren16 mit4. den8
+ Sil-8. ber-16 t\"o-4. nen8
+ [2/3 Jed- es8 ]1/1 wei-4. che8
+ Herz.2.
+ _ _ _
+ _ _ _
+% volta 1
+% 29
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+
+% volta 2
+% 37
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+% 47
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+ _ _ _ _ _ _
+% 57
+ _ _ _ _ _ _
+
+}
+
+themusic =
+ <
+ < \id "Lyric" "1";
+ \tekstI
+ \tekstII
+ >
+ < \id "Piano" "";
+ \multi 2;
+ \melodic < \melodie \commands >
+ \melodic < \begeleiding \commands >
+ >
+ >
+
+
+\score{
+ \themusic
+ \paper{
+ \paper_twenty
+ % 20pt music uses whole pagewidth
+ linewidth= 195.\mm;
+
+ % we want gourlay, don't set geometric
+ % geometric= 1.4;
+ gourlay_maxmeasures = 9.;
+ \output "standchen-20.out";
+ }
+ \paper{
+ % 16pt mustn't use whole page width
+ linewidth= 160.\mm;
+ % we want gourlay, don't set geometric
+ % geometric= 1.4;
+ gourlay_maxmeasures = 9.;
+ \output "standchen-16.out";
+ }
+ \midi{
+ \tempo 4 = 54;
+ }
+}
\header{
filename wohltemperirt.ly
title Fuga a 3
-description Das Wohltemperirte Clavier I, Fuga II (c-minor)
-opus BWV ?
+description Das Wohltemperierte Clavier I, Fuga II (c-minor)
+opus BWV 847-Fuga
source Henle's Urtext
composer Johann Sebastian Bach (1685-1750)
enteredby HWN and Werner Lemberg
-copyright Public Domain"
+copyright Public Domain
}
%{
Tested Features: stem direction, multivoice, forced accidentals.
#include "binary-source-file.hh"
#include "string-convert.hh"
-Binary_source_file::Binary_source_file( String& filename_str )
- : Source_file( filename_str )
+Binary_source_file::Binary_source_file(String& filename_str)
+ : Source_file(filename_str)
{
}
}
String
-Binary_source_file::error_str( char const* pos_ch_c_l ) const
+Binary_source_file::error_str(char const* pos_ch_c_l) const
{
- assert( this );
- if ( !in_b( pos_ch_c_l ) )
+ assert(this);
+ if (!in_b(pos_ch_c_l))
return "";
char const* begin_ch_c_l = pos_ch_c_l - 8 >? ch_C();
char const* end_ch_c_l = pos_ch_c_l + 7 <? ch_C() + length_i();
- String pre_str( (Byte const*)begin_ch_c_l, pos_ch_c_l - begin_ch_c_l );
- pre_str = String_convert::bin2hex_str( pre_str );
- for ( int i = 2; i < pre_str.length_i(); i += 3 )
- pre_str = pre_str.left_str( i ) + " " + pre_str.mid_str( i, INT_MAX );
- String post_str( (Byte const*)pos_ch_c_l, end_ch_c_l - pos_ch_c_l );
- post_str = String_convert::bin2hex_str( post_str );
- for ( int i = 2; i < post_str.length_i(); i += 3 )
- post_str = post_str.left_str( i ) + " " + post_str.mid_str( i, INT_MAX );
+ String pre_str((Byte const*)begin_ch_c_l, pos_ch_c_l - begin_ch_c_l);
+ pre_str = String_convert::bin2hex_str(pre_str);
+ for (int i = 2; i < pre_str.length_i(); i += 3)
+ pre_str = pre_str.left_str(i) + " " + pre_str.mid_str(i, INT_MAX);
+ String post_str((Byte const*)pos_ch_c_l, end_ch_c_l - pos_ch_c_l);
+ post_str = String_convert::bin2hex_str(post_str);
+ for (int i = 2; i < post_str.length_i(); i += 3)
+ post_str = post_str.left_str(i) + " " + post_str.mid_str(i, INT_MAX);
String str = pre_str
- + String( '\n' )
- + String( ' ', pre_str.length_i() + 1 )
+ + String('\n')
+ + String(' ', pre_str.length_i() + 1)
+ post_str;
return str;
}
int
-Binary_source_file::line_i( char const* pos_ch_c_l ) const
+Binary_source_file::line_i(char const* pos_ch_c_l) const
{
- if ( !in_b( pos_ch_c_l ) )
+ if (!in_b(pos_ch_c_l))
return 0;
return pos_ch_c_l - ch_C();
Array<Duration> Duration_convert::dur_array_s;
String
-Duration_convert::dur2_str( Duration dur )
+Duration_convert::dur2_str(Duration dur)
{
- if ( dur.ticks_i_ )
- return String( "[" ) + String( dur.ticks_i_ ) + "]";
+ if (dur.ticks_i_)
+ return String("[") + String(dur.ticks_i_) + "]";
- String str;
- if (dur.durlog_i_ <= 0)
- str="\\breve";
- else
- str= String( type2_i(dur.durlog_i_) );
- str += String( '.', dur.dots_i_ );
- if ( dur.plet_b())
- str += String( "*" ) + String( dur.plet_.iso_i_ )
- + String( "/" ) + String( dur.plet_.type_i_ );
- return str;
+ String str;
+ if (dur.durlog_i_ <= 0)
+ str="\\breve";
+ else
+ str= String(type2_i(dur.durlog_i_));
+ str += String('.', dur.dots_i_);
+ if (dur.plet_b())
+ str += String("*") + String(dur.plet_.iso_i_)
+ + String("/") + String(dur.plet_.type_i_);
+ return str;
}
#if 0
int
-Duration_convert::dur2_i( Duration dur, int division_1_i )
+Duration_convert::dur2_i(Duration dur, int division_1_i)
{
- return dur2_mom( dur ) * Moment( division_1_i );
+ return dur2_mom(dur) * Moment(division_1_i);
}
#endif
int
-Duration_convert::dur2ticks_i( Duration dur )
+Duration_convert::dur2ticks_i(Duration dur)
{
- if ( dur.ticks_i_ )
- return dur.ticks_i_;
- return dur2_mom( dur ) * Moment( Duration::division_1_i_s );
+ if (dur.ticks_i_)
+ return dur.ticks_i_;
+ return dur2_mom(dur) * Moment(Duration::division_1_i_s);
}
int
Duration_convert::i2_type(int i)
{
- int t=0;
- while (!(i & 1)) {
- i >>= 1;
- t++;
- }
- return t;
+ int t=0;
+ while (!(i & 1)) {
+ i >>= 1;
+ t++;
+ }
+ return t;
}
int
Duration_convert::type2_i(int type)
{
- if (type<0)
- return 0;
- else
- return 1 << type;
+ if (type<0)
+ return 0;
+ else
+ return 1 << type;
}
Moment
-Duration_convert::dur2_mom( Duration dur )
+Duration_convert::dur2_mom(Duration dur)
{
- if ( dur.ticks_i_ )
- return Moment( dur.ticks_i_, Duration::division_1_i_s );
-
- // or simply assert?
- if ( dur.durlog_i_<-10 )
- return Moment( 0 );
- Moment mom;
- if (dur.durlog_i_<0)
- mom = Moment( type2_i( -dur.durlog_i_ ), 1 );
- else
- mom = Moment( 1 , type2_i( dur.durlog_i_ ) );
-
- Moment delta = mom;
- while ( dur.dots_i_-- )
- {
- delta /= 2.0;
- mom += delta;
- }
-
- return mom * plet_factor_mom( dur );
+ if (dur.ticks_i_)
+ return Moment(dur.ticks_i_, Duration::division_1_i_s);
+
+ // or simply assert?
+ if (dur.durlog_i_<-10)
+ return Moment(0);
+ Moment mom;
+ if (dur.durlog_i_<0)
+ mom = Moment(type2_i(-dur.durlog_i_), 1);
+ else
+ mom = Moment(1 , type2_i(dur.durlog_i_));
+
+ Moment delta = mom;
+ while (dur.dots_i_--)
+ {
+ delta /= 2.0;
+ mom += delta;
+ }
+
+ return mom * plet_factor_mom(dur);
}
#if 0
Moment
-Duration_convert::i2_mom( int time_i, int division_1_i )
+Duration_convert::i2_mom(int time_i, int division_1_i)
{
- if ( !time_i )
- return Moment( 0 );
+ if (!time_i)
+ return Moment(0);
- if ( division_1_i > 0 )
- return Moment( time_i, division_1_i );
- else
- return Moment( -division_1_i, time_i );
+ if (division_1_i > 0)
+ return Moment(time_i, division_1_i);
+ else
+ return Moment(-division_1_i, time_i);
}
#endif
Duration
-Duration_convert::mom2_dur( Moment mom )
+Duration_convert::mom2_dur(Moment mom)
{
- if (!mom)
- {
- Duration dur;
- dur.set_plet(0,1);
- return dur;
- }
+ if (!mom)
+ {
+ Duration dur;
+ dur.set_plet(0,1);
+ return dur;
+ }
- Duration dur = mom2standardised_dur( mom );
-// if ( !dur.mom() || ( dur.mom() == mom ) )
- if ( !dur.length() || ( dur.length() == mom ) )
- return dur;
- assert( midi_as_plet_b_s );
-
-// dur.set_plet( type_mom, Duration::division_1_i_s / 4 );
-
-// Moment as_plet_mom = mom / dur.mom();
- Moment as_plet_mom = mom / dur.length();
- as_plet_mom *= dur.plet_.mom();
- long num = as_plet_mom.numerator().as_long();
- long den = as_plet_mom.denominator().as_long();
- dur.set_plet( num, den );
- return dur;
+ Duration dur = mom2standardised_dur(mom);
+ // if (!dur.mom() || (dur.mom() == mom))
+ if (!dur.length() || (dur.length() == mom))
+ return dur;
+ assert(midi_as_plet_b_s);
+
+ // dur.set_plet(type_mom, Duration::division_1_i_s / 4);
+
+ // Moment as_plet_mom = mom / dur.mom();
+ Moment as_plet_mom = mom / dur.length();
+ as_plet_mom *= dur.plet_.mom();
+ long num = as_plet_mom.numerator().as_long();
+ long den = as_plet_mom.denominator().as_long();
+ dur.set_plet(num, den);
+ return dur;
}
Duration
-Duration_convert::mom2standardised_dur( Moment mom )
+Duration_convert::mom2standardised_dur(Moment mom)
{
-// if ( !dur_array_s.length_i() )
- if ( !dur_array_s.size() )
- set_array();
- assert( dur_array_s.size() );
- for ( int i = 0; i < dur_array_s.size() - 1; i++ )
- {
- Moment lower_mom = dur2_mom( dur_array_s[ i ] );
- if ( mom <= lower_mom )
- {
- // all arbitrary, but 3/4 will get rid of the noise...
- // kinda ok
- if ( i || ( mom / lower_mom > Moment( 3, 4 ) ) )
- return dur_array_s[ i ];
- else
- {
- Duration d;
- d.durlog_i_ = -100;
- return d;
- }
- }
- Moment upper_mom = dur2_mom( dur_array_s[ i + 1 ] );
- if ( ( mom < upper_mom )
- && ( ( mom - lower_mom ) / lower_mom
- < ( upper_mom - mom ) / upper_mom ) )
- return dur_array_s[ i ];
- }
- return dur_array_s[ dur_array_s.size() - 1 ];
+ // if (!dur_array_s.length_i())
+ if (!dur_array_s.size())
+ set_array();
+ assert(dur_array_s.size());
+ for (int i = 0; i < dur_array_s.size() - 1; i++)
+ {
+ Moment lower_mom = dur2_mom(dur_array_s[ i ]);
+ if (mom <= lower_mom)
+ {
+ // all arbitrary, but 3/4 will get rid of the noise...
+ // kinda ok
+ if (i || (mom / lower_mom > Moment(3, 4)))
+ return dur_array_s[ i ];
+ else
+ {
+ Duration d;
+ d.durlog_i_ = -100;
+ return d;
+ }
+ }
+ Moment upper_mom = dur2_mom(dur_array_s[ i + 1 ]);
+ if ((mom < upper_mom)
+ && ((mom - lower_mom) / lower_mom
+ < (upper_mom - mom) / upper_mom))
+ return dur_array_s[ i ];
+ }
+ return dur_array_s[ dur_array_s.size() - 1 ];
}
void
Duration_convert::set_array()
{
- dur_array_s.clear();
+ dur_array_s.clear();
- Duration_iterator iter_dur;
- assert( iter_dur );
- while ( iter_dur )
- dur_array_s.push( iter_dur++ );
+ Duration_iterator iter_dur;
+ assert(iter_dur);
+ while (iter_dur)
+ dur_array_s.push(iter_dur++);
}
Moment
-Duration_convert::plet_factor_mom( Duration dur )
+Duration_convert::plet_factor_mom(Duration dur)
{
- return dur.plet_.mom();
+ return dur.plet_.mom();
}
Real
-Duration_convert::sync_f( Duration dur, Moment mom )
+Duration_convert::sync_f(Duration dur, Moment mom)
{
- return mom / dur2_mom( dur );
+ return mom / dur2_mom(dur);
}
Duration
-Duration_convert::ticks2_dur( int ticks_i )
+Duration_convert::ticks2_dur(int ticks_i)
{
-// Duration dur( 4, 0 );
-// dur.set_plet( ticks_i, Duration::division_1_i_s / 4 );
+ // Duration dur(4, 0);
+ // dur.set_plet(ticks_i, Duration::division_1_i_s / 4);
- Moment mom( ticks_i, Duration::division_1_i_s );
- if ( midi_as_plet_b_s )
- return mom2_dur( mom );
+ Moment mom(ticks_i, Duration::division_1_i_s);
+ if (midi_as_plet_b_s)
+ return mom2_dur(mom);
- Duration dur = mom2standardised_dur( mom );
+ Duration dur = mom2standardised_dur(mom);
-// if ( dur.mom() == mom )
- if ( dur.length() == mom )
- return dur;
+ // if (dur.mom() == mom)
+ if (dur.length() == mom)
+ return dur;
// huh?
#if 0
- dur.durlog_i_ = -100;
- dur.dots_i_ = 0;
- dur.set_ticks( ticks_i );
- return dur;
+ dur.durlog_i_ = -100;
+ dur.dots_i_ = 0;
+ dur.set_ticks(ticks_i);
+ return dur;
#else
- return mom2_dur( mom );
+ return mom2_dur(mom);
#endif
}
Duration
-Duration_convert::ticks2standardised_dur( int ticks_i )
+Duration_convert::ticks2standardised_dur(int ticks_i)
{
- Moment mom( ticks_i, Duration::division_1_i_s );
- Duration dur = mom2standardised_dur( mom );
- return dur;
+ Moment mom(ticks_i, Duration::division_1_i_s);
+ Duration dur = mom2standardised_dur(mom);
+ return dur;
}
Duration_iterator::Duration_iterator()
{
- cursor_dur_.durlog_i_ = 7;
- if ( Duration_convert::no_smaller_than_i_s )
- cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s;
-// cursor_dur_.set_plet( 1, 1 );
+ cursor_dur_.durlog_i_ = 7;
+ if (Duration_convert::no_smaller_than_i_s)
+ cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s;
+ // cursor_dur_.set_plet(1, 1);
}
Duration
Duration_iterator::operator ++(int)
{
- return forward_dur();
+ return forward_dur();
}
Duration
Duration_iterator::operator ()()
{
- return dur();
+ return dur();
}
Duration_iterator::operator bool()
{
- return ok();
+ return ok();
}
Duration
Duration_iterator::dur()
{
- return cursor_dur_;
+ return cursor_dur_;
}
Duration
Duration_iterator::forward_dur()
{
- /* should do smart table? guessing:
- duration wholes
- 16 0.0625
- 32.. 0.0703
- 8:2/3 0.0833
- 16. 0.0938
- 8 0.1250
- 16.. 0.1406
- 4:2/3 0.1667
- 8. 0.1875
+ /* should do smart table? guessing:
+ duration wholes
+ 16 0.0625
+ 32.. 0.0703
+ 8:2/3 0.0833
+ 16. 0.0938
+ 8 0.1250
+ 16.. 0.1406
+ 4:2/3 0.1667
+ 8. 0.1875
- */
- assert( ok() );
-
- Duration dur = cursor_dur_;
-
- if ( !cursor_dur_.dots_i_ && !cursor_dur_.plet_b() )
- {
- cursor_dur_.durlog_i_ += 1;
- cursor_dur_.dots_i_ = 2;
- }
- else if ( cursor_dur_.dots_i_ == 2 )
- {
- assert( !cursor_dur_.plet_b() );
- cursor_dur_.dots_i_ = 0;
- cursor_dur_.durlog_i_ -=2;
- cursor_dur_.set_plet( 2, 3 );
- }
- else if ( cursor_dur_.plet_b()
- && ( cursor_dur_.plet_.iso_i_ == 2 )
- && ( cursor_dur_.plet_.type_i_ == 3 ) )
- {
- assert( !cursor_dur_.dots_i_ );
- cursor_dur_.set_plet( 1, 1 );
- cursor_dur_.durlog_i_ += 1;
- cursor_dur_.dots_i_ = 1;
- }
- else if ( cursor_dur_.dots_i_ == 1 )
- {
- assert( !cursor_dur_.plet_b() );
- cursor_dur_.dots_i_ = 0;
- cursor_dur_.durlog_i_ -= 1;
- }
+ */
+ assert(ok());
+
+ Duration dur = cursor_dur_;
+
+ if (!cursor_dur_.dots_i_ && !cursor_dur_.plet_b())
+ {
+ cursor_dur_.durlog_i_ += 1;
+ cursor_dur_.dots_i_ = 2;
+ }
+ else if (cursor_dur_.dots_i_ == 2)
+ {
+ assert(!cursor_dur_.plet_b());
+ cursor_dur_.dots_i_ = 0;
+ cursor_dur_.durlog_i_ -=2;
+ cursor_dur_.set_plet(2, 3);
+ }
+ else if (cursor_dur_.plet_b()
+ && (cursor_dur_.plet_.iso_i_ == 2)
+ && (cursor_dur_.plet_.type_i_ == 3))
+ {
+ assert(!cursor_dur_.dots_i_);
+ cursor_dur_.set_plet(1, 1);
+ cursor_dur_.durlog_i_ += 1;
+ cursor_dur_.dots_i_ = 1;
+ }
+ else if (cursor_dur_.dots_i_ == 1)
+ {
+ assert(!cursor_dur_.plet_b());
+ cursor_dur_.dots_i_ = 0;
+ cursor_dur_.durlog_i_ -= 1;
+ }
- if ( Duration_convert::no_triplets_b_s
- && cursor_dur_.plet_b() && ok() )
- forward_dur();
- if ( Duration_convert::no_double_dots_b_s
- && ( cursor_dur_.dots_i_ == 2 ) && ok() )
- forward_dur();
- if ( Duration_convert::no_smaller_than_i_s
- && ( cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s ) && ok() )
- forward_dur();
- if ( Duration_convert::no_smaller_than_i_s
- && cursor_dur_.dots_i_
- && ( cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s )
- && ok() )
- forward_dur();
- if ( Duration_convert::no_smaller_than_i_s
- && ( cursor_dur_.dots_i_ == 2 )
- && ( cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2 )
- && ok() )
- forward_dur();
-
- return dur;
+ if (Duration_convert::no_triplets_b_s
+ && cursor_dur_.plet_b() && ok())
+ forward_dur();
+ if (Duration_convert::no_double_dots_b_s
+ && (cursor_dur_.dots_i_ == 2) && ok())
+ forward_dur();
+ if (Duration_convert::no_smaller_than_i_s
+ && (cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s) && ok())
+ forward_dur();
+ if (Duration_convert::no_smaller_than_i_s
+ && cursor_dur_.dots_i_
+ && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s)
+ && ok())
+ forward_dur();
+ if (Duration_convert::no_smaller_than_i_s
+ && (cursor_dur_.dots_i_ == 2)
+ && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2)
+ && ok())
+ forward_dur();
+
+ return dur;
}
bool
Duration_iterator::ok()
{
- return ( cursor_dur_.durlog_i_
- && !( ( cursor_dur_.durlog_i_ == 0 ) && ( cursor_dur_.dots_i_ > 2 ) ) );
+ return (cursor_dur_.durlog_i_
+ && !((cursor_dur_.durlog_i_ == 0) && (cursor_dur_.dots_i_ > 2)));
}
/*
ugh. Assuming behavior of conversion funcs on broken input.
*/
- return t == Duration_convert::type2_i( Duration_convert::i2_type(t));
+ return t == Duration_convert::type2_i(Duration_convert::i2_type(t));
}
// ugh, what's this?
}
void
-Duration::set_ticks( int ticks_i )
+Duration::set_ticks(int ticks_i)
{
- assert( durlog_i_ <10 );
- assert( !dots_i_ );
+ assert(durlog_i_ <10);
+ assert(!dots_i_);
ticks_i_ = ticks_i;
}
String
-Duration::str()const
+Duration::str() const
{
return Duration_convert::dur2_str(*this);
}
+++ /dev/null
-/*
- file-storage.cc -- implement Mapped_file_storage
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
- Jan Nieuwenhuizen <jan@digicash.com>
-*/
-#include <sys/types.h> // open, mmap
-#include <sys/stat.h> // open
-#include <sys/mman.h> // mmap
-#include <limits.h> // INT_MAX
-#include <fcntl.h> // open
-#include <unistd.h> // close, stat
-#include <stdio.h> // fdopen
-#include <string.h> // strerror
-#include <errno.h> // errno
-
-
-
-#include "string.hh"
-#include "proto.hh"
-#include "warn.hh"
-#include "file-storage.hh"
-
-Mapped_file_storage::Mapped_file_storage(String s)
-{
- data_caddr_ = 0;
- fildes_i_ = 0;
- size_off_ = 0;
- open(s);
-}
-
-char const*
-Mapped_file_storage::ch_C()const
-{
- return (char const*)data_caddr_;
-}
-
-void
-Mapped_file_storage::map()
-{
- if ( fildes_i_ == -1 )
- return;
-
- data_caddr_ = (caddr_t)mmap( (void*)0, size_off_, PROT_READ, MAP_SHARED, fildes_i_, 0 );
-
- if ( (int)data_caddr_ == -1 )
- warning( String( "can't map: error no: " ) + strerror( errno ));
-}
-
-
-void
-Mapped_file_storage::open(String name_str)
-{
- fildes_i_ = ::open( name_str, O_RDONLY );
-
- if ( fildes_i_ == -1 )
- {
- warning( String( "can't open: " ) + name_str + String( ": " ) + strerror( errno ));
- return;
- }
-
- struct stat file_stat;
- fstat( fildes_i_, &file_stat );
- size_off_ = file_stat.st_size;
- map();
-}
-
-void
-Mapped_file_storage::unmap()
-{
- if ( data_caddr_ )
- {
- munmap( data_caddr_, size_off_ );
- data_caddr_ = 0;
- size_off_ = 0;
- }
-}
-
-void
-Mapped_file_storage::close()
-{
- unmap();
- if ( fildes_i_ )
- {
- ::close( fildes_i_ );
- fildes_i_ = 0;
- }
-}
-
-int
-Mapped_file_storage::length_i()const
-{
- return size_off_;
-}
-
-Mapped_file_storage::~Mapped_file_storage()
-{
- close();
-}
Includable_lexer::Includable_lexer()
{
- yy_current_buffer = 0;
+ yy_current_buffer = 0;
}
/** set the new input to s, remember old file.
void
Includable_lexer::new_input(String s, Sources * global_sources)
{
- Source_file * sl = global_sources->get_file_l(s);
- if (!sl)
- {
- LexerError("Can't find file `" + s+ "'");
- return;
- }
+ Source_file * sl = global_sources->get_file_l(s);
+ if (!sl)
+ {
+ LexerError("Can't find file `" + s+ "'");
+ return;
+ }
- char_count_stack_.push(0);
- if (yy_current_buffer)
- state_stack_.push(yy_current_buffer);
- cout << "[" << s<<flush;
- include_stack_.push(sl);
+ char_count_stack_.push(0);
+ if (yy_current_buffer)
+ state_stack_.push(yy_current_buffer);
+ cout << "[" << s<<flush;
+ include_stack_.push(sl);
- /*
- ugh. We'd want to create a buffer from the bytes directly.
+ /*
+ ugh. We'd want to create a buffer from the bytes directly.
- Whoops. The size argument to yy_create_buffer is not the
- filelength but a BUFFERSIZE. Maybe this is why reading stdin fucks up.
+ Whoops. The size argument to yy_create_buffer is not the
+ filelength but a BUFFERSIZE. Maybe this is why reading stdin fucks up.
- Maybe this is also the reason why LilyPond sometimes crashed
- mysteriously in yy_create_buffer() with a libc-malloc error
-
- */
- yy_switch_to_buffer(yy_create_buffer( sl->istream_l(), YY_BUF_SIZE ));
+ */
+ yy_switch_to_buffer(yy_create_buffer(sl->istream_l(), YY_BUF_SIZE));
}
/** pop the inputstack. conceptually this is a destructor, but it
bool
Includable_lexer::close_input()
{
- include_stack_.pop();
- char_count_stack_.pop();
- cout << "]"<<flush;
- yy_delete_buffer(yy_current_buffer );
- yy_current_buffer = 0;
- if (state_stack_.empty())
- {
- return false;
+ include_stack_.pop();
+ char_count_stack_.pop();
+ cout << "]"<<flush;
+ yy_delete_buffer(yy_current_buffer);
+ yy_current_buffer = 0;
+ if (state_stack_.empty())
+ {
+ return false;
}else
{
yy_switch_to_buffer(state_stack_.pop());
char const*
Includable_lexer::here_ch_C()
{
- if (include_stack_.empty())
- return 0;
- return include_stack_.top()->ch_C() + char_count_stack_.top();
+ if (include_stack_.empty())
+ return 0;
+ return include_stack_.top()->ch_C() + char_count_stack_.top();
}
Includable_lexer::~Includable_lexer()
{
- while (!include_stack_.empty())
- {
- close_input();
- };
+ while (!include_stack_.empty())
+ {
+ close_input();
+ }
}
/**
Since we don't create the buffer state from the bytes directly, we
void
Includable_lexer::add_lexed_char(int count)
{
- char_count_stack_.top() += count;
+ char_count_stack_.top() += count;
}
Source_file*
-Includable_lexer::source_file_l()const
+Includable_lexer::source_file_l() const
{
- if (include_stack_.empty())
- return 0;
- else
- return include_stack_.top();
+ if (include_stack_.empty())
+ return 0;
+ else
+ return include_stack_.top();
}
Duration();
/// is the "plet factor" of this note != 1 ?
bool plet_b();
- String str()const;
+ String str() const;
void set_plet(int,int );
void set_plet(Duration );
static bool duration_type_b(int t);
class File_storage
{
public:
- virtual char const* ch_C()const=0;
- virtual int length_i()const=0;
+ virtual char const* ch_C() const=0;
+ virtual int length_i() const=0;
virtual ~File_storage(){}
};
public:
Mapped_file_storage(String);
protected:
- virtual char const* ch_C()const;
- virtual int length_i()const;
+ virtual char const* ch_C() const;
+ virtual int length_i() const;
virtual ~Mapped_file_storage();
private:
void open(String name);
char * data_p_;
int len_i_;
protected:
- virtual char const*ch_C()const;
- virtual int length_i()const;
+ virtual char const*ch_C() const;
+ virtual int length_i() const;
virtual ~Simple_file_storage();
public:
Simple_file_storage(String);
Array<int> char_count_stack_;
public:
- Source_file* source_file_l()const;
+ Source_file* source_file_l() const;
void new_input(String s,Sources*);
Includable_lexer();
~Includable_lexer();
Source_file * source_file_l_;
public:
- void warning(String)const; // should use member func?
- void error(String)const;
- void message(String)const;
+ void warning(String) const; // should use member func?
+ void error(String) const;
+ void message(String) const;
void set_spot(Input const &);
- String location_str()const;
+ String location_str() const;
Input(Source_file*, char const*);
Input();
Input( Input const& );
*/
struct Plet {
Plet();
- Moment mom()const;
- bool unit_b()const;
+ Moment mom() const;
+ bool unit_b() const;
int iso_i_; // 2/3; 2 is not duration, maar of count!
int type_i_;
};
Source_file( String filename_str_r );
virtual ~Source_file();
- char const* ch_C()const;
- virtual String error_str( char const* pos_ch_c_l )const;
+ char const* ch_C() const;
+ virtual String error_str( char const* pos_ch_c_l ) const;
istream * istream_l();
- bool in_b( char const* pos_ch_c_l )const;
- int length_i()const;
- virtual int line_i( char const* pos_ch_c_l )const;
- String name_str()const;
- String file_line_no_str( char const* ch_c_l )const;
+ bool in_b( char const* pos_ch_c_l ) const;
+ int length_i() const;
+ virtual int line_i( char const* pos_ch_c_l ) const;
+ String name_str() const;
+ String file_line_no_str( char const* ch_c_l ) const;
private:
String name_str_;
}
void
-Input::message(String message_str)const
+Input::message(String message_str) const
{
String str = "";
- if ( source_file_l_ )
+ if (source_file_l_)
{
str += location_str() + String(": ");
}
str += message_str;
- if ( source_file_l_ )
+ if (source_file_l_)
{
str += ":\n";
- str += source_file_l_->error_str( defined_ch_C_);
+ str += source_file_l_->error_str(defined_ch_C_);
}
cerr << str << endl;
}
void
-Input::warning( String message_str)const
+Input::warning(String message_str) const
{
- message( "warning: " + message_str);
+ message("warning: " + message_str);
}
void
-Input::error(String s)const
+Input::error(String s) const
{
message("error: "+ s);
}
String
-Input::location_str()const
+Input::location_str() const
{
if (source_file_l_)
return source_file_l_->file_line_no_str(defined_ch_C_);
--- /dev/null
+/*
+ file-storage.cc -- implement Mapped_file_storage
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ Jan Nieuwenhuizen <jan@digicash.com>
+*/
+#include <sys/types.h> // open, mmap
+#include <sys/stat.h> // open
+#include <sys/mman.h> // mmap
+#include <limits.h> // INT_MAX
+#include <fcntl.h> // open
+#include <unistd.h> // close, stat
+#include <stdio.h> // fdopen
+#include <string.h> // strerror
+#include <errno.h> // errno
+
+
+
+#include "string.hh"
+#include "proto.hh"
+#include "warn.hh"
+#include "file-storage.hh"
+
+Mapped_file_storage::Mapped_file_storage(String s)
+{
+ data_caddr_ = 0;
+ fildes_i_ = 0;
+ size_off_ = 0;
+ open(s);
+}
+
+char const*
+Mapped_file_storage::ch_C() const
+{
+ return (char const*)data_caddr_;
+}
+
+void
+Mapped_file_storage::map()
+{
+ if (fildes_i_ == -1)
+ return;
+
+ data_caddr_ = (caddr_t)mmap((void*)0, size_off_, PROT_READ, MAP_SHARED, fildes_i_, 0);
+
+ if ((int)data_caddr_ == -1)
+ warning(String("can't map: error no: ") + strerror(errno));
+}
+
+
+void
+Mapped_file_storage::open(String name_str)
+{
+ fildes_i_ = ::open(name_str, O_RDONLY);
+
+ if (fildes_i_ == -1)
+ {
+ warning(String("can't open: ") + name_str + String(": ") + strerror(errno));
+ return;
+ }
+
+ struct stat file_stat;
+ fstat(fildes_i_, &file_stat);
+ size_off_ = file_stat.st_size;
+ map();
+}
+
+void
+Mapped_file_storage::unmap()
+{
+ if (data_caddr_)
+ {
+ munmap(data_caddr_, size_off_);
+ data_caddr_ = 0;
+ size_off_ = 0;
+ }
+}
+
+void
+Mapped_file_storage::close()
+{
+ unmap();
+ if (fildes_i_)
+ {
+ ::close(fildes_i_);
+ fildes_i_ = 0;
+ }
+}
+
+int
+Mapped_file_storage::length_i() const
+{
+ return size_off_;
+}
+
+Mapped_file_storage::~Mapped_file_storage()
+{
+ close();
+}
}
Moment
-Plet::mom()const
+Plet::mom() const
{
- return Moment( iso_i_, type_i_ );
+ return Moment(iso_i_, type_i_);
}
bool
-Plet::unit_b()const
+Plet::unit_b() const
{
return type_i_ == 1 && iso_i_ == 1;
}
Stupid but foolproof way of opening files.
TODO
- Should use obstack. Should check IO status
+ Should check IO status
This is of course a build it yourself version of mmap, so we should
have been using that... (see Mapped_file_storage) But we noticed
some problems with this (unexplained lexer crashes)
- */
+ [Some versions later] The crashes aren't caused by the mmap
+ code. But no reason to take it out, is there? */
Simple_file_storage::Simple_file_storage(String s)
{
- data_p_ =0;
- FILE * f = fopen ( s.ch_C(), "r");
- if ( !f )
- {
- warning("can't open file\n");
- return ;
- }
+ data_p_ =0;
+ /*
+ let's hope that "b" opens anything binary, and does not apply
+ CR/LF translation
+ */
+ FILE * f = fopen (s.ch_C(), "rb");
+ if (!f)
+ {
+ warning("can't open file\n");
+ return ;
+ }
- int ret = fseek( f, 0, SEEK_END);
- len_i_ = ftell(f);
- rewind(f);
- data_p_ = new char[len_i_+1];
- data_p_[len_i_] = 0;
- ret = fread(data_p_, sizeof(char), len_i_, f);
-#ifndef __CYGWIN32__ // ugh, \r\n -> \n translation
- assert (ret==len_i_);
+ int ret = fseek(f, 0, SEEK_END);
+ len_i_ = ftell(f);
+ rewind(f);
+ data_p_ = new char[len_i_+1];
+ data_p_[len_i_] = 0;
+ ret = fread(data_p_, sizeof(char), len_i_, f);
+
+
+#if 1 // ugh, \r\n -> \n translation
+ assert (ret==len_i_);
#endif
- fclose(f);
+ fclose(f);
}
char const*
Simple_file_storage::ch_C() const
{
- return data_p_;
+ return data_p_;
}
int
-Simple_file_storage::length_i()const
+Simple_file_storage::length_i() const
{
- return len_i_;
+ return len_i_;
}
Simple_file_storage::~Simple_file_storage()
{
- delete []data_p_;
+ delete []data_p_;
}
#include "source-file.hh"
#include "file-storage.hh"
-Source_file::Source_file( String filename_str )
+Source_file::Source_file(String filename_str)
{
name_str_ = filename_str;
istream_p_ = 0;
istream*
Source_file::istream_l()
{
- if ( !name_str_.length_i())
+ if (!name_str_.length_i())
return &cin;
- if ( !istream_p_ )
+ if (!istream_p_)
{
- if ( length_i() ) // can-t this be done without such a hack?
- istream_p_ = new istrstream( ch_C(), length_i() );
+ if (length_i()) // can-t this be done without such a hack?
+ istream_p_ = new istrstream(ch_C(), length_i());
else
{
- istream_p_ = new istrstream( "", 0 );
+ istream_p_ = new istrstream("", 0);
istream_p_->set(ios::eofbit);
}
}
}
String
-Source_file::file_line_no_str(char const *ch_C )const
+Source_file::file_line_no_str(char const *context_ch_C) const
{
+ if (!ch_C())
+ return "(unknown)";
+ else
return name_str() + ": "
- + String( line_i( ch_C ) );
+ + String(line_i(context_ch_C));
}
String
-Source_file::name_str()const
+Source_file::name_str() const
{
return name_str_;
}
}
String
-Source_file::error_str( char const* pos_ch_C )const
+Source_file::error_str(char const* pos_ch_C) const
{
char const* data_ch_C = ch_C();
char const * eof_C_ = data_ch_C + length_i();
- if ( !in_b( pos_ch_C ) )
+ if (!in_b(pos_ch_C))
return "(position unknown)";
- if ( pos_ch_C == eof_C_)
+ if (pos_ch_C == eof_C_)
pos_ch_C --;
char const* begin_ch_C = pos_ch_C;
- while ( begin_ch_C > data_ch_C )
- if ( *--begin_ch_C == '\n' )
+ while (begin_ch_C > data_ch_C)
+ if (*--begin_ch_C == '\n')
{
begin_ch_C++;
break;
}
char const* end_ch_C = pos_ch_C;
- while ( end_ch_C < eof_C_ )
- if ( *end_ch_C++ == '\n' )
+ while (end_ch_C < eof_C_)
+ if (*end_ch_C++ == '\n')
{
end_ch_C--;
break;
}
- // String( char const* p, int length ) is missing!?
- String line_str( (Byte const*)begin_ch_C, end_ch_C - begin_ch_C );
+ // String(char const* p, int length) is missing!?
+ String line_str((Byte const*)begin_ch_C, end_ch_C - begin_ch_C);
int error_col_i = 0;
char const* scan_ch_C = begin_ch_C;
- while ( scan_ch_C < pos_ch_C )
- if ( *scan_ch_C++ == '\t' )
- error_col_i = ( error_col_i / 8 + 1 ) * 8;
+ while (scan_ch_C < pos_ch_C)
+ if (*scan_ch_C++ == '\t')
+ error_col_i = (error_col_i / 8 + 1) * 8;
else
error_col_i++;
- String str = line_str.left_str( pos_ch_C - begin_ch_C )
- + String( '\n' )
- + String( ' ', error_col_i )
- + line_str.mid_str( pos_ch_C - begin_ch_C, INT_MAX ); // String::mid should take 0 arg..
+ String str = line_str.left_str(pos_ch_C - begin_ch_C)
+ + String('\n')
+ + String(' ', error_col_i)
+ + line_str.mid_str(pos_ch_C - begin_ch_C, INT_MAX); // String::mid should take 0 arg..
return str;
}
bool
-Source_file::in_b( char const* pos_ch_C )const
+Source_file::in_b(char const* pos_ch_C) const
{
- return ( pos_ch_C && ( pos_ch_C >= ch_C() ) && ( pos_ch_C <= ch_C() + length_i() ) );
+ return (pos_ch_C && (pos_ch_C >= ch_C()) && (pos_ch_C <= ch_C() + length_i()));
}
int
-Source_file::line_i( char const* pos_ch_C )const
+Source_file::line_i(char const* pos_ch_C) const
{
- if ( !in_b( pos_ch_C ) )
+ if (!in_b(pos_ch_C))
return 0;
int i = 1;
char const* scan_ch_C = ch_C();
- while ( scan_ch_C < pos_ch_C )
- if ( *scan_ch_C++ == '\n' )
+ if (!scan_ch_C)
+ return 0;
+
+ while (scan_ch_C < pos_ch_C)
+ if (*scan_ch_C++ == '\n')
i++;
return i;
}
int
-Source_file::length_i()const
+Source_file::length_i() const
{
return storage_p_->length_i();
}
char const *
-Source_file::ch_C()const
+Source_file::ch_C() const
{
return storage_p_->ch_C();
}
Sources::Sources()
{
- path_C_= 0;
- binary_b_ = false;
+ path_C_= 0;
+ binary_b_ = false;
}
void
Sources::set_binary(bool bo)
{
- binary_b_ = bo;
+ binary_b_ = bo;
}
void
Sources::set_path(File_path *f_C)
{
- path_C_ = f_C;
+ path_C_ = f_C;
}
/**
@return 0 if no file found
*/
Source_file*
-Sources::get_file_l(String &file_str ) //UGH
+Sources::get_file_l(String &file_str) //UGH
{
- if (path_C_)
- {
- String file_str_o = path_C_->find(file_str);
- if ( ( file_str_o == "" ) && ( file_str != "" ) )
- return 0;
- file_str = file_str_o;
- }
- Source_file * f_p= (!binary_b_) ?
- new Source_file(file_str) : new Binary_source_file(file_str);
- add(f_p);
- return f_p;
+ if (path_C_)
+ {
+ String file_str_o = path_C_->find(file_str);
+ if ((file_str_o == "") && (file_str != ""))
+ return 0;
+ file_str = file_str_o;
+ }
+ Source_file * f_p= (!binary_b_) ?
+ new Source_file(file_str) : new Binary_source_file(file_str);
+ add(f_p);
+ return f_p;
}
void
-Sources::add( Source_file* sourcefile_p )
+Sources::add(Source_file* sourcefile_p)
{
- sourcefile_p_list_.bottom().add( sourcefile_p );
+ sourcefile_p_list_.bottom().add(sourcefile_p);
}
/**
@return 0 if not found.
*/
Source_file*
-Sources::sourcefile_l( char const* ch_C )
+Sources::sourcefile_l(char const* ch_C)
{
- PCursor<Source_file*> sourcefile_l_pcur( sourcefile_p_list_.top() );
- for ( ; sourcefile_l_pcur.ok(); sourcefile_l_pcur++ )
- if ( sourcefile_l_pcur->in_b( ch_C ) )
- return *sourcefile_l_pcur;
- return 0;
+ PCursor<Source_file*> sourcefile_l_pcur(sourcefile_p_list_.top());
+ for (; sourcefile_l_pcur.ok(); sourcefile_l_pcur++)
+ if (sourcefile_l_pcur->in_b(ch_C))
+ return *sourcefile_l_pcur;
+ return 0;
}
#include "cursor.tcc"
#include "list.tcc"
-template L_INSTANTIATE(void *);
-template IPL_INSTANTIATE(Source_file);
+template LIST_INSTANTIATE(void *);
+template POINTERLIST_INSTANTIATE(Source_file);
DWORD dwMaximumSizeHigh, // high-order 32 bits of object size
DWORD dwMaximumSizeLow, // low-order 32 bits of object size
LPCTSTR lpName // name of file-mapping object
- );
+);
LPVOID MapViewOfFile(
DWORD dwFileOffsetHigh, // high-order 32 bits of file offset
DWORD dwFileOffsetLow, // low-order 32 bits of file offset
DWORD dwNumberOfBytesToMap // number of bytes to map
- );
+);
io.h:
-long _get_osfhandle( int filehandle );
+long _get_osfhandle(int filehandle);
*/
// cygnus's gnu-win32-b17.1 does not have _get_osfhandle
// #define HAVE_GET_OSFHANDLE // no we still cannot; works only with cl.exe
long
-_get_osfhandle( int filedes_i )
+_get_osfhandle(int filedes_i)
{
- return (long)( OSF_OFFSET_i + ( filedes_i + OSF_BASE_i ) * OSF_FACTOR_i );
+ return (long)(OSF_OFFSET_i + (filedes_i + OSF_BASE_i) * OSF_FACTOR_i);
}
#ifdef HAVE_GET_OSFHANDLE
(void)flags;
(void)prot;
(void)addr;
- HANDLE osf = (HANDLE)_get_osfhandle( fd );
- HANDLE file_handle = CreateFileMapping( osf, (void*)0, PAGE_READONLY,
- 0, len, 0 );
- return (caddr_t)MapViewOfFile( file_handle, FILE_MAP_READ, 0, offset, len );
+ HANDLE osf = (HANDLE)_get_osfhandle(fd);
+ HANDLE file_handle = CreateFileMapping(osf, (void*)0, PAGE_READONLY,
+ 0, len, 0);
+ return (caddr_t)MapViewOfFile(file_handle, FILE_MAP_READ, 0, offset, len);
}
munmap(caddr_t addr, size_t len)
{
(void)len;
- return UnmapViewOfFile( addr );
+ return UnmapViewOfFile(addr);
}
#else // ! HAVE_GET_OSFHANDLE //
(void)addr;
(void)offset;
char* ch_p = new char[ len ];
- if ( ch_p )
- read( fd, (void*)ch_p, len );
+ if (ch_p)
+ read(fd, (void*)ch_p, len);
return ch_p;
}
MAJOR_VERSION = 0
MINOR_VERSION = 1
-PATCH_LEVEL = 10
+PATCH_LEVEL = 11
# use to send patches, always empty for released version:
# include separator: ".postfix", "-pl" makes rpm barf
-MY_PATCH_LEVEL =.jcn1
+MY_PATCH_LEVEL =
Midi_item*
Audio_instrument::midi_item_p()
{
- return str_.length_i() ? new Midi_instrument( 0, str_ ) : 0;
+ return str_.length_i() ? new Midi_instrument(0, str_) : 0;
}
Audio_item::Audio_item (Request* req_l)
Midi_item*
Audio_text::midi_item_p()
{
- return text_str_.length_i() ? new Midi_text( this ) : 0;
+ return text_str_.length_i() ? new Midi_text(this) : 0;
}
#include "audio-score.hh"
#include "score.hh"
-Audio_score::Audio_score (Score* l)
+Audio_score::Audio_score ()
{
- score_l_ = l;
+ midi_l_ =0;
}
void
midi_stream_r << Midi_header (1, tracks_i, clocks_per_4_i);
output_header_track (midi_stream_r);
int n = 1;
- for ( PCursor<Audio_staff*> i (audio_staff_l_list_); i.ok(); i++ )
+ for (PCursor<Audio_staff*> i (audio_staff_l_list_); i.ok(); i++)
i->output (midi_stream_r, n++);
}
String str = String ("Creator: ") + get_version_str() + "\n";
Midi_text creator (Midi_text::TEXT, str);
- midi_track.add (Moment (0), &creator );
+ midi_track.add (Moment (0), &creator);
str = "Automatically generated at ";
str += ctime (&t);
str = str.left_str (str.length_i() - 1);
str += "\n";
Midi_text generate (Midi_text::TEXT, str);
- midi_track.add (Moment (0), &generate );
+ midi_track.add (Moment (0), &generate);
str = "from musical definition: ";
- str += score_l_->location_str();
+ str += origin_str_;
Midi_text from (Midi_text::TEXT, str);
- midi_track.add (Moment (0), &from );
+ midi_track.add (Moment (0), &from);
Midi_text track_name (Midi_text::TRACK_NAME, "Track "
- + String_convert::i2dec_str (0, 0, '0') );
- midi_track.add (Moment (0), &track_name );
+ + String_convert::i2dec_str (0, 0, '0'));
+ midi_track.add (Moment (0), &track_name);
- Midi_tempo tempo (score_l_->midi_p_->get_tempo_i (Moment (1, 4) ) );
+ Midi_tempo tempo (midi_l_->get_tempo_i (Moment (1, 4)));
midi_track.add (Moment (0), &tempo);
midi_stream_r << midi_track;
{
#ifndef NPRINT
DOUT << "Audio_score { ";
- score_l_->midi_p_->print();
DOUT << "\ncolumns: ";
- for ( PCursor<Audio_column*> i (audio_column_p_list_); i.ok(); i++ )
+ for (PCursor<Audio_column*> i (audio_column_p_list_); i.ok(); i++)
i->print();
DOUT << "}\n";
#endif
void
Audio_score::process()
{
-}
+ String out=midi_l_->outfile_str_;
+ if (out == "")
+ out = default_out_str_ + ".midi";
+
+ Midi_stream midi_stream (out);
+ *mlog << "MIDI output to " << out<< " ..." << endl;
+ output (midi_stream);
+ *mlog << endl;
+}
{
Midi_track midi_track;
midi_track.number_i_ = track_i;
- for ( Midi_walker i (this, &midi_track); i.ok(); i++ )
+ for (Midi_walker i (this, &midi_track); i.ok(); i++)
i.process();
midi_stream_r << midi_track;
}
Link_array<Score_elem> elems = axis_admin_.elem_l_arr_;
for (int i=0; i < elems.size(); i++)
{
- Item * it_l = elems[i]->item();
- assert (it_l);
-
- // somebody probably broke it in pieces
- assert (it_l->pcol_l_ == pcol_l_);
+ Item * it_l = elems[i]->item();
+ assert (it_l);
}
}
void
Axis_group_item::do_breakable_col_processing()
{
- if (!pcol_l_->breakable_b())
- return;
+ if (!breakable_b_)
+ return;
+
OK();
copy_breakable_items();
Link_array<Score_elem> elems = axis_admin_.elem_l_arr_;
for (int i=0; i < elems.size(); i++)
{
- Item* it_l = elems[i]->item();
- for ( int j=0; j < 2; j++)
- {
- Item *new_l = it_l->find_prebroken_piece (broken_to_a_[j]->pcol_l_);
- ((Axis_group_item*)broken_to_a_[j])->add_element (new_l);
- }
+ Item* it_l = elems[i]->item();
+ Direction j=LEFT;
+ do
+ {
+ Item *new_l =
+ it_l->find_prebroken_piece (broken_to_drul_[j]->break_status_i_);
+ ((Axis_group_item*)broken_to_drul_[j])->add_element (new_l);
+ }
+ while ((j*=-1)!=LEFT);
}
Item::do_breakable_col_processing();
}
Line_of_score *my_line = line_l();
for (int i=0; i < elems.size(); i++)
{
- if (!elems[i]->line_l())
- {
- Item * item_l = elems[i]->item();
- if (item_l
- && item_l->breakable_b_
- && item_l->break_status_i() == 0)
- {
- // last two checks are paranoia
- Item * broken_item_l =
- item_l->find_prebroken_piece (my_line);
- add_element (broken_item_l);
- }
- remove_element (elems[i]);
- }
+ if (!elems[i]->line_l())
+ {
+ Item * item_l = elems[i]->item();
+ if (item_l
+ && item_l->breakable_b_
+ && item_l->break_status_i() == 0)
+ {
+ // last two checks are paranoia
+ Item * broken_item_l =
+ item_l->find_prebroken_piece (my_line);
+ add_element (broken_item_l);
+ }
+ remove_element (elems[i]);
+ }
}
-
}
void
Axis_group_spanner::do_break_processing()
{
- set_my_columns();
bool breaking_self_b = ! Spanner::line_l();
if (!breaking_self_b)
{
- do_break_processing_if_unbroken();
- Spanner::do_break_processing();
- return;
+ do_break_processing_if_unbroken();
+ Spanner::do_break_processing();
+ return;
}
- break_into_pieces (true);
+ break_into_pieces ();
Link_array<Score_elem> loose_elems = axis_admin_.elem_l_arr_;
remove_all();
for (int i=0; i < loose_elems.size(); i++)
{
- Score_elem * elt = loose_elems[i];
- Line_of_score *elt_line = elt->line_l();
+ Score_elem * elt = loose_elems[i];
+ Line_of_score *elt_line = elt->line_l();
- if ( ! elt_line)
- {
- /* this piece doesn't know where it belongs.
- Find out if it was broken, and use the broken remains
- */
- if (elt->spanner())
- {
- Spanner * sp = elt->spanner();
+ if (! elt_line)
+ {
+ /* this piece doesn't know where it belongs.
+ Find out if it was broken, and use the broken remains
+ */
+ if (elt->spanner())
+ {
+ Spanner * sp = elt->spanner();
- for (int j =0; j < broken_into_l_arr_.size(); j++)
- {
- Axis_group_spanner * my_broken_l
- = (Axis_group_spanner*)broken_into_l_arr_[j];
+ for (int j =0; j < broken_into_l_arr_.size(); j++)
+ {
+ Axis_group_spanner * my_broken_l
+ = (Axis_group_spanner*)broken_into_l_arr_[j];
- Spanner * broken_span_l
- = sp->find_broken_piece (
- ((Score_elem*)my_broken_l)->line_l());
+ Spanner * broken_span_l
+ = sp->find_broken_piece (
+ ((Score_elem*)my_broken_l)->line_l());
- if (broken_span_l)
- my_broken_l->add_element (broken_span_l);
-
- }
- }
- else if (elt->item()
- && elt->item()->breakable_b_
- && elt->item()->break_status_i () == 0)
- {
-
- // broken items
- for (int j =0; j < 2; j++)
- {
- Item * my_item = elt->item()->broken_to_a_[j];
- Line_of_score * item_line_l = my_item->line_l() ;
- if ( ! item_line_l)
- continue;
+ if (broken_span_l)
+ my_broken_l->add_element (broken_span_l);
- Axis_group_spanner * v
- = (Axis_group_spanner*)find_broken_piece (item_line_l);
- if (v)
- v->add_element (my_item);
- }
+ }
+ }
+ else if (elt->item()
+ && elt->item()->breakable_b_
+ && elt->item()->break_status_i () == 0)
+ {
+ // broken items
+ Direction j=LEFT;
+ do
+ {
+ Item * my_item = elt->item()->broken_to_drul_[j];
+ Line_of_score * item_line_l = my_item->line_l() ;
+ if (! item_line_l)
+ continue;
- }
- }
- else
- {
+ Axis_group_spanner * v
+ = (Axis_group_spanner*)find_broken_piece (item_line_l);
+ if (v)
+ v->add_element (my_item);
+ }
+ while ((j*=-1) != LEFT);
+ }
+ }
+ else
+ {
/* this piece *does* know where it belongs.
Put it in appropriate piece of this spanner
*/
- Axis_group_spanner * my_broken_l
- = (Axis_group_spanner*)find_broken_piece (elt->line_l());
- my_broken_l->add_element (elt);
- }
+ Axis_group_spanner * my_broken_l
+ = (Axis_group_spanner*)find_broken_piece (elt->line_l());
+ my_broken_l->add_element (elt);
+ }
}
Spanner::do_break_processing();
/** don't copy anything: an element can only be in one
Axis_group_element at one time. */
Axis_group_administration::Axis_group_administration (
- Axis_group_administration const&)
+ Axis_group_administration const&)
{
}
bool
-Axis_group_administration::contains_b (Score_elem const *e)const
+Axis_group_administration::contains_b (Score_elem const *e) const
{
return elem_l_arr_.find_l (e);
}
Interval
-Axis_group_administration::extent (Axis axis)const
+Axis_group_administration::extent (Axis axis) const
{
Interval r;
for (int i=0; i < elem_l_arr_.size(); i++)
- r.unite (elem_l_arr_[i]->extent (axis));
+ r.unite (elem_l_arr_[i]->extent (axis));
return r;
}
void
Axis_group_administration::add_element (Score_elem*e,
- Axis_group_element*g, Axis a1, Axis a2)
+ Axis_group_element*g, Axis a1, Axis a2)
{
assert (! e->axis_group_l_a_[a1] && !e->axis_group_l_a_[a2]);
e->axis_group_l_a_[a1] = g;
e->axis_group_l_a_[a2] = g;
- elem_l_arr_.push ( e);
+ elem_l_arr_.push (e);
}
{
for (int i=0; i < elem_l_arr_.size(); i++)
{
- Score_elem*e=elem_l_arr_[i];
- e->axis_group_l_a_[a1] = 0;
- e->axis_group_l_a_[a2] = 0;
+ Score_elem*e=elem_l_arr_[i];
+ e->axis_group_l_a_[a1] = 0;
+ e->axis_group_l_a_[a2] = 0;
}
elem_l_arr_.clear();
}
{
#ifndef NPRINT
for (int i=0; i < elem_l_arr_.size(); i++)
- DOUT << elem_l_arr_[i]->name() << ' ';
+ DOUT << elem_l_arr_[i]->name() << ' ';
#endif
}
bar_l_ = (Bar*)info.elem_l_->item();
}
- if ( bar_l_ && !barcol_p_)
+ if (bar_l_ && !barcol_p_)
{
barcol_p_ = new Bar_column;
barcol_p_->breakable_b_ =true;
Bar_column::do_substitute_dependency (Score_elem*o,Score_elem*n)
{
Script_column::do_substitute_dependency (o,n);
- if ( o == bar_l_)
+ if (o == bar_l_)
{
bar_l_ = n ? (Bar*)n->item() : 0;
}
{
Command_req* c_l = r_l->command();
if (!c_l|| !c_l->bar())
- return false;
+ return false;
Bar_req * b= c_l->bar();
if (bar_req_l_ && bar_req_l_->equal_b (b))
- return false;
+ return false;
bar_req_l_ = b;
{
if (bar_req_l_)
{
- bar_p_ = new Bar;
- bar_p_->type_str_=bar_req_l_->type_str_;
+ bar_p_ = new Bar;
+ bar_p_->type_str_=bar_req_l_->type_str_;
}
- else if (!get_staff_info().time_C_->whole_in_measure_)
+ else
{
+ Time_description const *time = get_staff_info().time_C_;
+ if (time && !time->whole_in_measure_)
bar_p_ = new Bar;
}
if (bar_p_)
{
- announce_element (Score_elem_info (bar_p_, bar_req_l_));
+ announce_element (Score_elem_info (bar_p_, bar_req_l_));
}
else
{
- Disallow_break_req r;
- daddy_grav_l_->try_request (&r);
+ Disallow_break_req r;
+ daddy_grav_l_->try_request (&r);
}
}
void
Bar_engraver::do_pre_move_processing()
{
- if (bar_p_)
- {
- typeset_element (bar_p_);
- bar_p_ =0;
- }
+ if (bar_p_)
+ {
+ typeset_element (bar_p_);
+ bar_p_ =0;
+ }
}
void
#include "text-def.hh"
#include "command-request.hh"
#include "bar.hh"
+#include "time-description.hh"
Bar_number_grav::Bar_number_grav()
{
- number_i_ =1;
script_p_ =0;
}
Bar_number_grav::acknowledge_element (Score_elem_info i)
{
if (i.origin_grav_l_arr_.size() == 1 &&
- i.elem_l_->is_type_b (Bar::static_name()) && !script_p_)
- {
-
- script_p_ = new Script;
- Text_def *td_p =new Text_def;
- td_p->text_str_ = number_i_++;
- script_p_->specs_l_ = td_p;
- script_p_->breakable_b_ = true;
- script_p_->dir_i_ = 1;
-
- announce_element (Score_elem_info (script_p_, &dummy));
+ i.elem_l_->is_type_b (Bar::static_name()) && !script_p_)
+ {
+ Time_description const * time = get_staff_info().time_C_;
+ if (!time || time->cadenza_b_)
+ return ;
+
+ script_p_ = new Script;
+ Text_def *td_p =new Text_def;
+ td_p->text_str_ = time->bars_i_;
+
+ script_p_->specs_l_ = td_p;
+ script_p_->breakable_b_ = true;
+ script_p_->dir_ = UP;
+
+ announce_element (Score_elem_info (script_p_, &dummy));
}
}
void
Bar_number_grav::do_pre_move_processing()
{
- if ( script_p_)
+ if (script_p_)
{
- typeset_element (script_p_);
- script_p_ =0;
+ typeset_element (script_p_);
+ script_p_ =0;
}
}
IMPLEMENT_IS_TYPE_B1(Bar,Item);
void
-Bar::do_print()const
+Bar::do_print() const
{
DOUT << type_str_;
}
Molecule*
-Bar::brew_molecule_p()const
+Bar::brew_molecule_p() const
{
Paper_def *p = paper();
Symbol s = p->lookup_l()->bar (type_str_,
--- /dev/null
+/*
+ beam-grav.cc -- implement Beam_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "duration-convert.hh"
+#include "time-description.hh"
+#include "beam-grav.hh"
+#include "stem.hh"
+#include "beam.hh"
+#include "musical-request.hh"
+#include "grouping.hh"
+#include "text-spanner.hh"
+#include "text-def.hh"
+
+Beam_engraver::Beam_engraver()
+{
+ span_reqs_drul_[LEFT] = span_reqs_drul_[RIGHT] =0;
+ beam_p_ =0;
+ current_grouping_p_ =0;
+}
+
+bool
+Beam_engraver::do_try_request(Request*r)
+{
+ Musical_req* mus_l = r->musical();
+ if (!mus_l)
+ return false;
+
+ Beam_req * b = mus_l->beam();
+
+ if (!b)
+ return false;
+
+ if (bool (beam_p_) == bool (b->spantype == Span_req::START))
+ return false;
+
+ Direction d = (!beam_p_) ? LEFT : RIGHT;
+ if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (mus_l))
+ return false;
+
+ span_reqs_drul_[d] = b;
+ return true;
+}
+
+void
+Beam_engraver::do_process_requests()
+{
+ if ( !beam_p_ && span_reqs_drul_[LEFT]) {
+ current_grouping_p_ = new Rhythmic_grouping;
+ beam_p_ = new Beam;
+ if (span_reqs_drul_[LEFT]->nplet)
+ {
+ Text_spanner* t = new Text_spanner();
+ Text_def *defp = new Text_def;
+ t->set_support (beam_p_);
+ defp->align_i_ = 0;
+ defp->text_str_ = span_reqs_drul_[LEFT]->nplet;
+ defp->style_str_="italic";
+ t->spec_p_ = defp;
+ announce_element (Score_elem_info (t,0));
+ typeset_element (t);
+ }
+ announce_element (Score_elem_info (beam_p_, span_reqs_drul_[LEFT]));
+ }
+}
+
+void
+Beam_engraver::do_pre_move_processing()
+{
+ if (beam_p_ && span_reqs_drul_[RIGHT]) {
+ Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_;
+ rg_C->extend (current_grouping_p_->interval());
+ beam_p_->set_grouping (*rg_C, *current_grouping_p_);
+ typeset_element (beam_p_);
+ beam_p_ = 0;
+
+ delete current_grouping_p_;
+ current_grouping_p_ = 0;
+
+ span_reqs_drul_[RIGHT] =
+ span_reqs_drul_[LEFT] = 0;
+ }
+}
+
+void
+Beam_engraver::do_removal_processing()
+{
+ if (beam_p_)
+ {
+ span_reqs_drul_[LEFT]->warning ("unterminated beam");
+ typeset_element (beam_p_);
+ beam_p_ =0;
+ }
+}
+
+
+void
+Beam_engraver::acknowledge_element (Score_elem_info i)
+{
+ if (beam_p_ && i.elem_l_->is_type_b (Stem::static_name()))
+ {
+ Stem * s = (Stem*)i.elem_l_->item();
+ Rhythmic_req *rhythmic_req = i.req_l_->musical ()->rhythmic ();
+ if (rhythmic_req->duration_.durlog_i_<= 2)
+ {
+ rhythmic_req->warning ("Stem doesn't fit in Beam");
+ return ;
+ }
+
+ /*
+ TODO: do something sensible if it doesn't fit in the beam.
+ */
+ current_grouping_p_->add_child (get_staff_info().time_C_->whole_in_measure_,
+ rhythmic_req->duration());
+ /*
+ TODO
+ should change rep. of flags too.k
+ */
+ s->flag_i_ = Duration_convert::type2_i
+ (rhythmic_req->duration_.durlog_i_);
+ s->print_flag_b_ = false;
+ beam_p_->add (s);
+ }
+}
+
+IMPLEMENT_IS_TYPE_B1(Beam_engraver, Engraver);
+ADD_THIS_ENGRAVER(Beam_engraver);
struct Stem_info {
Real x;
- int dir_i_;
+ int dir_;
Real idealy_f_;
Real miny_f_;
int beams_i_;
Stem_info::Stem_info (Stem const *s)
{
x = s->hpos_f();
- dir_i_ = s->dir_i_;
- beams_i_ = intlog2( s->flag_i_) - 2;
+ dir_ = s->dir_;
+ beams_i_ = intlog2(s->flag_i_) - 2;
/*
- [todo]
- * get algorithm
- * runtime
-
- Breitkopf + H\"artel:
- miny_f_ = interline + #beams * interbeam
- ideal8 = 2 * interline + interbeam
- ideal16,32,64,128 = 1.5 * interline + #beams * interbeam
-
- * B\"arenreiter:
- miny_f_ = interline + #beams * interbeam
- ideal8,16 = 2 interline + #beams * interbeam
- ideal32,64,128 = 1.5 interline + #beams * interbeam
+ [todo]
+ * get algorithm
+ * runtime
+
+ Breitkopf + H\"artel:
+ miny_f_ = interline + #beams * interbeam
+ ideal8 = 2 * interline + interbeam
+ ideal16,32,64,128 = 1.5 * interline + #beams * interbeam
+
+ * B\"arenreiter:
+ miny_f_ = interline + #beams * interbeam
+ ideal8,16 = 2 interline + #beams * interbeam
+ ideal32,64,128 = 1.5 interline + #beams * interbeam
- */
+ */
Real notehead_y = s->paper()->interline_f ();
// huh? why do i need the / 2
-// Real interbeam_f = s->paper()->interbeam_f ();
+ // Real interbeam_f = s->paper()->interbeam_f ();
Real interbeam_f = s->paper()->interbeam_f () / 2;
/* well eh, huh?
- idealy_f_ = dir_i_ * s->stem_start_f() + beams_i_ * interbeam_f;
- if ( beams_i_ < 3)
- idealy_f_ += 2 * interline_f;
- else
- idealy_f_ += 1.5 * interline_f;
- */
+ idealy_f_ = dir_ * s->stem_start_f() + beams_i_ * interbeam_f;
+ if (beams_i_ < 3)
+ idealy_f_ += 2 * interline_f;
+ else
+ idealy_f_ += 1.5 * interline_f;
+ */
- idealy_f_ = dir_i_ * s->stem_end_f();
+ idealy_f_ = dir_ * s->stem_end_f();
- miny_f_ = dir_i_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f;
+ miny_f_ = dir_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f;
idealy_f_ = miny_f_ >? idealy_f_;
-// assert (miny_f_ <= idealy_f_);
+ // assert (miny_f_ <= idealy_f_);
}
Offset
-Beam::center()const
+Beam::center() const
{
Real w=(paper()->note_width () + width ().length ())/2.0;
return Offset (w, (left_pos + w* slope)*paper()->internote_f ());
stems.push (s);
s->add_dependency (this);
s->print_flag_b_ = false;
+
+ if (!spanned_drul_[LEFT])
+ set_bounds(LEFT,s);
+ set_bounds(RIGHT,s);
}
void
for (int i=0; i <stems.size(); i++)
{
- Stem *sl = stems[i];
- int cur_down = sl->get_center_distance_from_top();
- int cur_up = sl->get_center_distance_from_bottom();
- if (cur_down)
- {
- down += cur_down;
- down_count++;
- }
- if (cur_up)
- {
- up += cur_up;
- up_count++;
- }
+ Stem *sl = stems[i];
+ int cur_down = sl->get_center_distance_from_top();
+ int cur_up = sl->get_center_distance_from_bottom();
+ if (cur_down)
+ {
+ down += cur_down;
+ down_count++;
+ }
+ if (cur_up)
+ {
+ up += cur_up;
+ up_count++;
+ }
}
if (!down)
- down_count = 1;
+ down_count = 1;
if (!up)
- up_count = 1;
+ up_count = 1;
// the following relation is equal to
// up / up_count > down / down_count
- dir_i_ = (up * down_count > down * up_count) ? 1 : -1;
+ dir_ = (up * down_count > down * up_count) ? UP : DOWN;
- for (int i=0; i <stems.size(); i++)
- {
- Stem *sl = stems[i];
- sl->dir_i_ = dir_i_;
- }
+ for (int i=0; i <stems.size(); i++)
+ {
+ Stem *sl = stems[i];
+ sl->dir_ = dir_;
+ }
}
/*
Array<Stem_info> sinfo;
for (int j=0; j <stems.size(); j++)
{
- Stem *i = stems[j];
+ Stem *i = stems[j];
- i->set_default_extents();
- if (i->invisible_b())
- continue;
+ i->set_default_extents();
+ if (i->invisible_b())
+ continue;
- Stem_info info (i);
- sinfo.push (info);
+ Stem_info info (i);
+ sinfo.push (info);
}
if (! sinfo.size())
- slope = left_pos = 0;
+ slope = left_pos = 0;
else if (sinfo.size() == 1)
{
- slope = 0;
- left_pos = sinfo[0].idealy_f_;
+ slope = 0;
+ left_pos = sinfo[0].idealy_f_;
}
else
{
- Real leftx = sinfo[0].x;
- Least_squares l;
- for (int i=0; i < sinfo.size(); i++)
- {
- sinfo[i].x -= leftx;
- l.input.push (Offset (sinfo[i].x, sinfo[i].idealy_f_));
- }
-
- l.minimise (slope, left_pos);
+ Real leftx = sinfo[0].x;
+ Least_squares l;
+ for (int i=0; i < sinfo.size(); i++)
+ {
+ sinfo[i].x -= leftx;
+ l.input.push (Offset (sinfo[i].x, sinfo[i].idealy_f_));
+ }
+
+ l.minimise (slope, left_pos);
}
Real dy = 0.0;
for (int i=0; i < sinfo.size(); i++)
{
- Real y = sinfo[i].x * slope + left_pos;
- Real my = sinfo[i].miny_f_;
+ Real y = sinfo[i].x * slope + left_pos;
+ Real my = sinfo[i].miny_f_;
- if (my - y > dy)
- dy = my -y;
+ if (my - y > dy)
+ dy = my -y;
}
left_pos += dy;
- left_pos *= dir_i_;
+ left_pos *= dir_;
- slope *= dir_i_;
+ slope *= dir_;
/*
This neat trick is by Werner Lemberg, damped = tanh (slope) corresponds
with some tables in [Wanske]
- */
+ */
slope = 0.6 * tanh (slope);
- // ugh
+ // ugh
Real sl = slope*paper()->internote_f ();
paper()->lookup_l ()->beam (sl, 20 PT);
slope = sl /paper()->internote_f ();
Real x0 = stems[0]->hpos_f();
for (int j=0; j <stems.size(); j++)
{
- Stem *s = stems[j];
+ Stem *s = stems[j];
- Real x = s->hpos_f()-x0;
- s->set_stemend (left_pos + slope * x);
+ Real x = s->hpos_f()-x0;
+ s->set_stemend (left_pos + slope * x);
}
}
void
Beam::do_post_processing()
{
- if ( stems.size() < 2)
+ if (stems.size() < 2)
{
- warning ("Beam with less than 2 stems");
- transparent_b_ = true;
- return ;
+ warning ("Beam with less than 2 stems");
+ transparent_b_ = true;
+ return ;
}
solve_slope();
set_stemlens();
Array<int> b;
{
- Array<int> flags;
- for (int j=0; j <stems.size(); j++)
- {
- Stem *s = stems[j];
-
- int f = intlog2(abs (s->flag_i_))-2;
- assert (f>0);
- flags.push (f);
- }
- int fi =0;
- b= cur.generate_beams (flags, fi);
- b.insert (0,0);
- b.push (0);
- assert (stems.size() == b.size ()/2);
- }
+ Array<int> flags;
+ for (int j=0; j <stems.size(); j++)
+ {
+ Stem *s = stems[j];
+
+ int f = intlog2(abs (s->flag_i_))-2;
+ assert (f>0);
+ flags.push (f);
+ }
+ int fi =0;
+ b= cur.generate_beams (flags, fi);
+ b.insert (0,0);
+ b.push (0);
+ assert (stems.size() == b.size ()/2);
+ }
for (int j=0, i=0; i < b.size() && j <stems.size (); i+= 2, j++)
{
- Stem *s = stems[j];
- s->beams_left_i_ = b[i];
- s->beams_right_i_ = b[i+1];
+ Stem *s = stems[j];
+ s->beams_left_i_ = b[i];
+ s->beams_right_i_ = b[i+1];
}
}
void
Beam::do_pre_processing()
{
- if (!dir_i_)
- set_default_dir();
+ if (!dir_)
+ set_default_dir();
}
Beam::do_width() const
{
return Interval (stems[0]->hpos_f(),
- stems.top()->hpos_f ());
+ stems.top()->hpos_f ());
}
/*
beams to go with one stem.
*/
Molecule
-Beam::stem_beams (Stem *here, Stem *next, Stem *prev)const
+Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
{
- assert (!next || next->hpos_f() > here->hpos_f () );
- assert (!prev || prev->hpos_f() < here->hpos_f () );
-// Real dy=paper()->internote_f ()*2;
+ assert (!next || next->hpos_f() > here->hpos_f ());
+ assert (!prev || prev->hpos_f() < here->hpos_f ());
+ // Real dy=paper()->internote_f ()*2;
Real dy = paper()->interbeam_f ();
Real stemdx = paper()->rule_thickness ();
Real sl = slope*paper()->internote_f ();
/* half beams extending to the left. */
if (prev)
{
- int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ;
- int lwholebeams= here->beams_left_i_ <? prev->beams_right_i_ ;
- Real w = (here->hpos_f() - prev->hpos_f ())/4;
- Symbol dummy;
- Atom a (dummy);
- if (lhalfs) // generates warnings if not
- a = paper()->lookup_l ()->beam (sl, w);
- a.translate (Offset (-w, -w * sl));
- for (int j = 0; j < lhalfs; j++)
- {
- Atom b (a);
- b.translate (-dir_i_ * dy * (lwholebeams+j), Y_AXIS);
- leftbeams.add (b);
- }
+ int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ;
+ int lwholebeams= here->beams_left_i_ <? prev->beams_right_i_ ;
+ Real w = (here->hpos_f() - prev->hpos_f ())/4;
+ Symbol dummy;
+ Atom a (dummy);
+ if (lhalfs) // generates warnings if not
+ a = paper()->lookup_l ()->beam (sl, w);
+ a.translate (Offset (-w, -w * sl));
+ for (int j = 0; j < lhalfs; j++)
+ {
+ Atom b (a);
+ b.translate (-dir_ * dy * (lwholebeams+j), Y_AXIS);
+ leftbeams.add (b);
+ }
}
if (next)
{
- int rhalfs = here->beams_right_i_ - next->beams_left_i_;
- int rwholebeams = here->beams_right_i_ <? next->beams_left_i_;
+ int rhalfs = here->beams_right_i_ - next->beams_left_i_;
+ int rwholebeams = here->beams_right_i_ <? next->beams_left_i_;
- Real w = next->hpos_f() - here->hpos_f ();
- Atom a = paper()->lookup_l ()->beam (sl, w + stemdx);
+ Real w = next->hpos_f() - here->hpos_f ();
+ Atom a = paper()->lookup_l ()->beam (sl, w + stemdx);
- int j = 0;
- for (; j < rwholebeams; j++)
- {
- Atom b (a);
- b.translate (-dir_i_ * dy * j, Y_AXIS);
- rightbeams.add (b);
- }
-
- w /= 4;
- if (rhalfs)
- a = paper()->lookup_l ()->beam (sl, w);
+ int j = 0;
+ for (; j < rwholebeams; j++)
+ {
+ Atom b (a);
+ b.translate (-dir_ * dy * j, Y_AXIS);
+ rightbeams.add (b);
+ }
+
+ w /= 4;
+ if (rhalfs)
+ a = paper()->lookup_l ()->beam (sl, w);
- for (; j < rwholebeams + rhalfs; j++)
- {
- Atom b (a);
- b.translate (-dir_i_ * dy * j, Y_AXIS);
- rightbeams.add (b);
- }
+ for (; j < rwholebeams + rhalfs; j++)
+ {
+ Atom b (a);
+ b.translate (-dir_ * dy * j, Y_AXIS);
+ rightbeams.add (b);
+ }
}
leftbeams.add (rightbeams);
Molecule *mol_p = new Molecule;
// huh? inter-what
-// Real inter_f = paper()->interbeam_f ();
+ // Real inter_f = paper()->interbeam_f ();
Real inter_f = paper()->internote_f ();
Real x0 = stems[0]->hpos_f();
for (int j=0; j <stems.size(); j++)
{
- Stem *i = stems[j];
- Stem * prev = (j > 0)? stems[j-1] : 0;
- Stem * next = (j < stems.size()-1) ? stems[j+1] :0;
-
- Molecule sb = stem_beams (i, next, prev);
- Real x = i->hpos_f()-x0;
- sb.translate (Offset (x, (x * slope + left_pos)* inter_f));
- mol_p->add (sb);
+ Stem *i = stems[j];
+ Stem * prev = (j > 0)? stems[j-1] : 0;
+ Stem * next = (j < stems.size()-1) ? stems[j+1] :0;
+
+ Molecule sb = stem_beams (i, next, prev);
+ Real x = i->hpos_f()-x0;
+ sb.translate (Offset (x, (x * slope + left_pos)* inter_f));
+ mol_p->add (sb);
}
- mol_p->translate (x0 - left_col_l_->hpos_f_, X_AXIS);
+ mol_p->translate (x0 - spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), X_AXIS);
return mol_p;
}
IMPLEMENT_IS_TYPE_B1(Beam, Spanner);
void
-Beam::do_print()const
+Beam::do_print() const
{
#ifndef NPRINT
DOUT << "slope " <<slope << "left ypos " << left_pos;
{
if (o->is_type_b (Stem::static_name()))
{
- stems.substitute ((Stem*)o->item(), n?(Stem*) n->item ():0);
+ stems.substitute ((Stem*)o->item(), n?(Stem*) n->item ():0);
}
}
Bow::Bow()
{
- left_pos_i_ = right_pos_i_ = 0;
- left_dx_f_ = right_dx_f_ = 0.0;
+ pos_i_drul_[LEFT] = pos_i_drul_[RIGHT] = 0;
+ dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
}
Offset
Bow::center() const
{
- int dy = right_pos_i_-left_pos_i_;
+ int dy = pos_i_drul_[RIGHT]-pos_i_drul_[LEFT];
Real w = width().length ();
Molecule*output = new Molecule;
Real w = width().length ();
- int dy = right_pos_i_ - left_pos_i_;
+ int dy = pos_i_drul_[RIGHT] - pos_i_drul_[LEFT];
Real nw_f = paper()->note_width ();
Real nh_f = paper()->internote_f ();
- w+= (right_dx_f_ - left_dx_f_) * nw_f ;
+ w+= (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]) * nw_f ;
Real round_w = w; // slur lookup rounds the slurwidth .
- Symbol sl = paper()->lookup_l ()->slur (dy , round_w, dir_i_);
+ Symbol sl = paper()->lookup_l ()->slur (dy , round_w, dir_);
Real error = w-round_w;
Atom a (sl);
- a.translate (Offset ((left_dx_f_ + 0.5)*nw_f + error/2,
- left_pos_i_ * nh_f));
+ a.translate (Offset ((dx_f_drul_[LEFT] + 0.5)*nw_f + error/2,
+ pos_i_drul_[LEFT] * nh_f));
output->add (a);
return output;
}
String s (count_i_);
s += " lines";
if (count_i_)
- s += String (Real (cols_i_)/count_i_, ", (with an average of %.1f columns)");
+ s += String (Real (cols_i_)/count_i_, ", (with an average of %.1f columns)");
return s;
}
/* **************************************************************** */
Line_of_cols
-Break_algorithm::all_cols()const
+Break_algorithm::all_cols() const
{
Line_of_cols retval;
- for (PCursor<PCol*> c (pscore_l_->col_p_list_.top());
- c.ok(); c++)
- {
+ for (PCursor<Paper_column*> c (pscore_l_->col_p_list_.top());
+ c.ok(); c++)
+ {
- retval.push (c);
+ retval.push (c);
}
return retval;
}
Array<int> retval;
for (int i=0; i < all.size(); i++)
- if (all[i]->breakable_b())
- retval.push (i);
+ if (all[i]->breakable_b_)
+ retval.push (i);
- if ( linelength <=0)
- while ( retval.size() >2)
- retval.del (1);
+ if (linelength <=0)
+ while (retval.size() >2)
+ retval.del (1);
return retval;
}
Line_of_cols retval;
for (int i=0; i < all.size(); i++)
- if (all[i]->breakable_b())
- retval.push (all[i]);
+ if (all[i]->breakable_b_)
+ retval.push (all[i]);
- if ( linelength <=0)
- while ( retval.size() >2)
- retval.del (1);
+ if (linelength <=0)
+ while (retval.size() >2)
+ retval.del (1);
return retval;
}
Line_spacer*
-Break_algorithm::generate_spacing_problem (Line_of_cols curline)const
+Break_algorithm::generate_spacing_problem (Line_of_cols curline) const
{
Line_spacer * sp= (*get_line_spacer)();
sp->paper_l_ = pscore_l_->paper_l_;
sp->add_column (curline[0], true, 0.0);
for (int i=1; i< curline.size()-1; i++)
- sp->add_column (curline[i]);
+ sp->add_column (curline[i]);
- if ( linelength > 0)
- sp->add_column (curline.top(), true, linelength);
+ if (linelength > 0)
+ sp->add_column (curline.top(), true, linelength);
else
- sp->add_column (curline.top());
+ sp->add_column (curline.top());
sp->prepare();
return sp;
Break_algorithm::feasible (Line_of_cols curline) const
{
if (linelength <= 0)
- return true;
+ return true;
Real l =0;
for (int i=0; i < curline.size(); i++)
- l +=curline[i]->width().length ();
+ l +=curline[i]->width().length ();
return l < linelength;
}
Break_algorithm::problem_OK() const
{
if (!pscore_l_->col_p_list_.size())
- error ("Score does not have any columns");
+ error ("Score does not have any columns");
OK();
}
void
-Break_algorithm::OK()const
+Break_algorithm::OK() const
{
#ifndef NDEBUG
iter_top (pscore_l_->col_p_list_,start);
- PCursor<PCol *> end (pscore_l_->col_p_list_.bottom());
+ PCursor<Paper_column *> end (pscore_l_->col_p_list_.bottom());
- assert (start->breakable_b());
- assert (end->breakable_b());
+ assert (start->breakable_b_);
+ assert (end->breakable_b_);
#endif
}
Array<Col_hpositions>
-Break_algorithm::solve()const
+Break_algorithm::solve() const
{
return do_solve();
}
}
void
-Break_algorithm::print_stats()const
+Break_algorithm::print_stats() const
{
if (approx_stats_.count_i_)
- *mlog << "\nApproximated: " << approx_stats_.str() << "\n";
+ *mlog << "\nApproximated: " << approx_stats_.str() << "\n";
if (exact_stats_.count_i_)
- *mlog << "Calculated exactly: " << exact_stats_.str() << "\n";
+ *mlog << "Calculated exactly: " << exact_stats_.str() << "\n";
}
--- /dev/null
+/*
+ chord-iter.cc -- implement Chord_iterator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "translator.hh"
+#include "debug.hh"
+#include "chord-iterator.hh"
+
+#include "music-list.hh"
+
+
+Chord_iterator::~Chord_iterator()
+{
+}
+
+Chord_iterator::Chord_iterator (Chord const *chord_C)
+{
+ chord_C_ = chord_C;
+}
+
+void
+Chord_iterator::construct_children()
+{
+ int j = 0;
+ for (PCursor<Music*> i (chord_C_->music_p_list_.top()); //, int j = 0;
+ i.ok(); j++, i++)
+ {
+ Music_iterator * mi = get_iterator_p (i.ptr());
+ if (mi->ok())
+ {
+ set_translator (mi->report_to_l()->ancestor_l (chord_C_->multi_level_i_));
+ children_p_list_.bottom().add (mi);
+ }
+ else
+ delete mi;
+ }
+}
+void
+Chord_iterator::do_print() const
+{
+#ifndef NPRINT
+ for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++)
+ {
+ i->print();
+ }
+#endif
+}
+
+void
+Chord_iterator::process_and_next (Moment until)
+{
+ for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok ();)
+ {
+ if (i->next_moment() == until)
+ {
+ i->process_and_next (until);
+ }
+ if (!i->ok())
+ delete i.remove_p();
+ else
+ i++;
+ }
+ Music_iterator::process_and_next (until);
+}
+
+
+IMPLEMENT_IS_TYPE_B1(Chord_iterator,Music_iterator);
+
+Moment
+Chord_iterator::next_moment() const
+{
+ Moment next_ = infinity_mom;
+ for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++)
+ next_ = next_ <? i->next_moment() ;
+ return next_;
+}
+
+
+
+bool
+Chord_iterator::ok() const
+{
+ return children_p_list_.size();
+}
if (info.elem_l_->name() == Bar::static_name ())
{
create_clef();
- if ( !clef_req_l_)
+ if (!clef_req_l_)
clef_p_->default_b_ = true;
}
}
if (default_b_)
{
- empty_b_ = (break_status_i() != 1);
- transparent_b_ = (break_status_i() != 1);
+ empty_b_ = (break_status_i() != 1);
+ transparent_b_ = (break_status_i() != 1);
}
}
{
type_= t;
if (type_ == "violin")
- y_off = 2;
+ y_off = 2;
if (type_ == "alto")
- y_off = 4;
+ y_off = 4;
if (type_ == "tenor")
- y_off = 6;
+ y_off = 6;
if (type_ == "bass")
- y_off = 6;
+ y_off = 6;
}
void
Clef_item::read (Clef_engraver const &k)
}
Molecule*
-Clef_item::brew_molecule_p()const
+Clef_item::brew_molecule_p() const
{
String t = type_;
if (change_b_)
- t += "_change";
+ t += "_change";
Symbol s = paper()->lookup_l ()->clef (t);
Molecule*output = new Molecule (Atom (s));
output->translate (paper()->internote_f () * y_off, Y_AXIS);
#ifndef NPRINT
DOUT << "column { ";
if (fixed())
- DOUT << "fixed at " << fixed_position()<<", ";
+ DOUT << "fixed at " << fixed_position()<<", ";
assert (pcol_l_);
DOUT << "[" << minleft() << ", " << minright () << "]";
DOUT <<"}\n";
#endif
}
-Colinfo::Colinfo (PCol *col_l, Real const *fixed_C)
+Colinfo::Colinfo (Paper_column *col_l, Real const *fixed_C)
{
if (fixed_C)
- fixpos_p_.set_l (fixed_C);
+ fixpos_p_.set_l (fixed_C);
ugh_b_ = false;
pcol_l_ = col_l;
width = pcol_l_->width();
+ if (width.empty_b())
+ width = Interval(0,0);
}
}
void
-Col_hpositions::add (PCol*c)
+Col_hpositions::add (Paper_column*c)
{
cols.push (c);
}
}
void
-Col_hpositions::OK()const
+Col_hpositions::OK() const
{
#ifndef NDEBUG
assert (config.size() == cols.size ());
{
assert (abs (dir) == 1);
int j = dir > 0 ? 0 : 3;
- if ( h_shift_b)
+ if (h_shift_b)
j += dir;
return j;
}
for (int i=0; i < clash_l_arr_.size(); i++)
{
Note_column* c_l = clash_l_arr_[i];
- if (! c_l->dir_i_)
+ if (! c_l->dir_)
{
warning ("No stem direction set. Ignoring column in clash. ");
continue;
}
- int d = (c_l->dir_i_);
+ int d = (c_l->dir_);
clash_group_arr_a[idx (d, c_l->h_shift_b_)].push (c_l);
}
IMPLEMENT_IS_TYPE_B1(Cadenza_req, Timing_req);
void
-Cadenza_req::do_print()const
+Cadenza_req::do_print() const
{
#ifndef NPRINT
DOUT << on_b_;
}
bool
-Cadenza_req::do_equal_b (Request*r)const
+Cadenza_req::do_equal_b (Request*r) const
{
Cadenza_req*cad = r->command()->timing ()->cadenza ();
bool
-Bar_req::do_equal_b (Request*r)const
+Bar_req::do_equal_b (Request*r) const
{
Bar_req * b = r->command()->bar ();
return type_str_ == b->type_str_;
}
bool
-Partial_measure_req::do_equal_b (Request* r)const
+Partial_measure_req::do_equal_b (Request* r) const
{
Partial_measure_req *p = r->command()->timing ()->partial ();
IMPLEMENT_IS_TYPE_B1(Timing_req,Command_req);
void
-Timing_req::do_print()const{}
+Timing_req::do_print() const{}
IMPLEMENT_IS_TYPE_B1(Command_req,Request);
void
-Command_req::do_print()const{}
+Command_req::do_print() const{}
IMPLEMENT_IS_TYPE_B1(Disallow_break_req,Command_req);
void
-Disallow_break_req::do_print()const
+Disallow_break_req::do_print() const
{
}
/* *************** */
Barcheck_req::do_print() const{}
bool
-Barcheck_req::do_equal_b (Request*)const
+Barcheck_req::do_equal_b (Request*) const
{
return true;
}
}
bool
-Meter_change_req::do_equal_b (Request * r)const
+Meter_change_req::do_equal_b (Request * r) const
{
Meter_change_req * m = r->command()->timing ()->meterchange ();
return m->beats_i_ == beats_i_
- && one_beat_i_ == m->one_beat_i_;
+ && one_beat_i_ == m->one_beat_i_;
}
Meter_change_req::Meter_change_req()
}
void
-Tempo_req::do_print()const
+Tempo_req::do_print() const
{
DOUT << dur_.str() << " = " <<metronome_i_ ;
}
IMPLEMENT_IS_TYPE_B1(Tempo_req, Timing_req);
bool
-Tempo_req::do_equal_b (Request *r)const
+Tempo_req::do_equal_b (Request *r) const
{
Tempo_req *t = r->command()->timing ()->tempo ();
{
for (int i=0; i < elt_length_arr_.size(); i++)
{
- DOUT << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" ";
+ DOUT << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" ";
}
}
bool
-Measure_grouping_req::do_equal_b (Request*)const
+Measure_grouping_req::do_equal_b (Request*) const
{
return false; // todo
}
/* *************** */
void
-Key_change_req::transpose (Melodic_req const & d)const
+Key_change_req::transpose (Melodic_req const & d) const
{
WARN << "don't know how to transpose a key. \n";
for (int i=0; i < melodic_p_arr_.size(); i++)
{
- melodic_p_arr_[i]->transpose (d);
+ melodic_p_arr_[i]->transpose (d);
}
}
{
for (int i=0; i < melodic_p_arr_.size(); i++)
{
- melodic_p_arr_[i]->octave_i_ = 0;
+ melodic_p_arr_[i]->octave_i_ = 0;
}
}
#ifndef NPRINT
for (int i=0; i < melodic_p_arr_.size(); i++)
{
- melodic_p_arr_[i]->print();
+ melodic_p_arr_[i]->print();
}
#endif
}
Key_change_req::Key_change_req()
{
- minor_b_ = false;
- multi_octave_b_= false;
+ minor_b_ = false;
+ multi_octave_b_= false;
}
Key_change_req::Key_change_req (Key_change_req const&c)
{
- for (int i=0; i < c.melodic_p_arr_.size(); i++)
- melodic_p_arr_.push (c.melodic_p_arr_[i]->clone()->musical ()->melodic ());
- minor_b_ = c.minor_b_;
- multi_octave_b_ = c.multi_octave_b_;
+ for (int i=0; i < c.melodic_p_arr_.size(); i++)
+ melodic_p_arr_.push (c.melodic_p_arr_[i]->clone()->musical ()->melodic ());
+ minor_b_ = c.minor_b_;
+ multi_octave_b_ = c.multi_octave_b_;
}
Key_change_req::~Key_change_req()
{
- for (int i=0; i < melodic_p_arr_.size(); i++)
- delete melodic_p_arr_[i];
+ for (int i=0; i < melodic_p_arr_.size(); i++)
+ delete melodic_p_arr_[i];
}
int
Key_change_req::flats_i()
{
- int flats_i = 0;
- for ( int i = 0; i < melodic_p_arr_.size(); i++)
- {
- Melodic_req* mel_l = melodic_p_arr_[i]->melodic();
- assert (mel_l);
- if ( mel_l->accidental_i_ < 0)
- flats_i -= mel_l->accidental_i_;
- }
- return flats_i;
+ int flats_i = 0;
+ for (int i = 0; i < melodic_p_arr_.size(); i++)
+ {
+ Melodic_req* mel_l = melodic_p_arr_[i]->melodic();
+ assert (mel_l);
+ if (mel_l->accidental_i_ < 0)
+ flats_i -= mel_l->accidental_i_;
+ }
+ return flats_i;
}
int
Key_change_req::minor_b()
{
- return minor_b_;
+ return minor_b_;
}
int
Key_change_req::sharps_i()
{
- int sharps_i = 0;
- for ( int i = 0; i < melodic_p_arr_.size(); i++)
- {
- Melodic_req* mel_l = melodic_p_arr_[i]->melodic();
- assert (mel_l);
- if ( mel_l->accidental_i_ > 0)
- sharps_i+= mel_l->accidental_i_;
- }
- return sharps_i;
+ int sharps_i = 0;
+ for (int i = 0; i < melodic_p_arr_.size(); i++)
+ {
+ Melodic_req* mel_l = melodic_p_arr_[i]->melodic();
+ assert (mel_l);
+ if (mel_l->accidental_i_ > 0)
+ sharps_i+= mel_l->accidental_i_;
+ }
+ return sharps_i;
}
Crescendo::Crescendo()
{
- grow_dir_i_ =0;
- dir_i_ = -1 ;
- left_dyn_b_ = right_dyn_b_ =false;
+ grow_dir_ =0;
+ dir_ = DOWN ;
+ dyn_b_drul_[LEFT] = dyn_b_drul_[RIGHT] =false;
inside_staff_b_ = false;
}
Interval
-Crescendo::symbol_height()const
+Crescendo::symbol_height() const
{
return get_symbol().dim[Y_AXIS];
}
static Real absdyn_dim = 10 PT; // ugh
Symbol
-Crescendo::get_symbol()const
+Crescendo::get_symbol() const
{
Real w_dim = width().length ();
- if ( left_dyn_b_)
+ if (dyn_b_drul_[LEFT])
{
- w_dim -= absdyn_dim;
+ w_dim -= absdyn_dim;
}
- if ( right_dyn_b_)
+ if (dyn_b_drul_[RIGHT])
{
- w_dim -= absdyn_dim;
+ w_dim -= absdyn_dim;
}
if (w_dim < 0)
{
- warning ("Crescendo too small");
- w_dim = 0;
+ warning ("Crescendo too small");
+ w_dim = 0;
}
- return Symbol (paper()->lookup_l ()->hairpin (w_dim, grow_dir_i_ < 0));
+ return Symbol (paper()->lookup_l ()->hairpin (w_dim, grow_dir_ < 0));
}
Molecule*
{
Molecule* m_p =0;
Real x_off_dim=0.0;
- if ( left_dyn_b_)
- x_off_dim += absdyn_dim;
+ if (dyn_b_drul_[LEFT])
+ x_off_dim += absdyn_dim;
m_p = new Molecule;
Symbol s (get_symbol());
char const *s = dim;
while (i > 0 && (isspace (s[i]) || isalpha (s[i])))
{
- i--;
+ i--;
}
String unit (s + i+1);
return convert_dimen (dim.value_f(), unit);
convert_dimen (Real quant, String unit)
{
if (unit == "cm")
- return quant * CM_TO_PT;
+ return quant * CM_TO_PT;
if (unit == "pt")
- return quant;
+ return quant;
if (unit == "mm")
- return quant*CM_TO_PT/10;
+ return quant*CM_TO_PT/10;
if (unit == "in")
- return quant * INCH_TO_PT;
+ return quant * INCH_TO_PT;
error ("unknown length unit: `" + unit+"'");
}
void
Directional_spanner::set_default_dir()
{
- dir_i_ = -1;
+ dir_ = DOWN;
}
void
Directional_spanner::do_pre_processing()
{
- if (!dir_i_)
+ if (!dir_)
set_default_dir();
}
Directional_spanner::Directional_spanner()
{
- dir_i_ = 0;
+ dir_ = CENTER;
}
Dynamic_engraver::Dynamic_engraver()
{
- dir_i_ =0;
+ dir_ = CENTER;
do_post_move_processing();
dynamic_p_ =0;
to_end_cresc_p_ = cresc_p_ = 0;
{
Musical_req * m = r->musical();
if (!m || !m->dynamic())
- return false;
+ return false;
dynamic_req_l_arr_.push (m->dynamic());
return true;
}
Crescendo* new_cresc_p=0;
for (int i=0; i < dynamic_req_l_arr_.size(); i++)
{
- Dynamic_req *dreq_l = dynamic_req_l_arr_[i];
- if (dreq_l->absdynamic())
- {
- Text_def * td_p = new Text_def;
- td_p->align_i_ = 0;
- String loud =Dynamic_req::loudness_str (
- dreq_l->absdynamic()->loudness_);
+ Dynamic_req *dreq_l = dynamic_req_l_arr_[i];
+ if (dreq_l->absdynamic())
+ {
+ Text_def * td_p = new Text_def;
+ td_p->align_i_ = 0;
+ String loud =Dynamic_req::loudness_str (
+ dreq_l->absdynamic()->loudness_);
- td_p->text_str_ = paper()->lookup_l ()->dynamic (loud).tex;
- td_p->style_str_ = "dynamic";
+ td_p->text_str_ = paper()->lookup_l ()->dynamic (loud).tex;
+ td_p->style_str_ = "dynamic";
- assert (!dynamic_p_) ; // TODO
+ assert (!dynamic_p_) ; // TODO
- dynamic_p_ = new Text_item (td_p);
- announce_element (Score_elem_info (dynamic_p_, dreq_l));
- }
- else if (dreq_l->span_dynamic())
- {
+ dynamic_p_ = new Text_item (td_p);
+ announce_element (Score_elem_info (dynamic_p_, dreq_l));
+ }
+ else if (dreq_l->span_dynamic())
+ {
- Span_dynamic_req* span_l = dreq_l->span_dynamic();
- if (span_l->spantype == Span_req::STOP)
- {
- if (!cresc_p_)
- {
- span_l->warning ("Can't find cresc to end ");
- }
- else
- {
- assert (!to_end_cresc_p_);
- to_end_cresc_p_ =cresc_p_;
- cresc_p_ = 0;
- }
- }
- else if (span_l->spantype == Span_req::START)
- {
- cresc_req_l_ = span_l;
- assert (!new_cresc_p);
- new_cresc_p = new Crescendo;
- new_cresc_p->grow_dir_i_ = span_l->dynamic_dir_i_;
- announce_element (Score_elem_info (new_cresc_p, span_l));
- }
- }
+ Span_dynamic_req* span_l = dreq_l->span_dynamic();
+ if (span_l->spantype == Span_req::STOP)
+ {
+ if (!cresc_p_)
+ {
+ span_l->warning ("Can't find cresc to end ");
+ }
+ else
+ {
+ assert (!to_end_cresc_p_);
+ to_end_cresc_p_ =cresc_p_;
+ cresc_p_ = 0;
+ }
+ }
+ else if (span_l->spantype == Span_req::START)
+ {
+ cresc_req_l_ = span_l;
+ assert (!new_cresc_p);
+ new_cresc_p = new Crescendo;
+ new_cresc_p->grow_dir_ = span_l->dynamic_dir_;
+ announce_element (Score_elem_info (new_cresc_p, span_l));
+ }
+ }
}
- if ( new_cresc_p)
+ if (new_cresc_p)
{
- cresc_p_ = new_cresc_p;
- cresc_p_->left_col_l_ = get_staff_info().musical_l ();
- if (dynamic_p_)
- {
- cresc_p_->left_dyn_b_ = true;
- }
+ cresc_p_ = new_cresc_p;
+ cresc_p_->set_bounds(LEFT,get_staff_info().musical_l ());
+ if (dynamic_p_)
+ {
+ cresc_p_->dyn_b_drul_[LEFT] = true;
+ }
}
}
Staff_symbol* s_l = get_staff_info().staff_sym_l_;
if (dynamic_p_)
{
- dynamic_p_->set_staffsym (s_l);
- typeset_element (dynamic_p_);
- dynamic_p_ = 0;
+ dynamic_p_->set_staffsym (s_l);
+ typeset_element (dynamic_p_);
+ dynamic_p_ = 0;
}
- if ( to_end_cresc_p_)
+ if (to_end_cresc_p_)
{
- if (dynamic_p_)
- to_end_cresc_p_->right_dyn_b_=true;
+ if (dynamic_p_)
+ to_end_cresc_p_->dyn_b_drul_[RIGHT]=true;
- to_end_cresc_p_->right_col_l_ = get_staff_info().musical_l ();
- to_end_cresc_p_->set_staffsym (s_l);
- typeset_element (to_end_cresc_p_);
- to_end_cresc_p_ = 0;
+ to_end_cresc_p_->set_bounds(RIGHT,get_staff_info().musical_l ());
+ to_end_cresc_p_->set_staffsym (s_l);
+ typeset_element (to_end_cresc_p_);
+ to_end_cresc_p_ = 0;
}
}
Dynamic_engraver::set_feature (Feature i)
{
if (i.type_ == "vdir")
- dir_i_ = i.value_;
+ dir_ = (Direction) int(i.value_);
}
delete to_end_cresc_p_;
if (cresc_p_)
{
- cresc_req_l_->warning ("unended crescendo");
+ cresc_req_l_->warning ("unended crescendo");
}
delete cresc_p_;
}
{
if (i.elem_l_->name() == Note_column::static_name ())
{
- if (dynamic_p_) dynamic_p_->add_support (i.elem_l_);
- if (to_end_cresc_p_)
- to_end_cresc_p_->add_support (i.elem_l_);
- if (cresc_p_)
- cresc_p_->add_support (i.elem_l_);
+ if (dynamic_p_) dynamic_p_->add_support (i.elem_l_);
+ if (to_end_cresc_p_)
+ to_end_cresc_p_->add_support (i.elem_l_);
+ if (cresc_p_)
+ cresc_p_->add_support (i.elem_l_);
}
}
#include "p-col.hh"
void
-Horizontal_vertical_group_item::do_print()const
+Horizontal_vertical_group_item::do_print() const
{
Horizontal_vertical_group_element::do_print();
}
remove_all();
}
+void
+Axis_group_element::do_junk_links()
+{
+ axis_admin_.elem_l_arr_.set_size (0);
+}
+
bool
-Axis_group_element::contains_b (Score_elem const*e)const
+Axis_group_element::contains_b (Score_elem const*e) const
{
return axis_admin_.contains_b (e);
}
Link_array<Score_elem>
-Axis_group_element::get_extra_dependencies()const
+Axis_group_element::get_extra_dependencies() const
{
return axis_admin_.elem_l_arr_;
}
void
-Axis_group_element::do_print()const
+Axis_group_element::do_print() const
{
axis_admin_.print();
}
+
+Axis_group_element::Axis_group_element()
+{
+ transparent_b_ = true;
+}
+
// ****************
{
axis_admin_.remove_all (Y_AXIS,Y_AXIS);
}
+
// ****************
void
Interval
-Horizontal_group_element::do_width()const
+Horizontal_group_element::do_width() const
{
return axis_admin_.extent (X_AXIS);
}
Engraver* get_engraver_p (String);
void
-Engraver_group_engraver::print()const
+Engraver_group_engraver::print() const
{
Engraver::print();
}
{
for (int i =0; i < group_l_arr_.size();)
{
- group_l_arr_[i]->check_removal();
- if (group_l_arr_[i]->removable_b())
- terminate_engraver (group_l_arr_[i]);
- else
- i++;
+ group_l_arr_[i]->check_removal();
+ if (group_l_arr_[i]->removable_b())
+ terminate_engraver (group_l_arr_[i]);
+ else
+ i++;
}
}
bool
-Engraver_group_engraver::removable_b()const
+Engraver_group_engraver::removable_b() const
{
return !iterator_count_&& !group_l_arr_.size() ;
}
// why the while construct?
while (i.ok())
{
- // this construction to ensure clean deletion
- Engraver *grav_l = i++;
- grav_l->set_feature (d);
+ // this construction to ensure clean deletion
+ Engraver *grav_l = i++;
+ grav_l->set_feature (d);
}
}
PCursor<Engraver*> i (grav_list_.top());
while (i.ok())
{
- Engraver *grav_l = i++;
- grav_l->sync_features();
+ Engraver *grav_l = i++;
+ grav_l->sync_features();
}
}
PCursor<Engraver*> i (grav_list_.top());
while (i.ok())
{
- Engraver *grav_l = i++;
- grav_l->pre_move_processing();
+ Engraver *grav_l = i++;
+ grav_l->pre_move_processing();
}
}
PCursor<Engraver*> i (grav_list_.top());
while (i.ok())
{
- Engraver *grav_l = i++;
- grav_l->process_requests();
+ Engraver *grav_l = i++;
+ grav_l->process_requests();
}
}
PCursor<Engraver*> i (grav_list_.top());
while (i.ok())
{
- // this construction to ensure clean deletion
- Engraver *grav_l = i++;
- grav_l->post_move_processing();
+ // this construction to ensure clean deletion
+ Engraver *grav_l = i++;
+ grav_l->post_move_processing();
}
}
bool
-Engraver_group_engraver::contains_b (Engraver* grav_l)const
+Engraver_group_engraver::contains_b (Engraver* grav_l) const
{
bool parent_b = Engraver::contains_b (grav_l);
if (parent_b)
- return true;
+ return true;
for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++)
- if (i->contains_b (grav_l))
- return true;
+ if (i->contains_b (grav_l))
+ return true;
return false;
}
{
bool hebbes_b =false;
for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++)
- hebbes_b =nongroup_l_arr_[i]->try_request (req_l);
+ hebbes_b =nongroup_l_arr_[i]->try_request (req_l);
if (!hebbes_b && daddy_grav_l_)
- hebbes_b = daddy_grav_l_->try_request (req_l);
+ hebbes_b = daddy_grav_l_->try_request (req_l);
return hebbes_b ;
}
if (grav_p->is_type_b (Engraver_group_engraver::static_name()))
{
- group_l_arr_.push ((Engraver_group_engraver*)grav_p);
+ group_l_arr_.push ((Engraver_group_engraver*)grav_p);
}
else
{
- nongroup_l_arr_ .push (grav_p);
+ nongroup_l_arr_ .push (grav_p);
}
}
ADD_THIS_ENGRAVER(Engraver_group_engraver);
void
-Engraver_group_engraver::do_print()const
+Engraver_group_engraver::do_print() const
{
#ifndef NPRINT
- if ( !check_debug)
- return ;
+ if (!check_debug)
+ return ;
DOUT << "ID: " << id_str_ ;
DOUT << " iterators: " << iterator_count_<< "\n";
for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++)
- i->print();
+ i->print();
#endif
}
Engraver_group_engraver::find_engraver_l (String n, String id)
{
if (name() == n && id_str_ == id)
- return this;
+ return this;
Engraver_group_engraver * r = 0;
for (int i =0; !r && i< group_l_arr_.size(); i++)
{
- r = group_l_arr_[i]->find_engraver_l (n,id);
+ r = group_l_arr_[i]->find_engraver_l (n,id);
}
return r;
Engraver_group_engraver::find_get_translator_l (String n,String id)
{
Translator * ret=0;
- Input_translator * itrans_l= itrans_l_-> recursive_find ( n);
+ Input_translator * itrans_l= itrans_l_-> recursive_find (n);
if (itrans_l)
{
- ret = find_engraver_l (n,id);
- if (!ret)
- {
- Engraver_group_engraver * group =
- itrans_l-> get_group_engraver_p();
+ ret = find_engraver_l (n,id);
+ if (!ret)
+ {
+ Engraver_group_engraver * group =
+ itrans_l-> get_group_engraver_p();
- add (group);
- ret = group;
+ add (group);
+ ret = group;
- if (group->itrans_l_->is_name_b (n) )
- ret ->id_str_ = id;
- else
- return ret->find_get_translator_l (n,id);
+ if (group->itrans_l_->is_name_b (n))
+ ret ->id_str_ = id;
+ else
+ return ret->find_get_translator_l (n,id);
- }
+ }
}
else if (daddy_grav_l_)
- ret =daddy_grav_l_->find_get_translator_l (n,id);
+ ret =daddy_grav_l_->find_get_translator_l (n,id);
else
{
- warning ("Can't find or create `" + n + "' called `" + id + "'\n");
- ret =0;
+ warning ("Can't find or create `" + n + "' called `" + id + "'\n");
+ ret =0;
}
return ret;
}
int
-Engraver_group_engraver::depth_i()const
+Engraver_group_engraver::depth_i() const
{
return daddy_grav_l_->depth_i() + 1;
}
Engraver_group_engraver::ancestor_l (int l)
{
if (!l || !daddy_grav_l_)
- return this;
+ return this;
return daddy_grav_l_->ancestor_l (l-1);
}
{
for (int i=0; i < group_l_arr_.size(); i++)
{
- group_l_arr_[i]->do_announces();
+ group_l_arr_[i]->do_announces();
}
Request dummy_req;
for (int j =0; j < announce_info_arr_.size(); j++)
{
- Score_elem_info info = announce_info_arr_[j];
+ Score_elem_info info = announce_info_arr_[j];
- if (!info.req_l_)
- info.req_l_ = &dummy_req;
- for (int i=0; i < nongroup_l_arr_.size(); i++) { // Is this good enough?6
- if (nongroup_l_arr_[i] != info.origin_grav_l_arr_[0])
- nongroup_l_arr_[i]->acknowledge_element (info);
- }
+ if (!info.req_l_)
+ info.req_l_ = &dummy_req;
+ for (int i=0; i < nongroup_l_arr_.size(); i++) { // Is this good enough?6
+ if (nongroup_l_arr_[i] != info.origin_grav_l_arr_[0])
+ nongroup_l_arr_[i]->acknowledge_element (info);
+ }
}
announce_info_arr_.clear();
}
Engraver_group_engraver::do_removal_processing()
{
for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++)
- i->removal_processing();
+ i->removal_processing();
}
Staff_info
-Engraver_group_engraver::get_staff_info()const
+Engraver_group_engraver::get_staff_info() const
{
Staff_info inf = Engraver::get_staff_info();
for (int i=0; i < nongroup_l_arr_.size(); i++)
- nongroup_l_arr_[i]->fill_staff_info (inf);
+ nongroup_l_arr_[i]->fill_staff_info (inf);
return inf;
}
Engraver_group_engraver::get_default_interpreter()
{
// ?
- if ( is_bottom_engraver_b())
- return daddy_grav_l_->get_default_interpreter();
+ if (is_bottom_engraver_b())
+ return daddy_grav_l_->get_default_interpreter();
Engraver_group_engraver *grav_p= itrans_l_->
- get_default_itrans_l()->get_group_engraver_p ();
+ get_default_itrans_l()->get_group_engraver_p ();
add (grav_p);
if (grav_p->is_bottom_engraver_b())
- return grav_p;
+ return grav_p;
else
- return grav_p->get_default_interpreter();
+ return grav_p->get_default_interpreter();
}
bool
-Engraver_group_engraver::is_bottom_engraver_b()const
+Engraver_group_engraver::is_bottom_engraver_b() const
{
return !itrans_l_->get_default_itrans_l();
}
Engraver*
-Engraver_group_engraver::get_simple_engraver (char const *type)const
+Engraver_group_engraver::get_simple_engraver (char const *type) const
{
for (int i=0; i < nongroup_l_arr_.size(); i++)
{
- if (nongroup_l_arr_[i]->name() == type)
- return nongroup_l_arr_[i];
+ if (nongroup_l_arr_[i]->name() == type)
+ return nongroup_l_arr_[i];
}
- if ( daddy_grav_l_)
- return daddy_grav_l_->get_simple_engraver (type);
+ if (daddy_grav_l_)
+ return daddy_grav_l_->get_simple_engraver (type);
return 0;
}
void
Engraver::removal_processing()
{
- if ( status < CREATION_INITED)
+ if (status < CREATION_INITED)
do_creation_processing();
do_removal_processing();
}
Paper_def*
-Engraver::paper()const
+Engraver::paper() const
{
return daddy_grav_l_->paper();
}
bool
-Engraver::contains_b (Engraver *grav_l)const
+Engraver::contains_b (Engraver *grav_l) const
{
return this == grav_l;
}
Staff_info
Engraver::get_staff_info() const
{
- return daddy_grav_l_->get_staff_info();
+ if (daddy_grav_l_)
+ return daddy_grav_l_->get_staff_info();
+ Staff_info info;
+ return info;
}
void
#include "general-script-def.hh"
#include "debug.hh"
#include "symbol.hh"
-int
-General_script_def::staff_dir_i()const
+Direction
+General_script_def::staff_dir() const
{
- return -1;
+ return DOWN;
}
-int
-General_script_def::rel_stem_dir_i()const
+
+Direction
+General_script_def::rel_stem_dir() const
{
- return 0;
+ return CENTER;
}
int
-General_script_def::priority_i()const
+General_script_def::priority_i() const
{
return 1000;
}
bool
-General_script_def::inside_b()const
+General_script_def::inside_b() const
{
return false;
}
bool
-General_script_def::equal_b (General_script_def const&g)const
+General_script_def::equal_b (General_script_def const&g) const
{
if (name() != g.name ())
- return false;
+ return false;
return do_equal_b (&g);
}
bool
-General_script_def::do_equal_b (General_script_def const*)const
+General_script_def::do_equal_b (General_script_def const*) const
{
return true;
}
}
Atom
-General_script_def::get_atom (Paper_def*, int)const
+General_script_def::get_atom (Paper_def*, Direction) const
{
Symbol s;
return Atom (s);
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-#include "music.hh"
#include "global-translator.hh"
-#include "score.hh"
-#include "score-column.hh"
Global_translator::Global_translator()
{
- score_l_ = 0;
last_mom_ = 0;
}
}
int
-Global_translator::depth_i()const
+Global_translator::depth_i() const
{
return 0;
}
-void
-Global_translator::set_score (Score *s)
-{
- score_l_ = s;
- last_mom_ = score_l_->music_p_->time_int().max ();
-}
-
void
Global_translator::modify_next (Moment &w)
{
}
int
-Global_translator::moments_left_i()const
+Global_translator::moments_left_i() const
{
return extra_mom_pq_.size();
}
IMPLEMENT_IS_TYPE_B1(Global_translator, Translator);
+
+Music_output*
+Global_translator::get_output_p()
+{
+ return 0;
+}
*/
Array<Col_hpositions>
-Gourlay_breaking::do_solve()const
+Gourlay_breaking::do_solve() const
{
Array<Break_node> optimal_paths;
Line_of_cols line = all.slice (breaks[start_idx], breaks[break_idx]+1);
- line[0] = line[0]->postbreak_p_;
- line.top() = line.top ()->prebreak_p_;
+ line[0] = line[0]->postbreak_l();
+ line.top() = line.top ()->prebreak_l();
if (!feasible (line))
break;
for (int j=0; j < candidates.size(); j++)
{
int start = candidates[j];
- if ( optimal_paths[start].line_config_.energy_f_
+ if (optimal_paths[start].line_config_.energy_f_
+ candidate_lines[j].energy_f_ > minimal_energy)
continue;
- if ( !candidate_lines[j].satisfies_constraints_b_)
+ if (!candidate_lines[j].satisfies_constraints_b_)
{
candidate_lines[j].solve_line();
- ((Break_algorithm*)this)->exact_stats_.add ( candidate_lines[j].cols);
+ ((Break_algorithm*)this)->exact_stats_.add (candidate_lines[j].cols);
}
Real this_energy
= optimal_paths[start].line_config_.energy_f_
+ candidate_lines[j].energy_f_ ;
- if ( this_energy < minimal_energy)
+ if (this_energy < minimal_energy)
{
minimal_j = j;
minimal_energy = this_energy;
optimal_paths[break_idx].line_config_ = candidate_lines[minimal_j];
}
- if ( !(break_idx % HAPPY_DOTS_I))
+ if (!(break_idx % HAPPY_DOTS_I))
*mlog << "[" << break_idx << "]"<<flush;
}
- if ( break_idx % HAPPY_DOTS_I)
+ if (break_idx % HAPPY_DOTS_I)
*mlog << "[" << break_idx << "]"<<flush;
Array<int> final_breaks;
Array<Col_hpositions> lines;
- Real min_energy_f_ = infinity_f;
- Real max_energy_f_ = 0;
+
+ Real max_energy_f = 0;
/* skip 0-th element, since it is a "dummy" elt*/
for (int i = optimal_paths.size()-1; i> 0;)
{
- final_breaks.push ( i);
- assert ( i > optimal_paths[i].prev_break_i_);
+ final_breaks.push (i);
+ assert (i > optimal_paths[i].prev_break_i_);
// there was no "feasible path"
if (!optimal_paths[i].line_config_.config.size()) {
/*
TODO print variation in energy
*/
- if (max_energy_f_ )
+ if (max_energy_f)
{
;
}
for (int i= final_breaks.size(); i--;)
- lines.push ( optimal_paths[final_breaks[i]].line_config_);
+ lines.push (optimal_paths[final_breaks[i]].line_config_);
return lines;
}
void
-Rhythmic_grouping::OK()const
+Rhythmic_grouping::OK() const
{
#ifndef NDEBUG
assert (bool (children.size()) != bool (interval_));
}
MInterval
-Rhythmic_grouping::interval()const
+Rhythmic_grouping::interval() const
{
if (interval_)
return *interval_;
Array<Rhythmic_grouping*> ch;
while (1)
{
- if ( i >= children.size() || j >= splitpoints.size ())
+ if (i >= children.size() || j >= splitpoints.size ())
break;
assert (
}
void
-Rhythmic_grouping::print()const
+Rhythmic_grouping::print() const
{
#ifndef NPRINT
DOUT << "{ \n";
Rhythmic_grouping::child_fit_b (Moment start)
{
if (children.size())
- return ( children.top()->interval ().right== start);
+ return (children.top()->interval ().right== start);
return true;
}
}
void
-Rhythmic_grouping::extend (MInterval m)const
+Rhythmic_grouping::extend (MInterval m) const
{
assert (m.left >= interval().left);
while (m.right >interval().right)
Head_column::Head_column()
{
stem_l_ = 0;
- dir_i_ =0;
+ dir_ =CENTER;
}
void
Head_column::do_substitute_dependency (Score_elem*o,
- Score_elem*n)
+ Score_elem*n)
{
Script_column::do_substitute_dependency (o,n);
if (o->name() == Note_head::static_name ())
{
- head_l_arr_.substitute ((Note_head*)o->item(),
- (n)? (Note_head*)n->item() : 0);
+ head_l_arr_.substitute ((Note_head*)o->item(),
+ (n)? (Note_head*)n->item() : 0);
}
if (stem_l_ == o)
{
- stem_l_ = n ? (Stem*)n->item():0;
+ stem_l_ = n ? (Stem*)n->item():0;
}
}
{
stem_l_ = stem_l;
Score_elem::add_dependency (stem_l);
- for (int i=0; script_l_arr_.size(); i++)
- script_l_arr_[i]->set_stem (stem_l);
+ for (int i=0; i < script_l_arr_.size(); i++)
+ script_l_arr_[i]->set_stem (stem_l);
}
void
{
Script_column::add (script_l) ;
if (stem_l_)
- script_l->set_stem (stem_l_);
+ script_l->set_stem (stem_l_);
}
void
Head_column::add (Note_head *n_l)
void
Head_column::do_pre_processing()
{
- if (!dir_i_)
+ if (!dir_)
{
- if (stem_l_)
- dir_i_ = stem_l_->dir_i_;
+ if (stem_l_)
+ dir_ = stem_l_->dir_;
}
Script_column::do_pre_processing();
}
IMPLEMENT_IS_TYPE_B1(Horizontal_align_item,Item);
-void
-Horizontal_align_item::OK() const
-{
- for (int i =0; i < item_l_arr_.size(); i++)
- assert ( pcol_l_ == item_l_arr_[i]->pcol_l_);
-}
+
bool
-Horizontal_align_item::contains_b (Item *i)const
+Horizontal_align_item::contains_b (Item *i) const
{
return item_l_arr_.find_l (i);
}
int i;
while ((i = item_l_arr_.find_i (o->item())) >=0)
{
- if (n)
- item_l_arr_[i] = n->item();
- else
- item_l_arr_.del (i);
+ if (n)
+ item_l_arr_[i] = n->item();
+ else
+ item_l_arr_.del (i);
}
}
Item * item_l_;
int priority_i_;
static int compare (Horizontal_align_item_content const &h1,
- Horizontal_align_item_content const &h2)
- {
- return h1.priority_i_ - h2.priority_i_;
- }
+ Horizontal_align_item_content const &h2)
+ {
+ return h1.priority_i_ - h2.priority_i_;
+ }
Horizontal_align_item_content (Item*i, int p)
- {
- priority_i_ = p;
- item_l_ = i;
- }
+ {
+ priority_i_ = p;
+ item_l_ = i;
+ }
Horizontal_align_item_content(){item_l_ =0; priority_i_ =0; }
};
void
Horizontal_align_item::do_pre_processing()
{
- OK();
{
- Array<Horizontal_align_item_content> content;
- for (int i =0; i < item_l_arr_.size(); i++)
- content.push (
- Horizontal_align_item_content (
- item_l_arr_[i], priority_i_arr_[i]));
- content.sort (Horizontal_align_item_content::compare);
- item_l_arr_.clear();
- priority_i_arr_.clear();
- for (int i =0; i < content.size(); i++)
- {
- item_l_arr_.push (content[i].item_l_);
- priority_i_arr_.push (content[i].priority_i_);
- }
- }
+ Array<Horizontal_align_item_content> content;
+ for (int i =0; i < item_l_arr_.size(); i++)
+ content.push (
+ Horizontal_align_item_content (
+ item_l_arr_[i], priority_i_arr_[i]));
+ content.sort (Horizontal_align_item_content::compare);
+ item_l_arr_.clear();
+ priority_i_arr_.clear();
+ for (int i =0; i < content.size(); i++)
+ {
+ item_l_arr_.push (content[i].item_l_);
+ priority_i_arr_.push (content[i].priority_i_);
+ }
+ }
Array<Interval> dims;
Real total =0;
for (int i =0; i < item_l_arr_.size(); i++)
{
- Interval item_width= item_l_arr_[i]->width();
- if (item_width.empty_b())
- {
- item_width = Interval (0,0);
- }
- dims.push (item_width);
- total += item_width.length();
+ Interval item_width= item_l_arr_[i]->width();
+ if (item_width.empty_b())
+ {
+ item_width = Interval (0,0);
+ }
+ dims.push (item_width);
+ total += item_width.length();
}
Real where_f= total * (align_i_-1.0)/2.0;
Real center_dx_f = 0;
- for ( int i=0 ; i < item_l_arr_.size(); i++)
+ for (int i=0 ; i < item_l_arr_.size(); i++)
{
- Real dx = where_f -dims[i][-1];
- item_l_arr_[i]->translate (dx , X_AXIS);
- if (item_l_arr_[i] == center_l_)
- center_dx_f = where_f;
- where_f += dims[i].length();
+ Real dx = where_f -dims[i][-1];
+ item_l_arr_[i]->translate (dx , X_AXIS);
+ if (item_l_arr_[i] == center_l_)
+ center_dx_f = where_f;
+ where_f += dims[i].length();
}
if (center_dx_f && !align_i_)
- for ( int i=0 ; i < item_l_arr_.size(); i++)
- item_l_arr_[i]->translate (- center_dx_f , X_AXIS);
+ for (int i=0 ; i < item_l_arr_.size(); i++)
+ item_l_arr_[i]->translate (- center_dx_f , X_AXIS);
}
}
void
-Horizontal_align_item::do_print()const
+Horizontal_align_item::do_print() const
{
}
::error (e);
}
-Identifier::Identifier ( int code)
+Identifier::Identifier (int code)
{
token_code_i_ = code;
accessed_b_ = 0;
}
void
-Identifier::print()const
+Identifier::print() const
{
DOUT << "identifier ";
do_print();
void
-Duration_id::do_print()const
+Duration_id::do_print() const
{}
void
#include "lily-proto.hh"
#include "plist.hh"
+#include "music-output.hh"
/** all stuff which goes onto midi. notes, signs, symbols in a score
#Audio_score# contains the items, the columns.
*/
-class Audio_score {
+class Audio_score : public Music_output {
public:
- Audio_score (Score* l);
+ Audio_score ();
+ ~Audio_score () {}
- void add (Audio_column*);
- void add_staff (Audio_staff* l);
- void add (Audio_element*p);
+ void add (Audio_column*);
+ void add_staff (Audio_staff* l);
+ void add (Audio_element*p);
- void output (Midi_stream& midi_stream_r);
- void output_header_track (Midi_stream& midi_stream_r);
+ void output (Midi_stream& midi_stream_r);
+ void output_header_track (Midi_stream& midi_stream_r);
- void print() const;
- void process();
+ void print() const;
+ void process();
- Pointer_list<Audio_column*> audio_column_p_list_;
- Link_list<Audio_staff*> audio_staff_l_list_;
- Pointer_list<Audio_element*> audio_elem_p_list_;
- Score* score_l_;
+ Pointer_list<Audio_column*> audio_column_p_list_;
+ Link_list<Audio_staff*> audio_staff_l_list_;
+ Pointer_list<Audio_element*> audio_elem_p_list_;
+ Midi_def * midi_l_;
};
#endif // AUDIO_SCORE_HH
class Axis_group_item : public virtual Axis_group_element, public Item {
protected:
- virtual void do_breakable_col_processing();
- void OK()const;
- virtual void do_print() const;
+ virtual void do_breakable_col_processing();
+ void OK() const;
+ virtual void do_print() const;
+ virtual void do_junk_links() {
+ Item::do_junk_links();
+ Axis_group_element::do_junk_links();
+ }
+ virtual void do_unlink() {
+ Item::do_unlink();
+ Axis_group_element::do_unlink();
+ }
public:
- DECLARE_MY_RUNTIME_TYPEINFO;
-
+ DECLARE_MY_RUNTIME_TYPEINFO;
};
#endif // AXIS_ITEM_HH
useful example of this is the Vertical_group_spanner */
class Axis_group_spanner : public Spanner, public virtual Axis_group_element
{
- void do_break_processing_if_unbroken();
+ void do_break_processing_if_unbroken();
protected:
- virtual void do_break_processing();
- virtual void do_print()const;
+ virtual void do_junk_links () {
+ Spanner::do_junk_links();
+ Axis_group_element::do_junk_links();
+ }
+ virtual void do_unlink() {
+ Spanner::do_unlink();
+ Axis_group_element::do_unlink();
+ }
+ virtual void do_break_processing();
+ virtual void do_print() const;
public:
- DECLARE_MY_RUNTIME_TYPEINFO;
+ DECLARE_MY_RUNTIME_TYPEINFO;
};
#endif // SPAN_AXIS_GROUP_HH
#include "real.hh"
#include "lily-proto.hh"
#include "score-elem.hh"
+
/**
Do the dirty work for Axis_group_element.
*/
struct Axis_group_administration {
- Link_array<Score_elem> elem_l_arr_;
-
- Interval extent (Axis)const;
- void print() const ;
- Axis_group_administration (Axis_group_administration const&);
- Axis_group_administration(){}
- void remove_all (Axis a1,Axis a2);
+ Link_array<Score_elem> elem_l_arr_;
- bool contains_b (Score_elem const *)const;
- void add_element (Score_elem*, Axis_group_element*, Axis a1, Axis a2);
- void remove_element (Score_elem*, Axis a1, Axis a2);
+ Interval extent (Axis) const;
+ void print() const ;
+ Axis_group_administration (Axis_group_administration const&);
+ Axis_group_administration(){}
+ void remove_all (Axis a1, Axis a2);
+
+ bool contains_b (Score_elem const *) const;
+ void add_element (Score_elem*, Axis_group_element*, Axis a1, Axis a2);
+ void remove_element (Score_elem*, Axis a1, Axis a2);
};
/**
*/
class Axis_group_element : public virtual Score_elem {
protected:
- Axis_group_administration axis_admin_;
- virtual void do_print()const;
- virtual Link_array<Score_elem> get_extra_dependencies()const;
- virtual void do_unlink();
+ Axis_group_administration axis_admin_;
+ virtual void do_print() const;
+ virtual Link_array<Score_elem> get_extra_dependencies() const;
+ virtual void do_unlink();
+ virtual void do_junk_links();
public:
- virtual void remove_all()=0;
- virtual void add_element (Score_elem*)=0;
- virtual void remove_element (Score_elem*)=0;
- virtual bool contains_b (Score_elem const *)const;
- DECLARE_MY_RUNTIME_TYPEINFO;
+ Axis_group_element();
+ virtual void remove_all()=0;
+ virtual void add_element (Score_elem*)=0;
+ virtual void remove_element (Score_elem*)=0;
+ virtual bool contains_b (Score_elem const *) const;
+ DECLARE_MY_RUNTIME_TYPEINFO;
};
#endif // Axis_group_administration_HH
catch bars, and put a number over them.
*/
class Bar_number_grav : public Engraver {
- Script * script_p_;
- int number_i_;
+ Script * script_p_;
protected:
- void acknowledge_element (Score_elem_info);
- void do_pre_move_processing();
+ void acknowledge_element (Score_elem_info);
+ void do_pre_move_processing();
public:
- Bar_number_grav();
- DECLARE_MY_RUNTIME_TYPEINFO;
+ Bar_number_grav();
+ DECLARE_MY_RUNTIME_TYPEINFO;
};
#endif // BAR_NUMBER_GRAV_HH
*/
class Bar:public Item {
public:
- String type_str_;
- int spanned_i_;
+ String type_str_;
+ int spanned_i_;
- DECLARE_MY_RUNTIME_TYPEINFO;
- SCORE_ELEM_CLONE(Bar);
- Bar();
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ SCORE_ELEM_CLONE(Bar);
+ Bar();
private:
- void do_print() const;
+ void do_print() const;
protected:
- virtual void do_pre_processing();
- Molecule*brew_molecule_p()const;
+ virtual void do_pre_processing();
+ Molecule*brew_molecule_p() const;
};
#endif // BAR_HH
--- /dev/null
+/*
+ beam-grav.hh -- declare Beam_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef BEAM_GRAV_HH
+#define BEAM_GRAV_HH
+
+#include "engraver.hh"
+#include "drul-array.hh"
+
+/**
+ Generate a beam. Eats stems.
+ */
+class Beam_engraver : public Engraver
+{
+ Drul_array<Beam_req *> span_reqs_drul_;
+ Beam *beam_p_;
+ Rhythmic_grouping *current_grouping_p_;
+
+public:
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Beam_engraver();
+protected:
+ virtual void do_removal_processing();
+ virtual void do_process_requests();
+ virtual bool do_try_request (Request*);
+ virtual void acknowledge_element (Score_elem_info);
+ virtual void do_pre_move_processing();
+};
+
+#endif // BEAM_GRAV_HH
direction */
class Beam: public Directional_spanner {
public:
- Link_array<Stem> stems;
- /// the slope of the beam in posns / point (dimension)
- Real slope;
+ Link_array<Stem> stems;
+ /// the slope of the beam in posns / point (dimension)
+ Real slope;
- /// position of leftmost end of beam
- Real left_pos;
+ /// position of leftmost end of beam
+ Real left_pos;
- /* *************** */
- DECLARE_MY_RUNTIME_TYPEINFO;
- Beam();
- void add (Stem*);
+ /* *************** */
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Beam();
+ void add (Stem*);
- void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
- void set_stemlens();
- SCORE_ELEM_CLONE(Beam);
+ void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
+ void set_stemlens();
+ SCORE_ELEM_CLONE(Beam);
protected:
- virtual Interval do_width()const;
- virtual Offset center() const;
- virtual void set_default_dir();
- virtual void do_pre_processing();
- virtual void do_post_processing();
- virtual void do_substitute_dependent (Score_elem*, Score_elem*);
+ virtual Interval do_width() const;
+ virtual Offset center() const;
+ virtual void set_default_dir();
+ virtual void do_pre_processing();
+ virtual void do_post_processing();
+ virtual void do_substitute_dependent (Score_elem*, Score_elem*);
- virtual void do_print() const;
+ virtual void do_print() const;
private:
- Molecule stem_beams (Stem *here, Stem *next, Stem *prev)const;
- void solve_slope();
- Molecule*brew_molecule_p()const;
+ Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
+ void solve_slope();
+ Molecule*brew_molecule_p() const;
};
#endif // BEAM_HH
*/
class Bow : public Directional_spanner {
protected:
- int left_pos_i_;
- int right_pos_i_;
- Real left_dx_f_;
- Real right_dx_f_;
+ Drul_array<int> pos_i_drul_;
+ Drul_array<Real> dx_f_drul_;
- Molecule*brew_molecule_p()const;
+ Molecule*brew_molecule_p() const;
public:
- Bow();
- DECLARE_MY_RUNTIME_TYPEINFO;
- Offset center() const;
+ Bow();
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Offset center() const;
};
#endif // BOW_HH
Interval &x() {return interval_a_[X_AXIS]; }
Interval &y(){ return interval_a_[Y_AXIS]; }
- Interval x()const{ return interval_a_[X_AXIS]; }
- Interval y()const{return interval_a_[Y_AXIS]; }
+ Interval x() const{ return interval_a_[X_AXIS]; }
+ Interval y() const{return interval_a_[Y_AXIS]; }
Interval operator[](Axis a) {
return interval_a_[a];
}
struct Break_caching : Break_algorithm
{
void do_set_pscore();
- Array<Col_hpositions> do_solve()const;
+ Array<Col_hpositions> do_solve() const;
};
Col_stats();
void add (Line_of_cols const&l);
- String str()const;
+ String str() const;
};
/** Class representation of an algorithm which decides where to put
Line_of_cols find_breaks() const;
Line_of_cols all_cols() const;
- Array<int> find_break_indices()const;
+ Array<int> find_break_indices() const;
/// helper: solve for the columns in #curline#.
void approximate_solve_line (Col_hpositions*) const;
/// does curline fit on the paper?
- bool feasible (Line_of_cols)const;
+ bool feasible (Line_of_cols) const;
- Line_spacer* generate_spacing_problem (Line_of_cols)const;
+ Line_spacer* generate_spacing_problem (Line_of_cols) const;
- virtual Array<Col_hpositions> do_solve()const=0;
- void print_stats()const;
+ virtual Array<Col_hpositions> do_solve() const=0;
+ void print_stats() const;
virtual void do_set_pscore();
public:
void set_pscore (Paper_score*);
/// check if the spacing/breaking problem is well-stated
- void problem_OK()const;
- void OK()const;
- Array<Col_hpositions> solve()const;
+ void problem_OK() const;
+ void OK() const;
+ Array<Col_hpositions> solve() const;
};
#endif // BREAK_HH
--- /dev/null
+/*
+ chord-iter.hh -- declare Chord_iterator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CHORD_ITER_HH
+#define CHORD_ITER_HH
+
+
+#include "music-iterator.hh"
+#include "plist.hh"
+
+class Chord_iterator : public Music_iterator
+{
+ const Chord *chord_C_;
+ Pointer_list<Music_iterator*> children_p_list_;
+public:
+ ~Chord_iterator();
+ Chord_iterator (Chord const*);
+ DECLARE_MY_RUNTIME_TYPEINFO;
+protected:
+ virtual void do_print() const;
+ virtual void construct_children();
+ virtual void process_and_next (Moment);
+ virtual Moment next_moment() const;
+ virtual bool ok() const;
+};
+
+#endif // CHORD_ITER_HH
class Clef_item : public Item {
protected:
virtual void do_pre_processing();
- Molecule* brew_molecule_p()const;
+ Molecule* brew_molecule_p() const;
public:
String type_;
/// helper struct for #Spacing_problem#
struct Colinfo {
- PCol *pcol_l_;
+ Paper_column *pcol_l_;
P<Real> fixpos_p_;
Interval width;
int rank_i_;
bool ugh_b_;
/* *************** */
Colinfo();
- Colinfo (PCol *,Real const *);
+ Colinfo (Paper_column *,Real const *);
void print() const;
bool fixed() const { return fixpos_p_.get_C();}
- Real fixed_position()const { return *fixpos_p_; }
+ Real fixed_position() const { return *fixpos_p_; }
Real minright() const { return width.right; }
Real minleft() const { return -width.left; }
};
#include "varray.hh"
#include "lily-proto.hh"
-typedef Array<PCol*> Line_of_cols;
+typedef Array<Paper_column*> Line_of_cols;
struct Col_hpositions {
Line_spacer * spacer_l_;
bool satisfies_constraints_b_;
/* ************** */
- void OK()const;
+ void OK() const;
~Col_hpositions();
void solve_line();
void approximate_solve_line();
constraints. should always work */
void stupid_solution();
Col_hpositions();
- void add (PCol*c);
+ void add (Paper_column*c);
void print() const;
};
Tempo_req();
REQUESTMETHODS(Tempo_req, tempo);
- bool do_equal_b (Request *)const;
+ bool do_equal_b (Request *) const;
};
class Partial_measure_req : public Timing_req {
Partial_measure_req (Moment);
REQUESTMETHODS(Partial_measure_req, partial);
- bool do_equal_b (Request*)const;
+ bool do_equal_b (Request*) const;
};
/**
Meter_change_req();
void set (int,int);
- bool do_equal_b (Request*)const;
+ bool do_equal_b (Request*) const;
REQUESTMETHODS(Meter_change_req, meterchange);
};
public:
/// turn on?
bool on_b_;
- bool do_equal_b (Request*)const;
+ bool do_equal_b (Request*) const;
Cadenza_req (bool);
REQUESTMETHODS(Cadenza_req,cadenza);
};
/// check if we're at start of a measure.
class Barcheck_req : public Timing_req {
public:
- bool do_equal_b (Request *)const;
+ bool do_equal_b (Request *) const;
REQUESTMETHODS(Barcheck_req,barcheck);
};
public:
Array<int> beat_i_arr_;
Array<Moment> elt_length_arr_;
- bool do_equal_b (Request *)const;
+ bool do_equal_b (Request *) const;
REQUESTMETHODS(Measure_grouping_req, measuregrouping);
};
public:
String type_str_;
Bar_req (String);
- bool do_equal_b (Request*)const;
+ bool do_equal_b (Request*) const;
REQUESTMETHODS(Bar_req,bar);
};
*/
class Crescendo : public Spanner , public Staff_side {
public:
- int grow_dir_i_;
+ int grow_dir_;
-/// if there is a dynamic at the end, make the sign smaller.
- bool right_dyn_b_;
+ /// if there is a dynamic at the end, make the sign smaller.
+ Drul_array<bool> dyn_b_drul_;
- /// if there is a dynamic at the end, make the sign smaller.
- bool left_dyn_b_;
- Crescendo();
+ Crescendo();
protected:
- SCORE_ELEM_CLONE(Crescendo);
- virtual Molecule*brew_molecule_p()const;
- virtual Interval symbol_height()const;
- DECLARE_MY_RUNTIME_TYPEINFO;
+ SCORE_ELEM_CLONE(Crescendo);
+ virtual Molecule*brew_molecule_p() const;
+ virtual Interval symbol_height() const;
+ DECLARE_MY_RUNTIME_TYPEINFO;
private:
- Symbol get_symbol()const;
-
+ Symbol get_symbol() const;
};
#endif // CRESCENDO_HH
--- /dev/null
+/*
+ direction.hh -- declare
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef DIRECTION_HH
+#define DIRECTION_HH
+
+enum Direction
+{
+ UP=1,
+ DOWN=-1,
+ LEFT=-1,
+ RIGHT=1,
+ CENTER=0,
+ SMALLER=-1,
+ BIGGER=1,
+
+};
+
+
+#endif // DIRECTION_HH
public:
/// -1 below heads, +1 above heads.
- int dir_i_;
+ Direction dir_;
Directional_spanner();
/// offset of "center" relative to left-column/0-pos of staff
--- /dev/null
+/*
+ drul-array.hh -- declare Drul_array
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef DRUL_ARRAY_HH
+#define DRUL_ARRAY_HH
+
+#include "direction.hh"
+
+/**
+ Left/right or Up/down arrays. Drul is nicer sounding than udlr
+ */
+template<class T>
+struct Drul_array
+{
+ T array_[2];
+ T &operator[] (Direction d)
+ {
+ assert (d==1 || d== -1);
+ return array_[(d+1)/2];
+ }
+ T operator[] (Direction d) const
+ {
+ assert (d==1 || d== -1);
+ return array_[(d+1)/2];
+ }
+};
+
+#endif // DRUL_ARRAY_HH
#include "engraver.hh"
class Dynamic_engraver : public Engraver {
- int dir_i_;
+ Direction dir_;
Text_item * dynamic_p_;
Crescendo * to_end_cresc_p_;
Crescendo * cresc_p_;
*/
class Horizontal_vertical_group_item : public Axis_group_item, public Horizontal_vertical_group_element {
protected:
- virtual void do_print() const;
- virtual void remove_all() { Horizontal_vertical_group_element::remove_all (); }
+ virtual void do_print() const;
+ virtual void remove_all() { Horizontal_vertical_group_element::remove_all (); }
+ virtual void do_unlink () { Horizontal_vertical_group_element::do_unlink (); }
+ SCORE_ELEM_CLONE(Horizontal_vertical_group_item);
public:
- virtual void add_element (Score_elem*e) { Horizontal_vertical_group_element::add_element (e); }
- virtual void remove_element (Score_elem*e) { Horizontal_vertical_group_element::remove_element (e); }
+ virtual void add_element (Score_elem*e) { Horizontal_vertical_group_element::add_element (e); }
+ virtual void remove_element (Score_elem*e) { Horizontal_vertical_group_element::remove_element (e); }
- DECLARE_MY_RUNTIME_TYPEINFO;
- SCORE_ELEM_CLONE(Horizontal_vertical_group_item);
-
-
+ DECLARE_MY_RUNTIME_TYPEINFO;
};
#endif // ELEM_GROUP_ITEM_HH
class Horizontal_group_element : public virtual Axis_group_element {
protected:
virtual void remove_all();
- virtual Interval do_width()const;
+ virtual Interval do_width() const;
public:
DECLARE_MY_RUNTIME_TYPEINFO;
*/
class Vertical_group_element : public virtual Axis_group_element {
protected:
- virtual Interval do_height()const;
+ virtual Interval do_height() const;
virtual void remove_all();
public:
Array<Score_elem_info> announce_info_arr_;
- virtual void do_print()const;
- virtual bool removable_b()const;
+ virtual void do_print() const;
+ virtual bool removable_b() const;
public:
- Engraver*get_simple_engraver (char const*typeinfo)const;
+ Engraver*get_simple_engraver (char const*typeinfo) const;
virtual void print() const ;
Input_translator * itrans_l_;
virtual bool try_request (Request*);
virtual void do_process_requests();
- virtual Staff_info get_staff_info()const;
+ virtual Staff_info get_staff_info() const;
virtual Engraver_group_engraver * find_engraver_l (String name,String id);
virtual void do_announces();
virtual void announce_element (Score_elem_info);
virtual void add (Engraver* grav_p);
- virtual bool contains_b (Engraver*)const;
+ virtual bool contains_b (Engraver*) const;
virtual Translator* find_get_translator_l (String name, String id);
virtual Translator * get_default_interpreter();
virtual void sync_features() {}
- virtual bool contains_b (Engraver*grav_l)const;
+ virtual bool contains_b (Engraver*grav_l) const;
/**
Get information on the staff. Default: ask daddy.
*/
- virtual Staff_info get_staff_info()const;
+ virtual Staff_info get_staff_info() const;
virtual void fill_staff_info (Staff_info&);
- virtual void do_print()const;
+ virtual void do_print() const;
/*
@see{try_request}
Default: always return false
#include "lily-proto.hh"
#include "input.hh"
#include "virtual-methods.hh"
+#include "direction.hh"
+
/**
Definition of anything that is put aside staff/notes.
*/
public:
VIRTUAL_COPY_CONS(General_script_def,General_script_def);
DECLARE_MY_RUNTIME_TYPEINFO;
- virtual int staff_dir_i()const;
+ virtual Direction staff_dir() const;
void print() const;
- virtual int rel_stem_dir_i()const;
- virtual int priority_i()const;
- virtual bool inside_b()const;
- virtual Atom get_atom (Paper_def* p, int dir_i_)const;
- bool equal_b (General_script_def const&)const;
+ virtual Direction rel_stem_dir() const;
+ virtual int priority_i() const;
+ virtual bool inside_b() const;
+ virtual Atom get_atom (Paper_def* p, Direction dir_) const;
+ bool equal_b (General_script_def const&) const;
virtual ~General_script_def() {}
protected:
- virtual bool do_equal_b (General_script_def const *)const;
- virtual void do_print()const;
+ virtual bool do_equal_b (General_script_def const *) const;
+ virtual void do_print() const;
};
#endif // GENERAL_SCRIPT_DEF_HH
#include "pqueue.hh"
class Global_translator : public virtual Translator {
- PQueue<Moment> extra_mom_pq_;
- Moment last_mom_;
+ PQueue<Moment> extra_mom_pq_;
public:
- Score *score_l_;
+ Moment last_mom_;
+ Global_translator();
+ int moments_left_i() const;
+ void modify_next (Moment&);
+ void add_moment_to_process (Moment);
+
+ virtual Music_output *get_output_p ();
+ virtual void prepare (Moment);
+ virtual void process() {}
+ virtual void finish() {}
+ virtual void start() {}
- Global_translator();
- int moments_left_i()const;
- void modify_next (Moment&);
- void add_moment_to_process (Moment);
-
- virtual void set_score (Score*);
- virtual void prepare (Moment);
- virtual void process() {}
- virtual void finish() {}
- virtual void start() {}
-
- DECLARE_MY_RUNTIME_TYPEINFO;
+ DECLARE_MY_RUNTIME_TYPEINFO;
protected:
- virtual Global_translator *global_l() { return this; }
- virtual int depth_i() const;
- virtual Translator *ancestor_l (int);
+ virtual Global_translator *global_l() { return this; }
+ virtual int depth_i() const;
+ virtual Translator *ancestor_l (int);
};
/// maximum number of measures in a line
int max_measures_i_;
void do_set_pscore();
- Array<Col_hpositions> do_solve()const;
+ Array<Col_hpositions> do_solve() const;
Gourlay_breaking();
};
#endif // GOURLAY_BREAKING_HH
/* *************** */
Array<MInterval> intervals();
- MInterval interval()const;
+ MInterval interval() const;
Moment length() const;
void intersect (MInterval);
class Head_column : public Script_column
{
public:
- Link_array<Note_head> head_l_arr_;
- /** The relative position of the "voice" containing this
- chord. Normally this would be the same as the stem direction,
- but rests do not have stems.
-
- Hmm. outdated.. Rests *do* have stems.
- */
-
- int dir_i_;
- Stem* stem_l_;
-
- void add (Note_head*);
- virtual void add (Script*s);
- virtual void set (Stem*);
- Head_column();
- DECLARE_MY_RUNTIME_TYPEINFO;
+ Link_array<Note_head> head_l_arr_;
+ /** The relative position of the "voice" containing this
+ chord. Normally this would be the same as the stem direction,
+ but rests do not have stems.
+
+ Hmm. outdated.. Rests *do* have stems.
+ */
+
+ Direction dir_;
+ Stem* stem_l_;
+
+ void add (Note_head*);
+ virtual void add (Script*s);
+ void set (Stem*);
+ Head_column();
+ DECLARE_MY_RUNTIME_TYPEINFO;
protected:
- virtual void do_pre_processing();
- virtual void do_print()const;
- virtual void do_substitute_dependency (Score_elem*,Score_elem*);
+ virtual void do_pre_processing();
+ virtual void do_print() const;
+ virtual void do_substitute_dependency (Score_elem*,Score_elem*);
};
#endif // HEAD_COLUMN_HH
struct Header : Assoc<String, String>
{
- String TeX_string()const;
+ String TeX_string() const;
};
#endif // HEADER_HH
DECLARE_MY_RUNTIME_TYPEINFO;
SCORE_ELEM_CLONE(Horizontal_align_item);
void add (Item*, int p);
- void OK()const;
Horizontal_align_item();
protected:
virtual void do_substitute_dependency (Score_elem * , Score_elem *);
/// do calculations before determining horizontal spacing
virtual void do_pre_processing();
- virtual void do_print()const;
- virtual Interval do_width()const;
- bool contains_b (Item*)const;
+ virtual void do_print() const;
+ virtual Interval do_width() const;
+ bool contains_b (Item*) const;
};
#endif // HORIZONTAL_ALIGN_ITEM_HH
#include "elem-group.hh"
#include "axis-group-item.hh"
+/**
+ Group stuff in horizontal sense. Example: Paper_column
+ */
class Horizontal_group_item : public Axis_group_item, public Horizontal_group_element {
protected:
- virtual void remove_all() { Horizontal_group_element::remove_all (); }
- virtual void do_print() const;
+ virtual void remove_all() { Horizontal_group_element::remove_all (); }
+ virtual void do_unlink () {
+ Axis_group_item::do_unlink ();
+ }
+ virtual void do_junk_links() {
+ Axis_group_item::do_junk_links();
+ }
+ virtual void do_print() const;
public:
- virtual void add_element (Score_elem*e) { Horizontal_group_element::add_element (e); }
- virtual void remove_element (Score_elem*e) { Horizontal_group_element::remove_element (e); }
- DECLARE_MY_RUNTIME_TYPEINFO;
- SCORE_ELEM_CLONE(Horizontal_group_item);
-
-
+ virtual void add_element (Score_elem*e) { Horizontal_group_element::add_element (e); }
+ virtual void remove_element (Score_elem*e) { Horizontal_group_element::remove_element (e); }
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ SCORE_ELEM_CLONE(Horizontal_group_item);
};
#endif // HORIZONTAL_GROUP_ITEM_HH
int left_i_;
int right_i_;
- void print()const;
+ void print() const;
void OK() const ;
Idealspacing();
};
Identifier (int code) ;
virtual ~Identifier() ;
- void print()const;
+ void print() const;
DECLARE_MY_RUNTIME_TYPEINFO;
void error (String);
IDACCESSOR(Input_translator, input_translator)
IDACCESSOR(Duration, duration)
protected:
- virtual void do_print()const=0;
+ virtual void do_print() const=0;
private:
Identifier (Identifier const&);
};
Idclass (Class*st, int code);\
virtual Class* accessor ();\
~Idclass();\
- virtual void do_print()const; \
+ virtual void do_print() const; \
}\
*/
void assert_solution (Vector sol) const;
/// solve the problem using a projected gradient method
- Vector constraint_solve (Vector)const;
+ Vector constraint_solve (Vector) const;
/**
Solve it. First try it the easy way.
*/
Real eval (Vector v);
void eliminate_var (int idx, Real value);
- void OK()const;
+ void OK() const;
void print() const;
};
#include "boxes.hh"
#include "string.hh"
#include "score-elem.hh"
+#include "drul-array.hh"
/**
A horizontally fixed size element of the score.
*/
class Item : public virtual Score_elem {
public:
- /// indirection to the column it is in
- PCol * pcol_l_;
-
- Item * broken_to_a_[2];
-
- /// should be put in a breakable col.
- bool breakable_b_;
- int break_status_i_;
- /// nobreak = 0, pre = -1, post = 1
- int break_status_i()const;
- Item * find_prebroken_piece (PCol*)const;
- Item * find_prebroken_piece (Line_of_score*)const;
-
- virtual Item *item() { return this; }
- Item();
- Real hpos_f() const;
- DECLARE_MY_RUNTIME_TYPEINFO;
- virtual Line_of_score * line_l() const;
+ Link_array<Spanner> attached_span_l_arr_;
+ Drul_array<Item*> broken_to_drul_;
+
+ /// should be put in a breakable col.
+ bool breakable_b_;
+ int break_status_i_;
+ /// nobreak = 0, pre = -1, post = 1
+ int break_status_i() const;
+ Item * find_prebroken_piece (int) const;
+ Item * find_prebroken_piece (Line_of_score*) const;
+
+ virtual Item *item() { return this; }
+ Item();
+ Real hpos_f() const;
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ virtual Line_of_score * line_l() const;
+ static int left_right_compare (Item const *, Item const*);
protected:
- virtual void do_breakable_col_processing();
- virtual void handle_prebroken_dependencies();
- virtual void do_print()const;
-
- void copy_breakable_items();
+ virtual void do_unlink ();
+ virtual void do_junk_links();
+ virtual void do_breakable_col_processing();
+ virtual void handle_prebroken_dependencies();
+ virtual void do_print() const;
+ virtual bool linked_b() const;
+
+ void copy_breakable_items();
};
void set_c_position (int);
protected:
virtual void do_pre_processing();
- Molecule* brew_molecule_p()const;
+ Molecule* brew_molecule_p() const;
};
#endif // KEYITEM_HH
Octave_key();
void set (int i, int acc);
- int acc (int i)const { return accidental_i_arr_[i]; }
+ int acc (int i) const { return accidental_i_arr_[i]; }
};
/// administration of accidentals
struct Element_group_item;
struct Feature;
struct General_script_def;
+struct Music_output;
+struct Music_output_def;
struct Global_translator;
struct Group_change_req;
struct Group_feature_req;
struct Offset;
struct Output;
struct Performer;
-struct PCol;
+struct Paper_column;
struct Paper_score;
struct Paper_def;
struct Partial_measure_req;
public:
Paper_def * paper_l_;
- Paper_def *paper_l()const;
+ Paper_def *paper_l() const;
Line_spacer();
/** solve the spacing problem
/** add a col to the problem. columns have to be added left to
right. The column contains info on it's minimum width. */
- virtual void add_column (PCol *, bool fixed=false, Real fixpos=0.0)=0;
+ virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0)=0;
/**
can the posed problem be solved?
/// mark column #i# as being loose.
void loosen_column (int i);
/// the index of #c# in #cols#
- int col_id (PCol const *c) const;
+ int col_id (Paper_column const *c) const;
/// generate an (nonoptimal) solution
Vector find_initial_solution() const;
bool check_feasible() const;
/// does #this# contain the column #w#?
- bool contains (PCol const *w);
+ bool contains (Paper_column const *w);
/// make the energy function
void make_matrices (Matrix &quad, Vector &lin,Real&) const;
not in this problem, the spacing is ignored.
*/
void add_ideal (Idealspacing const *i);
- void print_ideal (Idealspacing const *)const;
+ void print_ideal (Idealspacing const *) const;
Vector try_initial_solution() const;
void calcideal();
static Line_spacer *constructor() {
return new Line_spacer;
}
- Array<PCol*> error_pcol_l_arr() const;
+ Array<Paper_column*> error_pcol_l_arr() const;
virtual Array<Real> solve() const;
- virtual void add_column (PCol *, bool fixed=false, Real fixpos=0.0);
+ virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0);
virtual Vector default_solution() contains {
protected:
virtual void do_pre_processing();
virtual void do_substitute_dependency (Score_elem*,Score_elem*);
- virtual Molecule* brew_molecule_p()const;
+ virtual Molecule* brew_molecule_p() const;
};
#endif // LOCALKEYITEM_HH
String texsetting;
/* *************** */
void add (String, Symtable*);
- void print()const;
+ void print() const;
- Symbol linestaff (int n, Real w)const;
- Symbol fill (Box b)const;
- Symbol beam_element (int,int,Real=0)const;
+ Symbol linestaff (int n, Real w) const;
+ Symbol fill (Box b) const;
+ Symbol beam_element (int,int,Real=0) const;
/// round slope to closest TeXslope
- Symbol beam (Real&,Real)const;
+ Symbol beam (Real&,Real) const;
/**
pos == 3 : 3 lines above staff (extending below note)
pos == -3: below staff
*/
- Symbol streepjes (int pos)const;
+ Symbol streepjes (int pos) const;
Symbol vbrace (Real &dy) const;
- Symbol meter (Array<Scalar>)const;
- Symbol stem (Real y1_pos, Real y2_pos)const;
- Symbol rule_symbol (Real height, Real width)const;
- Symbol accidental (int)const;
- Symbol ball (int)const;
- Symbol flag (int)const;
- Symbol rest (int, bool outside)const;
- Symbol clef (String)const;
- Symbol bar (String, Real height)const;
+ Symbol meter (Array<Scalar>) const;
+ Symbol stem (Real y1_pos, Real y2_pos) const;
+ Symbol rule_symbol (Real height, Real width) const;
+ Symbol accidental (int) const;
+ Symbol ball (int) const;
+ Symbol flag (int) const;
+ Symbol rest (int, bool outside) const;
+ Symbol clef (String) const;
+ Symbol bar (String, Real height) const;
- Symbol dots (int)const;
- Symbol slur (int dy, Real &dx, int dir)const;
- Symbol half_slur (int dy, Real &dx, int dir, int xpart)const;
- Symbol half_slur_middlepart (Real &dx, int dir)const;
- Symbol big_slur (int dy, Real &dx, int dir)const;
- Symbol text (String style, String text, int align = 1)const;
- Symbol script (String idx)const;
- Symbol hairpin (Real & width, bool decresc)const;
- Symbol dynamic (String)const;
+ Symbol dots (int) const;
+ Symbol slur (int dy, Real &dx, int dir) const;
+ Symbol half_slur (int dy, Real &dx, int dir, int xpart) const;
+ Symbol half_slur_middlepart (Real &dx, int dir) const;
+ Symbol big_slur (int dy, Real &dx, int dir) const;
+ Symbol text (String style, String text, int align = 1) const;
+ Symbol script (String idx) const;
+ Symbol hairpin (Real & width, bool decresc) const;
+ Symbol dynamic (String) const;
Lookup();
Lookup (Lookup const &);
~Lookup();
generate meters.
*/
class Meter_engraver : public Engraver {
+protected:
+ virtual void do_process_requests();
+ virtual void do_pre_move_processing();
public:
- Time_description time_;
- Rhythmic_grouping default_grouping_;
-
- Meter_change_req * meter_req_l_;
- Meter * meter_p_;
-
- virtual void fill_staff_info (Staff_info&);
- virtual bool do_try_request (Request *req_l);
- virtual void do_process_requests();
- virtual void do_pre_move_processing();
- virtual void do_creation_processing();
- virtual void do_post_move_processing();
- Meter_engraver();
- DECLARE_MY_RUNTIME_TYPEINFO;
+ Meter * meter_p_;
+
+ Meter_engraver();
+ DECLARE_MY_RUNTIME_TYPEINFO;
};
#endif // METERGRAV_HH
#include "real.hh"
#include "string.hh"
#include "moment.hh"
-
+#include "music-output-def.hh"
/**
definitions for midi output. Rather empty
*/
-struct Midi_def {
- // ugh!
- static int den_i_s;
- static int num_i_s;
-
- /// output file name
- String outfile_str_;
-
- Input_translator* itrans_p_;
-
- /// duration of whole note
- Real whole_seconds_f_;
-
- Midi_def();
- Midi_def (Midi_def const& midi_c_r);
- ~Midi_def();
-
- Real duration_to_seconds_f (Moment);
- Global_translator* get_global_translator_p() const;
- int get_tempo_i (Moment moment);
- void print() const;
- void set (Input_translator* itrans_p);
- void set_tempo (Moment moment, int count_per_minute_i);
+class Midi_def : public Music_output_def {
+public:
+ // ugh!
+ static int den_i_s;
+ static int num_i_s;
+ VIRTUAL_COPY_CONS(Midi_def, Music_output_def);
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Input_translator* itrans_p_;
+
+ /// duration of whole note
+ Real whole_seconds_f_;
+
+ Midi_def();
+ Midi_def (Midi_def const& midi_c_r);
+ ~Midi_def();
+
+ Real duration_to_seconds_f (Moment);
+ int get_tempo_i (Moment moment);
+ void print() const;
+ void set (Input_translator* itrans_p);
+ void set_tempo (Moment moment, int count_per_minute_i);
+protected:
+ virtual Global_translator * get_global_translator_p ();
};
#endif // MIDI_DEF_HH
/*
- music-iterator.hh -- declare {Music,Chord,Voice}_iterator
+ music-iterator.hh -- declare Music_iterator
source file of the GNU LilyPond music typesetter
#include "plist.hh"
#include "varray.hh"
#include "moment.hh"
+#include "virtual-methods.hh"
class Music_iterator {
- Array<Translator *>report_to_l_arr_;
- void push_translator (Translator*);
- void pop_translator();
+ Array<Translator *>report_to_l_arr_;
+ void push_translator (Translator*);
+ void pop_translator();
protected:
- bool first_b_;
- virtual void do_print()const;
+ bool first_b_;
+ virtual void do_print() const;
- virtual Translator * get_req_translator_l();
- Music_iterator* get_iterator_p (Music*)const;
- void set_translator (Translator*);
- Music_iterator *daddy_iter_l_;
+ virtual Translator * get_req_translator_l();
+ Music_iterator* get_iterator_p (Music*) const;
+ void set_translator (Translator*);
+ Music_iterator *daddy_iter_l_;
public:
- Translator *report_to_l()const;
- DECLARE_MY_RUNTIME_TYPEINFO;
+ Translator *report_to_l() const;
+ DECLARE_MY_RUNTIME_TYPEINFO;
- static Music_iterator* static_get_iterator_p (Music*,Translator*);
- Music_iterator();
+ static Music_iterator* static_get_iterator_p (Music*,Translator*);
+ Music_iterator();
- virtual void process_and_next (Moment until);
- virtual Moment next_moment()const;
- virtual bool ok()const;
- virtual ~Music_iterator();
- virtual void construct_children();
- void print()const;
-};
-
-
-class Chord_iterator : public Music_iterator
-{
- const Chord *chord_C_;
- Pointer_list<Music_iterator*> children_p_list_;
-public:
- ~Chord_iterator();
- Chord_iterator (Chord const*);
- DECLARE_MY_RUNTIME_TYPEINFO;
-protected:
- virtual void do_print()const;
- virtual void construct_children();
- virtual void process_and_next (Moment);
- virtual Moment next_moment()const;
- virtual bool ok()const;
-};
-
-class Request_chord_iterator : public Music_iterator {
- const Request_chord * elt_l_;
- Moment elt_duration_;
- bool last_b_;
-public:
- Request_chord_iterator (Request_chord*);
- DECLARE_MY_RUNTIME_TYPEINFO;
-
-protected:
- virtual void process_and_next (Moment);
- virtual Moment next_moment()const;
- virtual void construct_children();
- virtual bool ok()const;
- virtual void do_print()const;
-};
-
-
-class Voice_iterator : private PCursor<Music*>, public Music_iterator
-{
- Moment here_mom_;
- const Voice * voice_C_;
- Music_iterator * iter_p_;
- void start_next_element();
- void leave_element();
- void set_voice_translator();
-
-public:
- Voice_iterator (Voice const*);
- DECLARE_MY_RUNTIME_TYPEINFO;
-protected:
- virtual void do_print()const;
- virtual void construct_children();
- ~Voice_iterator();
- virtual void process_and_next (Moment);
- virtual Moment next_moment()const;
- virtual bool ok()const;
+ virtual void process_and_next (Moment until);
+ virtual Moment next_moment() const;
+ virtual bool ok() const;
+ virtual ~Music_iterator();
+ virtual void construct_children();
+ void print() const;
};
#endif // MUSIC_ITERATOR_HH
DECLARE_MY_RUNTIME_TYPEINFO;
VIRTUAL_COPY_CONS(Chord,Music);
virtual void translate (Moment dt);
- virtual MInterval time_int()const;
+ virtual MInterval time_int() const;
};
/**
DECLARE_MY_RUNTIME_TYPEINFO;
VIRTUAL_COPY_CONS(Voice, Music);
virtual void translate (Moment dt);
- virtual MInterval time_int()const;
+ virtual MInterval time_int() const;
};
/** A simple piece of music, which wishes to change the spot of its
--- /dev/null
+/*
+ music-output-def.hh -- declare Music_output_def
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef Music_output_DEF_HH
+#define Music_output_DEF_HH
+#include "string.hh"
+#include "lily-proto.hh"
+#include "virtual-methods.hh"
+
+/**
+ Definition of how to output mudela.
+ */
+class Music_output_def
+{
+public:
+ VIRTUAL_COPY_CONS(Music_output_def, Music_output_def);
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ virtual void print () const {}
+ virtual ~Music_output_def () {}
+ virtual Global_translator * get_global_translator_p () { return 0; }
+ String outfile_str_;
+};
+#endif // Music_output_DEF_HH
--- /dev/null
+/*
+ music-output.hh -- declare Music_output
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef Music_output_HH
+#define Music_output_HH
+
+#include "string.hh"
+#include "lily-proto.hh"
+
+/**
+ Output something that was defined in a mudela file.
+ */
+class Music_output
+{
+public:
+ Header * header_l_;
+ String default_out_str_;
+ String origin_str_;
+ int errorlevel_i_;
+
+ virtual void process() {}
+ virtual ~Music_output (){}
+ Music_output()
+ {
+ errorlevel_i_ = 0;
+ }
+
+};
+#endif // Music_output_HH
/// what name (or look for this name)
String id_str_;
- virtual MInterval time_int()const;
+ virtual MInterval time_int() const;
virtual ~Music(){}
void print() const;
virtual void transpose (Melodic_req const *);
class Musical_req : public virtual Request {
public:
- virtual Lyric_req* lreq_l() { return 0; }
- virtual Note_req *note() { return 0;}
- virtual Stem_req *stem() { return 0;}
- virtual Melodic_req *melodic() { return 0; }
- virtual Slur_req *slur() { return 0 ; }
- virtual Beam_req *beam() { return 0 ; }
- virtual Rhythmic_req*rhythmic() { return 0; }
- virtual Musical_script_req*musicalscript() { return 0; }
- virtual Text_req*text() { return 0; }
- virtual Rest_req *rest() { return 0; }
- virtual Skip_req* skip() { return 0; }
- virtual Dynamic_req* dynamic() { return 0; }
- virtual Absolute_dynamic_req * absdynamic() { return 0; }
- virtual Tie_req * tie() { return 0; }
- virtual Span_dynamic_req * span_dynamic() { return 0; }
- REQUESTMETHODS(Musical_req, musical);
+ virtual Lyric_req* lreq_l() { return 0; }
+ virtual Note_req *note() { return 0;}
+ virtual Stem_req *stem() { return 0;}
+ virtual Melodic_req *melodic() { return 0; }
+ virtual Slur_req *slur() { return 0 ; }
+ virtual Beam_req *beam() { return 0 ; }
+ virtual Rhythmic_req*rhythmic() { return 0; }
+ virtual Musical_script_req*musicalscript() { return 0; }
+ virtual Text_req*text() { return 0; }
+ virtual Rest_req *rest() { return 0; }
+ virtual Skip_req* skip() { return 0; }
+ virtual Dynamic_req* dynamic() { return 0; }
+ virtual Absolute_dynamic_req * absdynamic() { return 0; }
+ virtual Tie_req * tie() { return 0; }
+ virtual Span_dynamic_req * span_dynamic() { return 0; }
+ REQUESTMETHODS(Musical_req, musical);
};
*/
class Rhythmic_req : public virtual Musical_req {
public:
- Duration duration_;
+ Duration duration_;
- /* *************** */
- void set_duration (Duration);
- bool do_equal_b (Request*)const;
- virtual Moment duration() const;
- Rhythmic_req();
- static int compare (Rhythmic_req const&,Rhythmic_req const&);
- REQUESTMETHODS(Rhythmic_req, rhythmic);
+ /* *************** */
+ void set_duration (Duration);
+ bool do_equal_b (Request*) const;
+ virtual Moment duration() const;
+ Rhythmic_req();
+ static int compare (Rhythmic_req const&,Rhythmic_req const&);
+ REQUESTMETHODS(Rhythmic_req, rhythmic);
};
class Skip_req : public Rhythmic_req {
public:
- REQUESTMETHODS(Skip_req, skip);
+ REQUESTMETHODS(Skip_req, skip);
};
struct Spacing_req :virtual Request {
- Moment next;
- Real distance;
- Real strength;
- /* *************** */
- Spacing_req();
- REQUESTMETHODS(Spacing_req, spacing);
+ Moment next;
+ Real distance;
+ Real strength;
+ /* *************** */
+ Spacing_req();
+ REQUESTMETHODS(Spacing_req, spacing);
};
class Blank_req : public Spacing_req, Rhythmic_req {
public:
- REQUESTMETHODS(Spacing_req, spacing);
+ REQUESTMETHODS(Spacing_req, spacing);
};
/// Put a text above or below (?) this staff.
class Text_req : public virtual Musical_req {
public:
- /// preferred position (above/below)
- int dir_i_;
- /// the characteristics of the text
- Text_def *tdef_p_;
+ /// preferred position (above/below)
+ Direction dir_;
+ /// the characteristics of the text
+ Text_def *tdef_p_;
- /* *************** */
- Text_req (int d, Text_def*);
- ~Text_req();
- Text_req (Text_req const&);
+ /* *************** */
+ Text_req (int d, Text_def*);
+ ~Text_req();
+ Text_req (Text_req const&);
- REQUESTMETHODS(Text_req,text);
+ REQUESTMETHODS(Text_req,text);
};
/** Put a text in lyric_staff
*/
class Lyric_req : public Rhythmic_req, public Text_req {
public:
- Lyric_req (Text_def* t_p);
- REQUESTMETHODS(Lyric_req, lreq_l);
+ Lyric_req (Text_def* t_p);
+ REQUESTMETHODS(Lyric_req, lreq_l);
};
/// request which has some kind of pitch
struct Melodic_req :virtual Musical_req
{
- /// 0 is c, 6 is b
- int notename_i_;
- /// 0 is central c
- int octave_i_;
+ /// 0 is c, 6 is b
+ int notename_i_;
+ /// 0 is central c
+ int octave_i_;
/// 0 natural, 1 sharp, etc
- int accidental_i_;
+ int accidental_i_;
- /// return height from central c (in halflines)
- int height()const;
+ /// return height from central c (in halflines)
+ int height() const;
- /// transpose. #delta# is relative to central c.
- void transpose (Melodic_req const &delta);
- /// return pitch from central c (in halfnotes)
- int pitch()const;
- Melodic_req();
- bool do_equal_b (Request*)const;
- static int compare (Melodic_req const&,Melodic_req const&);
- REQUESTMETHODS(Melodic_req,melodic);
+ /// transpose. #delta# is relative to central c.
+ void transpose (Melodic_req const &delta);
+ /// return pitch from central c (in halfnotes)
+ int pitch() const;
+ Melodic_req();
+ bool do_equal_b (Request*) const;
+ static int compare (Melodic_req const&,Melodic_req const&);
+ REQUESTMETHODS(Melodic_req,melodic);
};
/// Put a note of specified type, height, and with accidental on the staff.
class Note_req : public Rhythmic_req, virtual public Melodic_req {
public:
- /// force/supress printing of accidental.
- bool forceacc_b_;
- Note_req();
- bool do_equal_b (Request*)const;
- Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic (); }
- REQUESTMETHODS(Note_req, note);
- };
+ /// force/supress printing of accidental.
+ bool forceacc_b_;
+ Note_req();
+ bool do_equal_b (Request*) const;
+ Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic (); }
+ REQUESTMETHODS(Note_req, note);
+};
/**
Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
*/
class Rest_req : public Rhythmic_req {
public:
- REQUESTMETHODS(Rest_req,rest);
+ REQUESTMETHODS(Rest_req,rest);
};
-/**
- attach a stem to the noteball.
- Rhythmic_req parent needed to determine if it will fit inside a beam.
- */
-class Stem_req : public Rhythmic_req {
-public:
- /// preferred direction for the stem
- int dir_i_;
- Stem_req();
- REQUESTMETHODS(Stem_req,stem);
-};
+
/**
Requests to start or stop something.
*/
class Span_req : public virtual Musical_req {
public:
- /// should the spanner start or stop, or is it unwanted?
- enum {
- NOSPAN, START, STOP
- } spantype ;
- bool do_equal_b (Request*)const;
- REQUESTMETHODS(Span_req,span);
+ /// should the spanner start or stop, or is it unwanted?
+ enum {
+ NOSPAN, START, STOP
+ } spantype ;
+ bool do_equal_b (Request*) const;
+ REQUESTMETHODS(Span_req,span);
- Span_req();
+ Span_req();
};
will try to put an appropriate number over the beam */
class Beam_req : public Span_req {
public:
- int nplet;
+ int nplet;
- /* *************** */
- REQUESTMETHODS(Beam_req,beam);
+ /* *************** */
+ REQUESTMETHODS(Beam_req,beam);
- Beam_req();
+ Beam_req();
};
/**
*/
class Tie_req : public Musical_req {
public:
- REQUESTMETHODS(Tie_req, tie);
+ REQUESTMETHODS(Tie_req, tie);
};
/// a slur
class Slur_req : public Span_req {
public:
- REQUESTMETHODS(Slur_req,slur);
+ REQUESTMETHODS(Slur_req,slur);
};
class Musical_script_req : public Musical_req, public Script_req {
public:
- REQUESTMETHODS(Musical_script_req, musicalscript);
+ REQUESTMETHODS(Musical_script_req, musicalscript);
};
class Dynamic_req : public virtual Musical_req {
public:
- /// for absolute dynamics
- enum Loudness {
- FFF, FF, F, MF, MP, P, PP, PPP
- };
- static String loudness_str (Loudness);
- REQUESTMETHODS(Dynamic_req, dynamic);
+ /// for absolute dynamics
+ enum Loudness {
+ FFF, FF, F, MF, MP, P, PP, PPP
+ };
+ static String loudness_str (Loudness);
+ REQUESTMETHODS(Dynamic_req, dynamic);
};
class Absolute_dynamic_req : public Dynamic_req {
public:
- Loudness loudness_;
- Absolute_dynamic_req();
- REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
+ Loudness loudness_;
+ Absolute_dynamic_req();
+ REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
};
class Span_dynamic_req : public Dynamic_req, public Span_req {
public:
- /// Grow or shrink the volume: 1=cresc, -1 = decresc
- int dynamic_dir_i_;
- Span_dynamic_req();
- REQUESTMETHODS(Span_dynamic_req, span_dynamic);
+ /// Grow or shrink the volume: 1=cresc, -1 = decresc
+ Direction dynamic_dir_;
+ Span_dynamic_req();
+ REQUESTMETHODS(Span_dynamic_req, span_dynamic);
};
#endif // MUSICALREQUESTS_HH
#include "input.hh"
class My_lily_parser {
- char const* here_ch_C()const;
+ char const* here_ch_C() const;
Array<Input> define_spot_array_;
String init_str_;
Moment plet_mom();
void add_notename (String, Melodic_req* req_p);
- Input here_input()const;
+ Input here_input() const;
void remember_spot();
Input pop_spot();
Note_column *ncol_p_;
Rest_column *restcol_p_;
bool h_shift_b_;
- int dir_i_;
+ Direction dir_;
- bool acceptable_elem_b (Score_elem const*)const;
+ bool acceptable_elem_b (Score_elem const*) const;
protected:
virtual void set_feature (Feature);
virtual void acknowledge_element (Score_elem_info);
(chord) and scripts) as a single entity. */
class Note_column : public Head_column {
protected:
- virtual void do_pre_processing();
+ virtual void do_pre_processing();
public:
- bool h_shift_b_;
+ bool h_shift_b_;
- Interval_t<int> head_positions_interval()const;
+ Interval_t<int> head_positions_interval() const;
- DECLARE_MY_RUNTIME_TYPEINFO;
- Note_column();
- virtual void set (Stem *);
- void sort();
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Note_column();
+ void sort();
};
#endif // NOTE_COLUMN_HH
int dots_i_;
int balltype_i_;
int dot_delta_y_i_;
- int x_dir_i_;
+ Direction x_dir_;
/* *************** */
void set_dots();
static int compare (Note_head * const &a, Note_head *const &b) ;
protected:
- virtual void do_print()const;
+ virtual void do_print() const;
virtual void do_pre_processing();
- virtual Molecule* brew_molecule_p()const;
+ virtual Molecule* brew_molecule_p() const;
};
#endif // NOTEHEAD_HH
/// 2d vector
struct Offset {
- Real coordinate_a_[NO_AXES];
+ Real coordinate_a_[NO_AXES];
- Real &y() { return coordinate_a_[Y_AXIS]; }
- Real &x() { return coordinate_a_[X_AXIS]; }
- Real y()const { return coordinate_a_[Y_AXIS]; }
- Real x()const { return coordinate_a_[X_AXIS]; }
+ Real &y() { return coordinate_a_[Y_AXIS]; }
+ Real &x() { return coordinate_a_[X_AXIS]; }
+ Real y() const { return coordinate_a_[Y_AXIS]; }
+ Real x() const { return coordinate_a_[X_AXIS]; }
- Real &operator[](Axis i) {
- return coordinate_a_[i];
- }
- Real operator[](Axis i) const{
- return coordinate_a_[i];
- }
+ Real &operator[](Axis i) {
+ return coordinate_a_[i];
+ }
+ Real operator[](Axis i) const{
+ return coordinate_a_[i];
+ }
- Offset operator+=(Offset o) {
- x()+=o.x ();
- y()+=o.y ();
- return *this;
- }
- Offset (Real ix , Real iy) {
- x()=ix;
- y()=iy;
- }
- Offset() {
- x()=0.0;
- y()=0.0;
- }
+ Offset operator+=(Offset o) {
+ x()+=o.x ();
+ y()+=o.y ();
+ return *this;
+ }
+ Offset (Real ix , Real iy) {
+ x()=ix;
+ y()=iy;
+ }
+ Offset() {
+ x()=0.0;
+ y()=0.0;
+ }
};
inline Offset
-operator+(Offset o1, Offset const& o2)
+operator+ (Offset o1, Offset const& o2)
{
- o1 += o2;
- return o1;
+ o1 += o2;
+ return o1;
}
#endif // OFFSET_HH
-#ifndef COLS_HH
-#define COLS_HH
+/*
+ p-col.hh -- declare Paper_column
+ source file of the GNU LilyPond music typesetter
-#include "boxes.hh"
-#include "plist.hh"
-#include "item.hh"
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef P_COL_HH
+#define P_COL_HH
+#include "horizontal-group-item.hh"
+#include "plist.hh"
/**
stuff grouped vertically.
\end{itemize}
*/
-class PCol {
+class Paper_column : public Horizontal_group_item {
public:
- Link_list<Item *> its;
- Link_list<Spanner *> starters;
-
- /** prebreak is put before end of line.
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ SCORE_ELEM_CLONE(Paper_column);
+
+ /** prebreak is put before end of line.
if broken here, then (*this) column is discarded, and prebreak
is put at end of line, owned by Col
*/
- PCol *prebreak_p_;
+ Paper_column *prebreak_l() const;
- /// postbreak at beginning of the new line
- PCol *postbreak_p_;
-
- /** if this column is pre or postbreak, then this field points to
- the parent. */
- PCol *daddy_l_;
+ /// postbreak at beginning of the new line
+ Paper_column *postbreak_l() const;
- /// if lines are broken then this column is in #line#
- Line_of_score *line_l_;
+ /// if lines are broken then this column is in #line#
+ Line_of_score *line_l_;
- /** if lines are broken then this column x-coord #hpos# if not
- known, then hpos == -1.(ugh?) */
-
- Real hpos_f_; // should use ptr?
-
- bool error_mark_b_;
- bool used_b_ ; // manual override..
+ virtual Line_of_score *line_l () const;
+ bool error_mark_b_;
+ bool used_b_ ; // manual override..
- Paper_score * pscore_l_;
+ /* *************** */
- /* *************** */
- /// which one (left =0)
- int rank_i() const;
+ /// which one (left =0)
+ int rank_i() const;
- /// does this column have items
- bool used_b() const;
- bool breakpoint_b() const;
- void clean_breakable_items();
+ /// does this column have items
+ bool used_b() const;
+ bool breakpoint_b() const;
- void add (Item *i);
+ void add (Item *i);
- /// Can this be broken? true eg. for bars.
- bool breakable_b()const;
-
- Interval width() const;
- virtual ~PCol();
- PCol();
+ Paper_column();
- /**
- which col comes first?.
- signed compare on columns.
+ /**
+ which col comes first?.
+ signed compare on columns.
- @return < 0 if c1 < c2.
+ @return < 0 if c1 < c2.
*/
- static int compare (const PCol &c1, const PCol &c2);
- void set_rank (int);
+ static int compare (const Paper_column &c1, const Paper_column &c2);
+ void set_rank (int);
- void OK() const;
- void set_breakable();
- virtual void do_set_breakable();
- void print()const;
+ void OK() const;
+ virtual void do_print() const;
private:
- /**
- The ranking: left is smaller than right
- -1 is uninitialised.
- */
- int rank_i_;
- PCol (PCol const&){}
+ /**
+ The ranking: left is smaller than right
+ -1 is uninitialised.
+ */
+ int rank_i_;
+
};
#include "compare.hh"
-INSTANTIATE_COMPARE(PCol &, PCol::compare);
+INSTANTIATE_COMPARE(Paper_column &, Paper_column::compare);
+#endif // P_COL_HH
-#endif
#include "parray.hh"
#include "lily-proto.hh"
#include "plist.hh"
+#include "music-output.hh"
/** all stuff which goes onto paper. notes, signs, symbols in a score
#Paper_score# contains the items, the columns.
*/
-class Paper_score {
+class Paper_score : public Music_output {
public:
- Paper_def *paper_l_;
+ Paper_def *paper_l_;
- /// the columns, ordered left to right
- Pointer_list<PCol *> col_p_list_;
+ /// the columns, ordered left to right
+ Link_list<Paper_column *> col_p_list_;
- /// the idealspacings, no particular order
- Pointer_list<Idealspacing*> suz_p_list_;
+ /// crescs etc; no particular order
+ Pointer_list<Spanner *> span_p_list_;
- /// crescs etc; no particular order
- Pointer_list<Spanner *> span_p_list_;
-
- /// other elements
- Pointer_list<Score_elem*> elem_p_list_;
-
- Super_elem *super_elem_l_;
-
- /* *************** */
- /* CONSTRUCTION */
+ /// other elements
+ Pointer_list<Score_elem*> elem_p_list_;
- Paper_score (Paper_def*);
- /// add a line to the broken stuff. Positions given in #config#
- void set_breaking (Array<Col_hpositions> const &);
-
- /** add an item.
- add the item in specified containers. If breakstatus is set
- properly, add it to the {pre,post}break of the pcol.
- */
- void typeset_item (Item *item_p, PCol *pcol_l);
-
- /// add to bottom of pcols
- void add (PCol*);
-
- /**
- @return argument as a cursor of the list
- */
- PCursor<PCol *> find_col (PCol const *)const;
-
- Link_array<PCol> col_range (PCol *left_l, PCol *right_l) const;
- Link_array<PCol> breakable_col_range (PCol*,PCol*) const;
- Link_array<PCol> broken_col_range (PCol*,PCol*) const;
+ Super_elem *super_elem_l_;
- /* MAIN ROUTINES */
- void process();
+ Paper_score ();
+ /// add a line to the broken stuff. Positions given in #config#
+ void set_breaking (Array<Col_hpositions> const &);
- /// last deed of this struct
- void output (Tex_stream &ts);
- /* UTILITY ROUTINES */
+ /// add to bottom of pcols
+ void add_column (Paper_column*);
+ /**
+ @return argument as a cursor of the list
+ */
+ PCursor<Paper_column *> find_col (Paper_column const *) const;
+
+ Link_array<Paper_column> col_range (Paper_column *left_l, Paper_column *right_l) const;
+ Link_array<Paper_column> breakable_col_range (Paper_column*,Paper_column*) const;
+ Link_array<Item> broken_col_range (Item const*,Item const*) const;
+
- /* STANDARD ROUTINES */
- void OK()const;
- void print() const;
- ~Paper_score();
- void typeset_element (Score_elem*);
- void typeset_broken_spanner (Spanner*);
- /// add a Spanner
- void typeset_unbroken_spanner (Spanner*);
+ /* STANDARD ROUTINES */
+ void OK() const;
+ void print() const;
+
+ void typeset_element (Score_elem*);
+ void typeset_broken_spanner (Spanner*);
+ /// add a Spanner
+ void typeset_unbroken_spanner (Spanner*);
+protected:
+ /* MAIN ROUTINES */
+ virtual void process();
+ virtual ~Paper_score();
+
private:
- /// before calc_breaking
- void preprocess();
+ /// before calc_breaking
+ void preprocess();
- void calc_idealspacing();
- /// calculate where the lines are to be broken, and use results
- void calc_breaking();
+ void calc_idealspacing();
+ /// calculate where the lines are to be broken, and use results
+ void calc_breaking();
- /// after calc_breaking
- void postprocess();
+ /// after calc_breaking
+ void postprocess();
- /// delete unused columns
- void clean_cols();
+ /// delete unused columns
+ void clean_cols();
};
#endif
#include "lily-proto.hh"
#include "real.hh"
-#include "string.hh"
-#include "moment.hh"
+#include "moment.hh"
+#include "music-output-def.hh"
/**
TODO:
add support for multiple fontsizes
- split into "Input_paper_def" and Paper_def
add support for other len->wid conversions.
Input_engraver should be in here.
*/
-class Paper_def {
- Lookup *lookup_p_;
- Assoc<String, Real> *real_vars_p_;
-
- Input_translator * itrans_p_;
+class Paper_def : public Music_output_def {
+ Lookup *lookup_p_;
+ Assoc<String, Real> *real_vars_p_;
+
+ Input_translator * itrans_p_;
+protected:
+ virtual Global_translator * get_global_translator_p();
+ VIRTUAL_COPY_CONS(Paper_def,Music_output_def);
+ DECLARE_MY_RUNTIME_TYPEINFO;
public:
- String outfile_str_;
-
-
- /* *************** */
- void set_var (String, Real);
- Real get_var (String)const;
- void reinit();
- Paper_def();
- void set (Lookup*);
- void set (Input_translator *);
- Global_translator * get_global_translator_p()const;
- ~Paper_def();
- Paper_def (Paper_def const&);
- /// The distance between beams
- Real interbeam_f()const;
- /**
- The distance between lines
- */
- Real interline_f()const;
- /// half the distance between lines
- Real internote_f()const;
-
- /// thickness of the standard line
- Real rule_thickness()const;
- Real whole_width()const;
- Real linewidth_f()const;
- /// height of the staff
- Real standard_height()const;
-
- /// width of a crotchet ball
- Real note_width() const;
- void print() const;
-
- Lookup const * lookup_l(); // TODO naming
-
- /** convert a duration to an idealspacing
- influence using the geometric_ and parameters.
- */
- Real duration_to_dist (Moment, Real)const;
- Real geometric_spacing(Moment)const;
- Real arithmetic_constant(Moment minimal_mom)const;
- Real arithmetic_spacing( Moment mom,Real constant)const;
+ virtual ~Paper_def();
+
+ void set_var (String, Real);
+ Real get_var (String) const;
+ void reinit();
+ Paper_def();
+ void set (Lookup*);
+ void set (Input_translator *);
+
+ Paper_def (Paper_def const&);
+ /// The distance between beams
+ Real interbeam_f() const;
+ /**
+ The distance between lines
+ */
+ Real interline_f() const;
+ /// half the distance between lines
+ Real internote_f() const;
+
+ /// thickness of the standard line
+ Real rule_thickness() const;
+ Real whole_width() const;
+ Real linewidth_f() const;
+ /// height of the staff
+ Real standard_height() const;
+
+ /// width of a crotchet ball
+ Real note_width() const;
+ void print() const;
+
+ Lookup const * lookup_l(); // TODO naming
+
+ /** convert a duration to an idealspacing
+ influence using the geometric_ and parameters.
+ */
+ Real duration_to_dist (Moment, Real) const;
+ Real geometric_spacing(Moment) const;
+ Real arithmetic_constant(Moment minimal_mom) const;
+ Real arithmetic_spacing( Moment mom,Real constant) const;
};
#endif // Paper_def_HH
bool is_bottom_performer_b() const;
virtual Performer_group_performer* find_performer_l (String name, String id);
- virtual void do_print()const;
+ virtual void do_print() const;
private:
Pointer_list<Performer*> perf_p_list_;
Ineq_constrained_qp const *opt;
public:
- String status()const;
+ String status() const;
Vector vec (int k) const { return opt->cons[k]; }
Real rhs (int k) const { return opt->consrhs[k]; }
--- /dev/null
+/*
+ request-iter.hh -- declare Request_chord_iterator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef REQUEST_ITER_HH
+#define REQUEST_ITER_HH
+
+#include "music-iterator.hh"
+
+class Request_chord_iterator : public Music_iterator {
+ const Request_chord * elt_l_;
+ Moment elt_duration_;
+ bool last_b_;
+public:
+ Request_chord_iterator (Request_chord*);
+ DECLARE_MY_RUNTIME_TYPEINFO;
+
+protected:
+ virtual void process_and_next (Moment);
+ virtual Moment next_moment() const;
+ virtual void construct_children();
+ virtual bool ok() const;
+ virtual void do_print() const;
+};
+
+
+#endif // REQUEST_ITER_HH
#include "virtual-methods.hh"
#include "input.hh"
#include "music.hh"
+#include "direction.hh"
/**
a voice element wants something printed.
bool equal_b (Request*) const;
protected:
virtual bool do_equal_b (Request*) const;
- virtual void do_print()const;
+ virtual void do_print() const;
};
#define REQUESTMETHODS(T,accessor) \
this also a request */
class Script_req : public virtual Request {
public:
- int dir_i_;
+ Direction dir_;
General_script_def *scriptdef_p_;
/* *************** */
- bool do_equal_b (Request*)const;
+ bool do_equal_b (Request*) const;
Script_req();
REQUESTMETHODS(Script_req,script);
*/
-class Score_column : public PCol {
+class Score_column : public Paper_column {
friend class Score;
friend class Score_engraver;
bool musical_b_;
Moment when_;
public:
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ SCORE_ELEM_CLONE(Score_column);
/// length of notes/rests in this column
Array<Moment> durations;
void add_duration (Moment);
void preprocess();
bool musical_b() { return musical_b_; }
- void print() const;
- virtual void do_set_breakable();
+ void do_print() const;
};
(elem) */
class Score_elem : private Directed_graph_node {
- /// member: the symbols
- Molecule *output; // should scrap, and use temp var?
-
-
-
- /**
- for administration of what was done already
- */
- enum Status {
- ORPHAN, // not yet added to pstaff
- VIRGIN, // added to pstaff
- PREBREAKING,
- PREBROKEN,
- PRECALCING,
- PRECALCED, // calcs before spacing done
- BREAKING,
- BROKEN,
- POSTCALCING, // busy calculating. This is used to trap cyclic deps.
- POSTCALCED, // after spacing calcs done
- OUTPUT, // molecule has been output
- DELMARKED, // mark for 'unclean' deletion
- DELETED, // to catch malloc mistakes.
- };
+ /// member: the symbols
+ Molecule *output; // should scrap, and use temp var?
+
+
+
+ /**
+ for administration of what was done already
+ */
+ enum Status {
+ ORPHAN, // not yet added to pstaff
+ VIRGIN, // added to pstaff
+ PREBREAKING,
+ PREBROKEN,
+ PRECALCING,
+ PRECALCED, // calcs before spacing done
+ BREAKING,
+ BROKEN,
+ POSTCALCING, // busy calculating. This is used to trap cyclic deps.
+ POSTCALCED, // after spacing calcs done
+ BREWED,
+ TEXOUTPUT, // molecule has been output
+ DELETED, // to catch malloc mistakes.
+ };
- Status status_;
+ Status status_;
- Score_elem* dependency (int) const;
- Score_elem* dependent (int) const;
- int dependent_size() const;
- int dependency_size() const;
+ Score_elem* dependency (int) const;
+ Score_elem* dependent (int) const;
+ int dependent_size() const;
+ int dependency_size() const;
public:
- /**
- This is needed, because #output# may still be
- NULL.
- */
- Offset offset_;
+ /**
+ This is needed, because #output# may still be
+ NULL.
+ */
+ Offset offset_;
- Paper_score *pscore_l_;
- Axis_group_element * axis_group_l_a_[2];
+ Paper_score *pscore_l_;
+ Axis_group_element * axis_group_l_a_[NO_AXES];
- Score_elem (Score_elem const&);
- virtual String TeX_string() const ;
- String TeX_string_without_offset (Offset)const;
+ Score_elem (Score_elem const&);
+ virtual String TeX_output_str () const ;
virtual void print() const;
- Paper_def *paper() const;
+ Paper_def *paper() const;
- virtual ~Score_elem();
- Score_elem();
- DECLARE_MY_RUNTIME_TYPEINFO;
+ virtual ~Score_elem();
+ Score_elem();
+ DECLARE_MY_RUNTIME_TYPEINFO;
- Interval extent (Axis)const;
- Interval width() const;
- Interval height() const;
- Status status() const;
+ Interval extent (Axis) const;
+ Interval width() const;
+ Interval height() const;
+ Status status() const;
- /**
- translate the symbol. The symbol does not have to be created yet.
- */
- void translate (Offset);
- /**
- translate in one direction
- */
+ /**
+ translate the symbol. The symbol does not have to be created yet.
+ */
+ void translate (Offset);
+ /**
+ translate in one direction
+ */
- void translate (Real, Axis);
- Real relative_coordinate (Axis_group_element*, Axis)const;
- Offset absolute_offset()const;
- Real absolute_coordinate (Axis)const;
- Axis_group_element*common_group (Score_elem const* s, Axis a)const;
-
- void add_processing();
- void OK() const;
- void pre_processing();
- void breakable_col_processing();
- void break_processing();
+ void translate (Real, Axis);
+ Real relative_coordinate (Axis_group_element*, Axis) const;
+ Offset absolute_offset() const;
+ Real absolute_coordinate (Axis) const;
+ Axis_group_element*common_group (Score_elem const* s, Axis a) const;
+
+ void add_processing();
+ void OK() const;
+ void pre_processing();
+ void breakable_col_processing();
+ void break_processing();
- void post_processing();
- void molecule_processing();
-
- /**
- Remove all links (dependencies, dependents, Axis_group_elements.
- */
- void unlink();
- void unlink_all();
- void substitute_dependency (Score_elem*,Score_elem*);
- void remove_dependency (Score_elem*);
- /**
- add a dependency. It may be the 0 pointer, in which case, it is ignored.
- */
- void add_dependency (Score_elem*);
- void copy_dependencies (Score_elem const&);
- /**
- junk the dependency array. Don't do derived stuff.
- */
- void junk_dependencies();
-
-
- /*
- virtual accessors
- */
-
- virtual Spanner* spanner() { return 0; }
- virtual Item * item() { return 0; }
- virtual Line_of_score * line_l() const;
- SCORE_ELEM_CLONE(Score_elem);
+ void post_processing();
+ void molecule_processing();
+
+ /**
+ Remove all links (dependencies, dependents, Axis_group_elements.
+ */
+ void unlink();
+ void unlink_all();
+ void substitute_dependency (Score_elem*,Score_elem*);
+ void remove_dependency (Score_elem*);
+ /**
+ add a dependency. It may be the 0 pointer, in which case, it is ignored.
+ */
+ void add_dependency (Score_elem*);
+
+ /*
+ virtual accessors
+ */
+
+ virtual Spanner* spanner() { return 0; }
+ virtual Item * item() { return 0; }
+ virtual Line_of_score * line_l() const;
+ virtual bool linked_b() const;
+ SCORE_ELEM_CLONE(Score_elem);
- /// no dimension, translation is noop
- bool empty_b_;
- /// do not print anything black
- bool transparent_b_;
+ /// no dimension, translation is noop
+ bool empty_b_;
+ /// do not print anything black
+ bool transparent_b_;
protected:
- virtual Interval do_height()const;
- virtual Interval do_width()const;
+ virtual Interval do_height() const;
+ virtual Interval do_width() const;
- /// do printing of derived info.
- virtual void do_print() const {}
- /// generate the molecule
- virtual Molecule* brew_molecule_p()const;
- ///executed directly after the item is added to the Paper_score
- virtual void do_add_processing();
- /// do calculations before determining horizontal spacing
- virtual void do_pre_processing();
-
- virtual void do_breakable_col_processing();
- /// do calculations after determining horizontal spacing
- virtual void do_post_processing();
+ /// do printing of derived info.
+ virtual void do_print() const {}
+ /// generate the molecule
+ virtual Molecule* brew_molecule_p() const;
+ ///executed directly after the item is added to the Paper_score
+ virtual void do_add_processing();
+ /// do calculations before determining horizontal spacing
+ virtual void do_pre_processing();
+
+ virtual void do_breakable_col_processing();
+ /// do calculations after determining horizontal spacing
+ virtual void do_post_processing();
+ virtual String do_TeX_output_str () const;
- virtual void do_substitute_dependency (Score_elem * , Score_elem *);
- virtual void do_substitute_dependent (Score_elem *, Score_elem *);
- virtual void do_break_processing();
- virtual void handle_broken_dependencies();
- virtual void handle_prebroken_dependencies();
- virtual Link_array<Score_elem> get_extra_dependencies()const;
- virtual void do_unlink();
+ virtual void do_substitute_dependency (Score_elem * , Score_elem *);
+ virtual void do_substitute_dependent (Score_elem *, Score_elem *);
+ virtual void do_break_processing();
+ virtual void handle_broken_dependencies();
+ virtual void handle_prebroken_dependencies();
+ virtual Link_array<Score_elem> get_extra_dependencies() const;
+ virtual void do_unlink();
+ virtual void do_junk_links();
+ String make_TeX_string (Offset) const;
};
Top level engraver. Puts elements into appropriate columns.
*/
class Score_engraver :
- public Engraver_group_engraver, public Global_translator
+ public Engraver_group_engraver, public Global_translator
{
- Line_of_score * scoreline_l_;
- bool disallow_break_b_;
- int breaks_i_;
+ Line_of_score * scoreline_l_;
+ bool disallow_break_b_;
+ int breaks_i_;
+ Link_array<Score_elem> elem_p_arr_;
- Array<Item*> nobreak_item_p_arr_;
- Link_array<Score_elem> musical_item_p_arr_;
+ Score_column* command_column_l_;
+ Score_column* musical_column_l_;
- Score_column* command_column_l_;
- Score_column* musical_column_l_;
-
- friend class Score;
- void set_columns (Score_column*,Score_column*);
- void typeset_all();
+ void set_columns (Score_column*,Score_column*);
+ void typeset_all();
public:
- DECLARE_MY_RUNTIME_TYPEINFO;
-
- Score_engraver();
+ Paper_score * pscore_p_;
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Score_engraver();
+ virtual Music_output *get_output_p ();
protected:
- /* Global_translator interface */
- virtual void set_score (Score * score_l);
- virtual void prepare (Moment);
- virtual void finish();
- virtual void process();
- virtual int depth_i() const { return Global_translator::depth_i ();}
- virtual Translator* ancestor_l (int l) { return Global_translator::ancestor_l (l);}
+ virtual void prepare (Moment);
+ virtual void finish();
+ virtual void process();
+ virtual int depth_i() const { return Global_translator::depth_i ();}
+ virtual Translator* ancestor_l (int l) { return Global_translator::ancestor_l (l);}
protected:
- /* Engraver_group_engraver interface */
- virtual Staff_info get_staff_info()const;
- virtual bool do_try_request (Request*);
- virtual void do_creation_processing();
- virtual void do_removal_processing();
- virtual void announce_element (Score_elem_info);
- virtual void do_announces();
- virtual void typeset_element (Score_elem*elem_p);
- virtual Paper_def * paper() const;
- virtual void do_pre_move_processing();
+ /* Engraver_group_engraver interface */
+ virtual Staff_info get_staff_info() const;
+ virtual bool do_try_request (Request*);
+ virtual void do_creation_processing();
+ virtual void do_removal_processing();
+ virtual void announce_element (Score_elem_info);
+ virtual void do_announces();
+ virtual void typeset_element (Score_elem*elem_p);
+ virtual Paper_def * paper() const;
+ virtual void do_pre_move_processing();
};
#endif // SCORE_GRAV_HH
Top level performer. Completely takes care of MIDI output
*/
class Score_performer:
- public Performer_group_performer, public Global_translator
+ public Performer_group_performer, public Global_translator
{
public:
- DECLARE_MY_RUNTIME_TYPEINFO;
- Score_performer();
- ~Score_performer();
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Score_performer();
+ ~Score_performer();
+ Audio_score *performance_p_;
protected:
- virtual Translator* ancestor_l (int l);
- virtual int depth_i() const;
-
- virtual void finish();
- virtual void prepare (Moment mom);
- virtual void process();
- virtual void set_score (Score* score_l);
- virtual void start();
- virtual int get_tempo_i() const;
- virtual void play (Audio_element* p);
-
+ virtual Translator* ancestor_l (int l);
+ virtual int depth_i() const;
+
+ virtual void finish();
+ virtual void prepare (Moment mom);
+ virtual void process();
+ virtual void start();
+ virtual int get_tempo_i() const;
+ virtual void play (Audio_element* p);
+ virtual Music_output *get_output_p ();
private:
- void header (Midi_stream&);
+ void header (Midi_stream&);
- Moment now_mom_;
- Audio_column* audio_column_l_;
+ Moment now_mom_;
+ Audio_column* audio_column_l_;
};
#endif // SCORE_PERFORMER_HH
#include "varray.hh"
#include "lily-proto.hh"
#include "plist.hh"
-#include "moment.hh"
-#include "assoc.hh"
#include "string.hh"
#include "input.hh"
#include "lily-proto.hh"
+#include "parray.hh"
/// the total music def of one movement
class Score: public Input {
public:
- /// paper_, staffs_ and commands_ form the problem definition.
- Paper_def *paper_p_;
- Midi_def *midi_p_;
- Music * music_p_;
- Paper_score *pscore_p_;
- Audio_score* audio_score_p_;
- Header * header_p_;
+ /// paper_, staffs_ and commands_ form the problem definition.
+ Link_array<Music_output_def> def_p_arr_;
+ Music * music_p_;
+ Header * header_p_;
- int errorlevel_i_;
+ int errorlevel_i_;
- /* *************************************************************** */
-
- /// construction
- Score();
- Score (Score const&);
- ~Score();
-
- /// do everything except outputting to file
- void process();
-
- /// output to file
- void output (String fn);
-
- ///
- void set (Midi_def* midi_p);
- ///
- void set (Paper_def* midi_p);
-
- void print() const;
-
+ /// construction
+ Score();
+ Score (Score const&);
+ ~Score();
+
+ void process();
+ void add (Music_output_def *def_p);
+ void print() const;
private:
- void run_translator (Global_translator*);
- void midi_output();
- void paper_output();
-
- /// do midi stuff
- void midi();
-
- /// do paper stuff
- void paper();
-
- // utils:
- PCursor<Score_column*> create_cols (Moment, PCursor<Score_column*> &last);
-
- /**
- make the pcol_l_ fields of each Score_column point to the correct PCol,
- remove any unnecessary Score_column's
- */
- void do_cols();
-
- /// remove unused cols
- void clean_cols();
-
- /// add #Idealspacings# to #pscore_#
- void calc_idealspacing();
+ void run_translator (Music_output_def*);
};
+
#endif
#define SCORELINE_HH
#include "colhpos.hh"
-#include "spanner-elem-group.hh"
+#include "spanner.hh"
/// the columns of a score that form one line.
-class Line_of_score : public Spanner{
+class Line_of_score : public Spanner
+{
public:
- Link_array<PCol> cols;
- bool error_mark_b_;
- virtual String TeX_string() const;
+ Link_array<Paper_column> cols;
+ bool error_mark_b_;
+ virtual String TeX_output_str () const;
- DECLARE_MY_RUNTIME_TYPEINFO;
- Line_of_score();
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Line_of_score();
- void add (Score_elem *);
+ void add (Score_elem *);
- /// is #c# contained in #*this#?
- bool contains_b (PCol const *c)const;
+ /// is #c# contained in #*this#?
+ bool contains_b (Paper_column const *c) const;
- Link_array<Line_of_score> get_lines()const;
- void set_breaking (Array<Col_hpositions> const&);
+ Link_array<Line_of_score> get_lines() const;
+ void set_breaking (Array<Col_hpositions> const&);
protected:
- virtual void break_into_pieces (bool);
- virtual Interval do_width()const;
- virtual void do_print() const;
- SCORE_ELEM_CLONE(Line_of_score);
+ virtual void do_breakable_col_processing ();
+ virtual void break_into_pieces (bool);
+ virtual Interval do_width() const;
+ virtual void do_print() const;
+ SCORE_ELEM_CLONE(Line_of_score);
};
#endif
/** The characteristics of a certain kind of accent. It is not the
accent itself. */
class Script_def : public General_script_def {
- /// invert if below staff?
- bool invertsym_b_;
- String symidx_str_;
+ /// invert if below staff?
+ bool invertsym_b_;
+ String symidx_str_;
- /// on the other side of the stem?
- int rel_stem_dir_i_;
+ /// on the other side of the stem?
+ Direction rel_stem_dir_;
- /// below or above staff?
- int staff_dir_i_;
+ /// below or above staff?
+ Direction staff_dir_;
- /// how close to the note do we want to be?
- int priority_i_;
+ /// how close to the note do we want to be?
+ int priority_i_;
- /// follow the ball inside staff?
- bool inside_staff_b_;
+ /// follow the ball inside staff?
+ bool inside_staff_b_;
public:
- virtual int staff_dir_i()const;
- virtual int rel_stem_dir_i()const;
- virtual int priority_i()const;
- virtual bool inside_b()const;
- virtual Atom get_atom (Paper_def* p, int dir_i_)const;
- DECLARE_MY_RUNTIME_TYPEINFO;
-
- virtual bool do_equal_b (General_script_def const *)const;
- virtual void do_print() const;
- Script_def();
- void set_from_input (String, bool, int, int ,bool,int);
+ virtual Direction staff_dir() const;
+ virtual Direction rel_stem_dir() const;
+ virtual int priority_i() const;
+ virtual bool inside_b() const;
+ virtual Atom get_atom (Paper_def* p, Direction dir_) const;
+ DECLARE_MY_RUNTIME_TYPEINFO;
+
+ virtual bool do_equal_b (General_script_def const *) const;
+ virtual void do_print() const;
+ Script_def();
+ void set_from_input (String, bool, int, int ,bool,int);
protected:
- VIRTUAL_COPY_CONS(Script_def,General_script_def);
+ VIRTUAL_COPY_CONS(Script_def,General_script_def);
};
Stem *stem_l_;
protected:
- Molecule *brew_molecule_p()const;
+ Molecule *brew_molecule_p() const;
virtual void do_substitute_dependency (Score_elem*,Score_elem*);
virtual void do_print() const;
- virtual Interval symbol_height()const;
+ virtual Interval symbol_height() const;
virtual void do_pre_processing();
virtual Interval do_width() const;
SCORE_ELEM_CLONE(Script);
Array<Slur_req*> new_slur_req_l_arr_;
Array<Slur *> slur_l_stack_;
Array<Slur*> end_slur_l_arr_;
- int dir_i_;
+ Direction dir_;
/* *************** */
protected:
virtual ~Slur_engraver();
virtual void acknowledge_element (Score_elem_info);
virtual void do_pre_move_processing();
- virtual Span_bar* get_span_bar_p()const;
+ virtual Span_bar* get_span_bar_p() const;
};
#endif // SPAN_BAR_GRAV_HH
void set (Vertical_align_element *);
protected:
- virtual Interval do_width()const;
+ virtual Interval do_width() const;
virtual void do_pre_processing();
virtual void do_substitute_dependency (Score_elem*,Score_elem*);
- virtual Molecule * brew_molecule_p()const;
+ virtual Molecule * brew_molecule_p() const;
virtual Symbol get_bar_sym (Real dy) const;
};
{
public:
DECLARE_MY_RUNTIME_TYPEINFO;
- virtual Span_bar* get_span_bar_p()const;
+ virtual Span_bar* get_span_bar_p() const;
};
/**
DECLARE_MY_RUNTIME_TYPEINFO;
SCORE_ELEM_CLONE(Piano_brace);
protected:
- virtual Interval do_width()const;
+ virtual Interval do_width() const;
virtual Symbol get_bar_sym (Real) const;
};
+++ /dev/null
-/*
- spanner-elem-group.hh -- declare Spanner_elem_group
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef SPANNER_ELEM_GROUP_HH
-#define SPANNER_ELEM_GROUP_HH
-
-#include "spanner.hh"
-#include "elem-group.hh"
-
-class Spanner_elem_group : public Spanner, public Horizontal_vertical_group_element {
-
-protected:
- virtual Interval do_width()const;
- virtual void do_print() const;
- SCORE_ELEM_CLONE(Spanner_elem_group);
-public:
- DECLARE_MY_RUNTIME_TYPEINFO;
-};
-#endif // SPANNER_ELEM_GROUP_HH
#include "lily-proto.hh"
#include "score-elem.hh"
+#include "drul-array.hh"
/** A symbol which is attached between two columns. A spanner is a
symbol which spans across several columns, so its final appearance
length of stems of notes they encompass.
*/
-class Spanner:public virtual Score_elem {
+class Spanner : public virtual Score_elem {
public:
- PCol *left_col_l_, *right_col_l_;
-
- /* *************** */
- DECLARE_MY_RUNTIME_TYPEINFO;
- virtual Spanner* spanner() { return this; }
- Spanner();
- bool broken_b() const;
- Spanner* find_broken_piece (Line_of_score*)const;
+
+ Drul_array<Item*> spanned_drul_;
+ void set_bounds(Direction d, Item*);
+
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ virtual Spanner* spanner() { return this; }
+ Spanner();
+ bool broken_b() const;
+
+ Spanner* find_broken_piece (Line_of_score*) const;
protected:
- void set_my_columns();
- SCORE_ELEM_CLONE(Spanner);
-
- /**
- this is virtual; for instance, Line_of_score overrides it.
- */
- virtual void break_into_pieces (bool);
-
- Link_array<Spanner> broken_into_l_arr_;
-
- virtual void do_break_processing();
- virtual Interval do_width()const;
- virtual void do_print()const;
- virtual Line_of_score*line_l()const;
+ void set_my_columns();
+ SCORE_ELEM_CLONE(Spanner);
+
+ /**
+ this is virtual; for instance, Line_of_score overrides it.
+ */
+ virtual void break_into_pieces ();
+
+ Link_array<Spanner> broken_into_l_arr_;
+
+ virtual void do_unlink();
+ virtual void do_junk_links();
+ virtual String do_TeX_output_str () const;
+ virtual void do_break_processing();
+ virtual Interval do_width() const;
+ virtual void do_print() const;
+ virtual Line_of_score*line_l() const;
};
#endif
/// mark column #i# as being loose.
void loosen_column (int i);
/// the index of #c# in #cols#
- int col_id (PCol const *c) const;
+ int col_id (Paper_column const *c) const;
/// generate an (nonoptimal) solution
Vector find_initial_solution() const;
bool check_feasible() const;
/// does #this# contain the column #w#?
- bool contains (PCol const *w);
+ bool contains (Paper_column const *w);
/// make the energy function
void make_matrices (Matrix &quad, Vector &lin,Real&) const;
void add_ideal (Idealspacing const *i);
Vector try_initial_solution() const;
void calc_idealspacing();
- void set_fixed_cols (Mixed_qp&)const;
+ void set_fixed_cols (Mixed_qp&) const;
Score_column* scol_l (int);
void connect (int i,int j, Real,Real);
- Line_of_cols error_pcol_l_arr()const;
+ Line_of_cols error_pcol_l_arr() const;
public:
static Line_spacer *constructor();
virtual void solve (Col_hpositions*) const;
virtual void lower_bound_solution (Col_hpositions*) const;
- virtual void add_column (PCol *, bool fixed=false, Real fixpos=0.0);
+ virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0);
virtual Vector default_solution() const;
Score * score_l_;
Moment when();
Score *score_l();
- PCol * command_pcol_l();
+ Paper_column * command_pcol_l();
Score_column* musical_l();
Score_column *command_l();
- PCol * musical_pcol_l();
+ Paper_column * musical_pcol_l();
Staff_info();
};
#include "score-elem.hh"
#include "interval.hh"
+#include "direction.hh"
/** A symbol which sits along a staff.
class Staff_side : virtual Score_elem {
Link_array<Score_elem> support_l_arr_;
int staff_size_i_;
- Interval support_height()const;
+ Interval support_height() const;
Staff_symbol* staff_sym_l_;
- int get_position_i()const;
+ int get_position_i() const;
void read_staff_sym();
public:
/**
Vertical dir of symbol relative to staff. -1 = below staff?
*/
- int dir_i_;
+ Direction dir_;
Interval sym_int_;
/// follow the support inside the staff?
*/
class Staff_symbol : public Spanner
{
- /// this many lines.
- int no_lines_i_;
+ /// this many lines.
+ int no_lines_i_;
public:
-
-
- void set_extent (PCol* p1, PCol* p2);
- DECLARE_MY_RUNTIME_TYPEINFO;
- Staff_symbol (int lines);
- Real inter_note_f()const;
- int steps_i()const;
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Staff_symbol (int lines);
+ Real inter_note_f() const;
+ int steps_i() const;
protected:
- SCORE_ELEM_CLONE(Staff_symbol);
- virtual Molecule* brew_molecule_p() const;
- virtual void do_print()const;
+ SCORE_ELEM_CLONE(Staff_symbol);
+ virtual Molecule* brew_molecule_p() const;
+ virtual void do_print() const;
};
#endif // STAFFSYM_HH
+++ /dev/null
-/*
- stem-beam-grav.hh -- part of GNU LilyPond
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef STEMBEAMGRAV_HH
-#define STEMBEAMGRAV_HH
-#include "engraver.hh"
-
-/**
- TODO:
- override default_grouping if setting a n-plet
-
- */
-class Stem_beam_engraver : public Engraver {
- Stem * stem_p_;
- Beam * beam_p_;
- Beam_req * beam_req_l_;
- Stem_req * stem_req_l_;
- Beam_req * start_req_l_;
- bool end_beam_b_;
- Rhythmic_grouping *current_grouping;
- int default_dir_i_;
-public:
- /* *************** */
- DECLARE_MY_RUNTIME_TYPEINFO;
- Stem_beam_engraver();
-
-protected:
- ~Stem_beam_engraver();
- virtual void set_feature (Feature dir_i_);
- virtual bool do_try_request (Request*);
- virtual void do_process_requests();
- virtual void acknowledge_element (Score_elem_info);
- virtual void do_pre_move_processing();
- virtual void do_post_move_processing();
-};
-#endif // STEMBEAMGRAV_HH
--- /dev/null
+/*
+ stem-grav.hh -- declare Stem_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STEM_GRAV_HH
+#define STEM_GRAV_HH
+
+#include "engraver.hh"
+
+/**
+ Make stems upon receiving noteheads.
+ */
+class Stem_engraver : public Engraver
+{
+ Direction dir_;
+ Stem *stem_p_;
+ Rhythmic_req *rhythmic_req_l_;
+protected:
+ virtual void acknowledge_element (Score_elem_info);
+ virtual void do_pre_move_processing ();
+ virtual void set_feature (Feature dir_i_);
+
+public:
+ Stem_engraver();
+ DECLARE_MY_RUNTIME_TYPEINFO;
+};
+
+#endif // STEM_GRAV_HH
*/
class Stem : public Item {
- Real stem_bottom_f_, stem_top_f_;
+ Real stem_bottom_f_, stem_top_f_;
- /// needed for determining direction/length
- int staff_size_i_;
-
- /**extent of the stem (positions).
- fractional, since Beam has to adapt them.
- */
-
-
- /**
- geen gedonder, jij gaat onder.
- -1 stem points down, +1: stem points up
- */
- Real stem_xoffset_f_;
- /**
- store the wholes (for vapourware tremolo)
- */
- Link_array<Note_head> whole_l_arr_;
- Link_array<Note_head> head_l_arr_;
- Link_array<Note_head> rest_l_arr_;
+ /// needed for determining direction/length
+ int staff_size_i_;
+
+ /**extent of the stem (positions).
+ fractional, since Beam has to adapt them.
+ */
+
+
+ /**
+ geen gedonder, jij gaat onder.
+ -1 stem points down, +1: stem points up
+ */
+ Real stem_xoffset_f_;
+ /**
+ store the wholes (for vapourware tremolo)
+ */
+ Link_array<Note_head> whole_l_arr_;
+ Link_array<Note_head> head_l_arr_;
+ Link_array<Note_head> rest_l_arr_;
public:
- /// flagtype? 4 none, 8 8th flag, 0 = beam.
- int flag_i_;
+ /// flagtype? 4 none, 8 8th flag, 0 = beam.
+ int flag_i_;
- int beams_left_i_;
- int beams_right_i_;
+ int beams_left_i_;
+ int beams_right_i_;
- /// false if in beam
- bool print_flag_b_;
+ /// false if in beam
+ bool print_flag_b_;
- int dir_i_;
+ Direction dir_;
- /* *************** */
- Stem (int staff_size_i);
+ /* *************** */
+ Stem ();
- /// ensure that this Stem also encompasses the Notehead #n#
- void add (Note_head*n);
+ /// ensure that this Stem also encompasses the Notehead #n#
+ void add (Note_head*n);
- DECLARE_MY_RUNTIME_TYPEINFO;
+ DECLARE_MY_RUNTIME_TYPEINFO;
- Real hpos_f()const;
+ Real hpos_f() const;
- void do_print() const;
- void set_stemend (Real);
- int get_default_dir();
- int get_center_distance_from_top();
- int get_center_distance_from_bottom();
- void set_default_dir();
- void set_default_stemlen();
- void set_default_extents();
- void set_noteheads();
-
- Real stem_length_f()const;
- Real stem_end_f()const;
- Real stem_start_f() const;
-
- bool invisible_b()const;
+ void do_print() const;
+ void set_stemend (Real);
+ Direction get_default_dir();
+ int get_center_distance_from_top();
+ int get_center_distance_from_bottom();
+ void set_default_dir();
+ void set_default_stemlen();
+ void set_default_extents();
+ void set_noteheads();
+
+ Real stem_length_f() const;
+ Real stem_end_f() const;
+ Real stem_start_f() const;
+
+ bool invisible_b() const;
- /// heads that the stem encompasses (positions)
- int max_head_i() const;
- int min_head_i() const;
+ /// heads that the stem encompasses (positions)
+ int max_head_i() const;
+ int min_head_i() const;
protected:
- virtual void do_substitute_dependency (Score_elem*,Score_elem*);
- virtual void do_pre_processing();
- virtual Interval do_width() const;
- Molecule* brew_molecule_p() const;
+ virtual void do_substitute_dependency (Score_elem*,Score_elem*);
+ virtual void do_pre_processing();
+ virtual Interval do_width() const;
+ Molecule* brew_molecule_p() const;
};
#endif
Line_of_score * line_of_score_l_;
void add_broken_line (Line_of_score*);
Super_elem();
- virtual String TeX_string()const;
+ virtual String TeX_output_str() const;
protected:
virtual void do_substitute_dependency (Score_elem*,Score_elem*);
virtual void handle_broken_dependencies();
Symbol (String, Box);
Symbol();
- String str()const; // for printing.
+ String str() const; // for printing.
};
struct Symtable : public Assoc<String, Symbol> {
String id_str;
- Symbol lookup (String)const;
- void print()const;
+ Symbol lookup (String) const;
+ void print() const;
};
Symtables();
Symtables (Symtables const&);
void add (String, Symtable*);
- void print()const;
+ void print() const;
};
class Text_def : public General_script_def {
protected:
- virtual Atom get_atom (Paper_def* p, int dir_i_)const;
+ virtual Atom get_atom (Paper_def* p, Direction dir_) const;
DECLARE_MY_RUNTIME_TYPEINFO;
VIRTUAL_COPY_CONS(Text_def,General_script_def);
public:
virtual void do_print() const;
virtual ~Text_def() {};
- virtual bool do_equal_b (const General_script_def*)const;
+ virtual bool do_equal_b (const General_script_def*) const;
Text_def();
virtual void print() const;
Interval width (Paper_def*) const;
class Text_engraver : public Engraver{
Text_item * text_p_;
Text_req * text_req_l_;
- int dir_i_;
+ Direction dir_;
/* *************** */
protected:
virtual void set_feature (Feature);
/* ***************/
- Text_item (General_script_def*,int dir=0);
+ Text_item (General_script_def*,Direction dir=0);
virtual ~Text_item();
DECLARE_MY_RUNTIME_TYPEINFO;
protected:
General_script_def * tdef_p_;
- virtual Interval symbol_height()const;
+ virtual Interval symbol_height() const;
virtual Molecule* brew_molecule_p() const;
virtual void do_pre_processing();
virtual void do_pre_processing();
virtual void do_post_processing();
virtual Interval height() const ;
- virtual Molecule* brew_molecule_p()const;
+ virtual Molecule* brew_molecule_p() const;
virtual void do_print() const;
};
#endif // TEXTSPANNER_HH
Tie * tie_p_;
Moment end_mom_;
Tie_req * req_l_;
- int dir_i_;
+ Direction dir_;
Tie_req *end_req_l_;
Melodic_req * end_melodic_req_l_;
Melodic_req * melodic_req_l_;
public:
bool same_pitch_b_;
- Note_head * left_head_l_;
- Note_head * right_head_l_;
- void set_head (int, Note_head*head_l);
+ Drul_array<Note_head *> head_l_drul_;
+
+ void set_head (Direction, Note_head*head_l);
Tie();
DECLARE_MY_RUNTIME_TYPEINFO;
Time_description();
void add (Moment dt);
bool allow_meter_change_b();
- String str()const;
+ String str() const;
void print() const;
void setpartial (Moment p);
- String try_set_partial_str (Moment)const;
- Moment barleft()const;
- Moment next_bar_moment()const;
+ String try_set_partial_str (Moment) const;
+ Moment barleft() const;
+ Moment next_bar_moment() const;
void set_meter (int,int);
static int compare (const Time_description&, const Time_description&);
};
*/
class Timing_engraver : public Engraver
{
- Time_description time_;
- Rhythmic_grouping default_grouping_;
-
- Link_array<Timing_req> timing_req_l_arr_;
-
- virtual void fill_staff_info (Staff_info&);
- virtual bool do_try_request (Request *req_l);
- virtual void do_process_requests();
- virtual void do_pre_move_processing();
- virtual void do_creation_processing();
- virtual void do_post_move_processing();
- Timing_engraver();
- DECLARE_MY_RUNTIME_TYPEINFO;
-}
+public:
+ Time_description time_;
+ Rhythmic_grouping default_grouping_;
+ Link_array<Timing_req> timing_req_l_arr_;
+protected:
+ virtual void do_creation_processing ();
+ virtual void fill_staff_info (Staff_info&);
+ virtual bool do_try_request (Request *req_l);
+ virtual void do_process_requests();
+ virtual void do_pre_move_processing();
+ virtual void do_post_move_processing();
+public:
+ Meter_change_req * meter_req_l () const;
+ Timing_engraver();
+ DECLARE_MY_RUNTIME_TYPEINFO;
+};
#endif // TIMING_GRAV_HH
#include "lily-proto.hh"
#include "virtual-methods.hh"
+/** Make some kind of #Element#s from Requests. Elements are made by
+ hierarchically grouped #Translator#s
+ */
class Translator {
public:
- String id_str_;
+ String id_str_;
- int iterator_count_;
+ int iterator_count_;
- virtual Global_translator *global_l() { return 0; }
-
- /// Score_register = 0, Staff_registers = 1, etc)
- virtual void print()const;
- virtual int depth_i()const=0;
- virtual bool is_bottom_engraver_b() const { return false; }
- virtual bool try_request (Request*);
- virtual Translator *find_get_translator_l (String name, String id)=0;
- virtual Translator *ancestor_l (int l=1)=0;
- virtual ~Translator(){}
- DECLARE_MY_RUNTIME_TYPEINFO;
- Translator();
- virtual Translator *get_default_interpreter()=0;
+ virtual Global_translator *global_l() { return 0; }
+
+ virtual void print() const;
+
+ /// Score_register = 0, Staff_registers = 1, etc)
+ virtual int depth_i() const=0;
+ virtual bool is_bottom_engraver_b() const { return false; }
+ virtual bool try_request (Request*);
+ virtual Translator *find_get_translator_l (String name, String id)=0;
+ virtual Translator *ancestor_l (int l=1)=0;
+ virtual ~Translator(){}
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Translator();
+ virtual Translator *get_default_interpreter()=0;
};
#endif // TRANSLATOR_HH
Link_array<Score_elem> elem_l_arr_;
public:
void add (Score_elem*);
- bool contains_b (Score_elem const*)const;
+ bool contains_b (Score_elem const*) const;
Vertical_align_element();
DECLARE_MY_RUNTIME_TYPEINFO;
protected:
class Vertical_group_spanner : public Axis_group_spanner, public Vertical_group_element
{
protected:
- SCORE_ELEM_CLONE(Vertical_group_spanner);
- virtual void remove_all() { Vertical_group_element::remove_all (); }
+ SCORE_ELEM_CLONE(Vertical_group_spanner);
+ virtual void remove_all() { Vertical_group_element::remove_all (); }
+ virtual void do_junk_links () { Axis_group_spanner::do_junk_links (); }
+ virtual void do_unlink () { Axis_group_spanner::do_unlink (); }
public:
- DECLARE_MY_RUNTIME_TYPEINFO;
- virtual void add_element (Score_elem*e) { Vertical_group_element::add_element (e); }
- virtual void remove_element (Score_elem*e) { Vertical_group_element::remove_element (e); }
-
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ virtual void add_element (Score_elem*e) { Vertical_group_element::add_element (e); }
+ virtual void remove_element (Score_elem*e) { Vertical_group_element::remove_element (e); }
};
#endif // SPAN_VERTICAL_GROUP_HH
*/
class Voice_group_engravers : public Engraver_group_engraver {
Moment termination_mom_;
- int dir_i_;
+ Direction dir_;
protected:
virtual void do_print() const;
--- /dev/null
+/*
+ voice-iter.hh -- declare Voice_iterator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef VOICE_ITER_HH
+#define VOICE_ITER_HH
+
+
+#include "music-iterator.hh"
+#include "pcursor.hh"
+
+class Voice_iterator : private PCursor<Music*>, public Music_iterator
+{
+ Moment here_mom_;
+ const Voice * voice_C_;
+ Music_iterator * iter_p_;
+ void start_next_element();
+ void leave_element();
+ void set_voice_translator();
+
+public:
+ Voice_iterator (Voice const*);
+ DECLARE_MY_RUNTIME_TYPEINFO;
+protected:
+ virtual void do_print() const;
+ virtual void construct_children();
+ ~Voice_iterator();
+ virtual void process_and_next (Moment);
+ virtual Moment next_moment() const;
+ virtual bool ok() const;
+};
+
+#endif // VOICE_ITER_HH
/// wordwrap type algorithm: move to next line if current is optimal.
struct Word_wrap : Break_algorithm {
- virtual Array<Col_hpositions> do_solve()const;
+ virtual Array<Col_hpositions> do_solve() const;
Word_wrap();
};
Vector
-Ineq_constrained_qp::solve (Vector start)const
+Ineq_constrained_qp::solve (Vector start) const
{
/* no hassle if no constraints*/
- if ( ! cons.size())
+ if (! cons.size())
{
Choleski_decomposition chol (quad);
return - chol.solve (lin);
Input_translator::print() const
{
#ifndef NPRINT
- if ( ! check_debug)
+ if (! check_debug)
return ;
DOUT << base_str_ <<" " << type_str_<<" {\n";
DOUT << "Consists of ";
Input_translator *
Input_translator::recursive_find (String nm)
{
- if ( is_name_b (nm))
+ if (is_name_b (nm))
return this;
Input_translator * r =0;
Input_translator*
Input_translator::get_default_itrans_l()
{
- if ( contains_itrans_p_list_.size())
+ if (contains_itrans_p_list_.size())
return contains_itrans_p_list_.top();
else
return 0;
#include "item.hh"
#include "p-col.hh"
#include "elem-group.hh"
+#include "spanner.hh"
Item::Item()
{
breakable_b_ = false;
break_status_i_ = 0;
- pcol_l_ = 0;
- broken_to_a_[0] = broken_to_a_[1]=0;
+ broken_to_drul_[LEFT] = broken_to_drul_[RIGHT]=0;
}
IMPLEMENT_IS_TYPE_B1(Item, Score_elem);
Item::do_print() const
{
#ifndef NPRINT
- DOUT << "(unknown)";
+ DOUT << "breakable_b_: " << breakable_b_;
+ DOUT << "break_status_i_: " <<break_status_i_;
#endif
}
Real
-Item::hpos_f()const
+Item::hpos_f() const
{
- return pcol_l_->hpos_f_ + absolute_coordinate (X_AXIS);
+ return absolute_coordinate (X_AXIS);
}
Line_of_score *
-Item::line_l()const
+Item::line_l() const
{
- return pcol_l_->line_l_;
+ return (axis_group_l_a_[X_AXIS])? axis_group_l_a_[X_AXIS]->line_l() : 0;
}
int
void
Item::copy_breakable_items()
{
- if ( broken_to_a_[0] || broken_to_a_[1])
- return;
- Item *new_copies[2];
- for (int i=0; i < 2; i++)
+ if (broken_to_drul_[LEFT] || broken_to_drul_[RIGHT])
+ return;
+ Drul_array<Item *> new_copies;
+ Direction i=LEFT;
+ do
{
- Item * item_p = clone()->item ();
- item_p->copy_dependencies (*this);
-
- item_p->break_status_i_ = -1+ 2*i;
- pscore_l_->typeset_item (item_p, pcol_l_);
- item_p->handle_prebroken_dependencies();
- new_copies[i] =item_p;
+ Item * item_p = clone()->item ();
+
+ item_p->break_status_i_ = i;
+ pscore_l_->typeset_element (item_p);
+ item_p->handle_prebroken_dependencies();
+ new_copies[i] =item_p;
}
- broken_to_a_= new_copies;
+ while ((i *= -1) != LEFT);
+ broken_to_drul_= new_copies;
}
void
Item::do_breakable_col_processing()
{
- if (!breakable_b_ || !pcol_l_->breakable_b())
- return;
+ if (!breakable_b_)
+ return;
copy_breakable_items();
handle_prebroken_dependencies();
/*
Otherwise the broken items won't be pre_process()'ed.
- */
- add_dependency (broken_to_a_[0]);
- add_dependency (broken_to_a_[1]);
+ */
+ add_dependency (broken_to_drul_[LEFT]);
+ add_dependency (broken_to_drul_[RIGHT]);
}
Item::find_prebroken_piece (Line_of_score*l) const
{
if (line_l() == l)
- return (Item*)this;
- else if (broken_to_a_[0] && broken_to_a_[0]->line_l() == l)
- return broken_to_a_[0];
- else if (broken_to_a_[1] && broken_to_a_[1]->line_l() == l)
- return broken_to_a_[1];
+ return (Item*)this;
+ else if (broken_to_drul_[LEFT] && broken_to_drul_[LEFT]->line_l() == l)
+ return broken_to_drul_[LEFT];
+ else if (broken_to_drul_[RIGHT] && broken_to_drul_[RIGHT]->line_l() == l)
+ return broken_to_drul_[RIGHT];
return 0;
}
Item*
-Item::find_prebroken_piece (PCol*c)const
+Item::find_prebroken_piece (int breakstatus) const
{
- if (c == pcol_l_)
- return (Item *) this; // ugh
+ if (!breakstatus)
+ return (Item *) this; // ugh
+ else
+ return (Item*) broken_to_drul_[(Direction)breakstatus];
+}
- if (c == pcol_l_->prebreak_p_)
- return (Item *) broken_to_a_[0];
- else if (c==pcol_l_->postbreak_p_)
- return (Item *)broken_to_a_[1];
+void
+Item::handle_prebroken_dependencies()
+{
+ if (breakable_b_)
+ Score_elem::handle_prebroken_dependencies();
+}
- assert (false);
+int
+Item::left_right_compare(Item const *l, Item const *r)
+{
+ while (!l->is_type_b (Paper_column::static_name ()))
+ l = l->axis_group_l_a_[X_AXIS]->item();
+ while (!r->is_type_b (Paper_column::static_name ()))
+ r = r->axis_group_l_a_[X_AXIS]->item();
+
+ Paper_column *p1 = (Paper_column*)l;
+ Paper_column* p2 = (Paper_column*)r;
+ return p1->rank_i () - p2->rank_i ();
+}
+
+
+bool
+Item::linked_b() const
+{
+ return Score_elem::linked_b() || attached_span_l_arr_.size();
}
void
-Item::handle_prebroken_dependencies()
+Item::do_junk_links()
+{
+ attached_span_l_arr_.set_size(0);
+}
+
+void
+Item::do_unlink()
{
- if ( breakable_b_)
- Score_elem::handle_prebroken_dependencies();
+ for (int i=0; i < attached_span_l_arr_.size (); i++) {
+ Spanner *&s= attached_span_l_arr_[i];
+ if (s->spanned_drul_[LEFT] == this)
+ s->set_bounds (LEFT, 0);
+ if (s->spanned_drul_[RIGHT] == this)
+ s->set_bounds (RIGHT,0);
+ s =0;
+ }
+ attached_span_l_arr_.set_size (0);
}
}
else if (info.elem_l_->name() == Bar::static_name ())
{
- if ( !keyreq_l_)
+ if (!keyreq_l_)
default_key_b_ = true;
create_key();
}
Molecule*
-Key_item::brew_molecule_p()const
+Key_item::brew_molecule_p() const
{
Molecule*output = new Molecule;
Real inter = paper()->internote_f ();
Molecule m (a);
output->add_right (m);
}
- if ( pitch.size())
+ if (pitch.size())
{
Molecule m (paper()->lookup_l ()->fill (Box (
Interval (0, paper()->note_width ()),
Key_performer::do_print() const
{
#ifndef NPRINT
- if ( key_req_l_)
+ if (key_req_l_)
key_req_l_->print();
#endif
}
void
Key_performer::process_requests()
{
- if ( key_req_l_)
- play (new Audio_key (key_req_l_) );
+ if (key_req_l_)
+ play (new Audio_key (key_req_l_));
key_req_l_ = 0;
}
bool
Key_performer::do_try_request (Request* req_l)
{
- if ( key_req_l_)
+ if (key_req_l_)
return false;
- if ( req_l->command())
+ if (req_l->command())
key_req_l_ = req_l->command()->keychange ();
- if ( key_req_l_)
+ if (key_req_l_)
return true;
return false;
lookup with binsearch, return tokencode.
*/
int
-Keyword_table::lookup (char const *s)const
+Keyword_table::lookup (char const *s) const
{
int lo,
hi,
%%
+<*>\r {
+ // windows-suck-suck-suck
+}
+
<notes,incl,INITIAL,lyrics>{
"%{" {
yy_push_state(longcomment);
#include "bar.hh"
#include "debug.hh"
#include "line-group-grav.hh"
+#include "p-col.hh"
Line_group_engraver::Line_group_engraver()
{
void
Line_group_engraver::acknowledge_element (Score_elem_info elem)
{
- if ( !elem.elem_l_->axis_group_l_a_[Y_AXIS])
+ if (!elem.elem_l_->axis_group_l_a_[Y_AXIS])
staffline_p_->add_element (elem.elem_l_);
}
void
Line_group_engraver::do_removal_processing()
{
- staffline_p_->right_col_l_ = get_staff_info().command_pcol_l ();
+ staffline_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
typeset_element (staffline_p_);
staffline_p_ = 0;
}
Line_group_engraver::do_creation_processing()
{
staffline_p_ = new Vertical_group_spanner ;
- staffline_p_->left_col_l_ = get_staff_info().command_pcol_l ();
+ staffline_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
// don't broadcast to self.
announce_element (Score_elem_info (staffline_p_,0));
paper_l_ =0;
}
Paper_def*
-Line_spacer::paper_l()const
+Line_spacer::paper_l() const
{
return paper_l_ ;
}
Local_key_item *key_item_p = 0;
if (mel_l_arr_.size())
{
- for (int i=0; i < mel_l_arr_.size(); i++)
- {
- Item * support_l = support_l_arr_[i];
- Note_req * note_l = mel_l_arr_[i];
+ for (int i=0; i < mel_l_arr_.size(); i++)
+ {
+ Item * support_l = support_l_arr_[i];
+ Note_req * note_l = mel_l_arr_[i];
- if (tied_l_arr_.find_l (support_l) &&
- !note_l->forceacc_b_)
- continue;
+ if (tied_l_arr_.find_l (support_l) &&
+ !note_l->forceacc_b_)
+ continue;
- if (!note_l->forceacc_b_ &&
- local_key_.oct (note_l->octave_i_).acc (note_l->notename_i_)
- == note_l->accidental_i_)
- continue;
- if (!key_item_p)
- {
- int c0_i=0;
+ if (!note_l->forceacc_b_ &&
+ local_key_.oct (note_l->octave_i_).acc (note_l->notename_i_)
+ == note_l->accidental_i_)
+ continue;
+ if (!key_item_p)
+ {
+ int c0_i=0;
- Staff_info inf = get_staff_info();
- if (inf.c0_position_i_l_)
- c0_i = *get_staff_info().c0_position_i_l_;
+ Staff_info inf = get_staff_info();
+ if (inf.c0_position_i_l_)
+ c0_i = *get_staff_info().c0_position_i_l_;
- key_item_p = new Local_key_item (c0_i);
- }
- key_item_p->add (note_l);
- key_item_p->add_support (support_l);
- local_key_.oct (note_l->octave_i_)
- .set (note_l->notename_i_, note_l->accidental_i_);
- }
+ key_item_p = new Local_key_item (c0_i);
+ }
+ key_item_p->add (note_l);
+ key_item_p->add_support (support_l);
+ local_key_.oct (note_l->octave_i_)
+ .set (note_l->notename_i_, note_l->accidental_i_);
+ }
}
if (key_item_p)
{
- for (int i=0; i < support_l_arr_.size(); i++)
- key_item_p->add_support (support_l_arr_[i]);
+ for (int i=0; i < support_l_arr_.size(); i++)
+ key_item_p->add_support (support_l_arr_[i]);
- announce_element (Score_elem_info (key_item_p, 0)); // ugh ugh ugh
- typeset_element (key_item_p);
+ announce_element (Score_elem_info (key_item_p, 0)); // ugh ugh ugh
+ typeset_element (key_item_p);
}
mel_l_arr_.clear();
Score_elem * elem_l = info.elem_l_;
if (info.req_l_->musical() && info.req_l_->musical ()->note ())
{
- Note_req * note_l = info.req_l_->musical()->note ();
- Item * item_l = info.elem_l_->item();
+ Note_req * note_l = info.req_l_->musical()->note ();
+ Item * item_l = info.elem_l_->item();
- mel_l_arr_.push (note_l);
- support_l_arr_.push (item_l);
+ mel_l_arr_.push (note_l);
+ support_l_arr_.push (item_l);
}
else if (info.req_l_->command()
- && info.req_l_->command()->keychange ())
- {
- Key_engraver * key_grav_l =
- (Key_engraver*)info.origin_grav_l_arr_[0];
- key_C_ = &key_grav_l->key_;
- local_key_ = *key_C_;
+ && info.req_l_->command()->keychange ())
+ {
+ Key_engraver * key_grav_l =
+ (Key_engraver*)info.origin_grav_l_arr_[0];
+ key_C_ = &key_grav_l->key_;
+ local_key_ = *key_C_;
}
else if (elem_l->name() == Key_item::static_name ())
{
- Key_engraver * key_grav_l =
- (Key_engraver*)info.origin_grav_l_arr_[0];
- key_C_ = &key_grav_l->key_;
+ Key_engraver * key_grav_l =
+ (Key_engraver*)info.origin_grav_l_arr_[0];
+ key_C_ = &key_grav_l->key_;
}
else if (elem_l->name() == Tie::static_name ())
{
- Tie * tie_l = (Tie*)elem_l->spanner();
- if (tie_l->same_pitch_b_)
- tied_l_arr_.push (tie_l-> right_head_l_);
+ Tie * tie_l = (Tie*)elem_l->spanner();
+ if (tie_l->same_pitch_b_)
+ tied_l_arr_.push (tie_l-> head_l_drul_[RIGHT]);
}
}
Time_description const * time_C_ = get_staff_info().time_C_;
if (time_C_ && !time_C_->whole_in_measure_)
{
- if (key_C_)
- local_key_= *key_C_;
+ if (key_C_)
+ local_key_= *key_C_;
}
}
}
Molecule*
-Local_key_item::brew_molecule_p()const
+Local_key_item::brew_molecule_p() const
{
Molecule* output = new Molecule;
Molecule*octmol = 0;
}
void
-Lookup::print()const
+Lookup::print() const
{
- #ifndef NPRINT
+#ifndef NPRINT
DOUT << "Lookup: " << texsetting << " {\n";
symtables_->print();
DOUT << "}\n";
- #endif
+#endif
}
Symbol
Lookup::ball (int j) const
{
if (j > 2)
- j = 2;
+ j = 2;
Symtable * st = (*symtables_)("balls");
return st->lookup (String (j));
{
if (j>3)
{
- j = 3;
- warning ("max 3 dots"); // todo
+ j = 3;
+ warning ("max 3 dots"); // todo
}
return (*symtables_)("dots")->lookup (j);
}
if (i < 0)
{
- idx = "botlines";
- arg = -i;
+ idx = "botlines";
+ arg = -i;
}
else
{
- arg = i;
- idx = "toplines";
+ arg = i;
+ idx = "toplines";
}
Symbol ret = (*symtables_)("streepjes")->lookup (idx);
{
if (y1 > y2)
{
- Real t = y1;
- y1 = y2;
- y2 = t;
+ Real t = y1;
+ y1 = y2;
+ y2 = t;
}
Symbol s;
{
if (y < 2* 20 PT)
{
- warning ( "piano brace too small (" + print_dimen (y)+ ")");
- y = 2*20 PT;
+ warning ("piano brace too small (" + print_dimen (y)+ ")");
+ y = 2*20 PT;
}
if (y > 67 * 2 PT)
{
- warning ( "piano brace too big (" + print_dimen (y)+ ")");
- y = 67 *2 PT;
+ warning ("piano brace too big (" + print_dimen (y)+ ")");
+ y = 67 *2 PT;
}
int idx = int (rint ((y/2.0 - 20) + 148));
Symbol s = (*symtables_)("param")->lookup ("brace");
{
- Array<String> a;
- a.push (idx);
- s.tex = substitute_args (s.tex,a);
- s.dim.y() = Interval (0,y);
- }
+ Array<String> a;
+ a.push (idx);
+ s.tex = substitute_args (s.tex,a);
+ s.dim.y() = Interval (0,y);
+ }
{
- Array<String> a;
- a.push (print_dimen (y/2));
- a.push (print_dimen (0));
- a.push (s.tex);
- s.tex = substitute_args ("\\placebox{%}{%}{%}", a);
- }
+ Array<String> a;
+ a.push (print_dimen (y/2));
+ a.push (print_dimen (0));
+ a.push (s.tex);
+ s.tex = substitute_args ("\\placebox{%}{%}{%}", a);
+ }
return s;
void
Lyric_engraver::do_process_requests()
{
- if ( lreq_l_)
+ if (lreq_l_)
{
lyric_item_p_ = new Text_item (lreq_l_->tdef_p_);
lyric_item_p_->translate (paper()->note_width ()/2 , X_AXIS);
- lyric_item_p_->dir_i_ = -1;
+ lyric_item_p_->dir_ = DOWN;
lyric_item_p_->fat_b_ = true;
announce_element (Score_elem_info (lyric_item_p_, lreq_l_));
}
void
Lyric_engraver::do_pre_move_processing()
{
- if ( lyric_item_p_)
+ if (lyric_item_p_)
{
typeset_element (lyric_item_p_);
lyric_item_p_ =0;
Lyric_performer::do_print() const
{
#ifndef NPRINT
- if ( lreq_arr_.size())
+ if (lreq_arr_.size())
lreq_arr_[ 0 ]->print();
#endif
}
void
Lyric_performer::process_requests()
{
- if ( lreq_arr_.size() && lreq_arr_[ 0 ]->tdef_p_->text_str_.length_i() )
- play (new Audio_text (Audio_text::LYRIC, lreq_arr_[ 0 ]->tdef_p_->text_str_) );
+ if (lreq_arr_.size() && lreq_arr_[ 0 ]->tdef_p_->text_str_.length_i())
+ play (new Audio_text (Audio_text::LYRIC, lreq_arr_[ 0 ]->tdef_p_->text_str_));
lreq_arr_.clear();
}
Lyric_performer::do_try_request (Request* req_l)
{
Musical_req* m_l = req_l->musical();
- if ( !m_l || ! m_l->lreq_l())
+ if (!m_l || ! m_l->lreq_l())
return false;
lreq_arr_.push (m_l->lreq_l());
void
do_one_file (String init_str, String file_str)
{
- if ( init_str != "" && "" == path.find (init_str) )
+ if (init_str != "" && "" == path.find (init_str))
{
- error ( "Can not find `" + init_str +"\'");
+ error ("Can not find `" + init_str +"\'");
return ;
}
- if ( file_str!= "" && path.find (file_str) == "" )
+ if (file_str!= "" && path.find (file_str) == "")
{
- error ( "Can not find `" + file_str + "'");
+ error ("Can not find `" + file_str + "'");
return ;
}
path.add (env_l);
}
path.add ("");
- path.add (String (DIR_DATADIR) + "/init/" );
+ path.add (String (DIR_DATADIR) + "/init/");
path.push (DIR_DATADIR);
while (Long_option_init const * opt = oparser())
{
- switch ( opt->shortname)
+ switch (opt->shortname)
{
case 'o':
set_default_output (oparser.optional_argument_ch_C_);
int p=0;
const char *arg ;
- while ( (arg= oparser.get_next_arg()))
+ while ((arg= oparser.get_next_arg()))
{
String f (arg);
destill_inname (f);
void
destill_inname (String &name_str_r)
{
- if ( name_str_r.length_i())
+ if (name_str_r.length_i())
{
if (name_str_r[ 0 ] != '-')
{
#include "meter-grav.hh"
#include "meter.hh"
#include "command-request.hh"
-#include "score-grav.hh"
-
+#include "timing-grav.hh"
+#include "engraver-group.hh"
Meter_engraver::Meter_engraver()
{
- meter_req_l_ = 0;
meter_p_ =0;
- default_grouping_ = Rhythmic_grouping (MInterval (0,4),4); // ugh
-}
-
-void
-Meter_engraver::fill_staff_info (Staff_info&inf)
-{
- inf.time_C_ = &time_;
- inf.rhythmic_C_ = &default_grouping_;
-}
-
-bool
-Meter_engraver::do_try_request (Request*r)
-{
- bool gotcha = false;
-
- if (r->command() && r->command ()->timing ())
- {
- gotcha = true;
- Timing_req * tr_l = r->command()->timing ();
- Meter_change_req *m_l = tr_l->meterchange();
- if (m_l)
- {
- meter_req_l_ = m_l;
-
- int b_i= m_l->beats_i_;
- int o_i = m_l->one_beat_i_;
- if (! time_.allow_meter_change_b())
- tr_l->warning ("Meter change not allowed here");
- else
- {
- time_.set_meter (b_i, o_i);
- default_grouping_ =
- Rhythmic_grouping (MInterval (0,Moment (b_i, o_i)), b_i);
- }
- }
- else if (tr_l->partial())
- {
- Moment m = tr_l->partial()->duration_;
- String error = time_.try_set_partial_str (m);
- if (error != "")
- {
- tr_l->warning (error);
- }
- else
- time_.setpartial (m);
- }
- else if (tr_l->barcheck())
- {
- if (time_.whole_in_measure_)
- {
- tr_l ->warning ("Barcheck failed");
-
- time_.whole_in_measure_ = 0; // resync
- time_.error_b_ = true;
- }
-
- }
- else if (tr_l->cadenza())
- {
- time_.set_cadenza (tr_l->cadenza()->on_b_);
-
- }
- else if (tr_l->measuregrouping())
- {
- default_grouping_ = parse_grouping (
- tr_l->measuregrouping()->beat_i_arr_,
- tr_l->measuregrouping()->elt_length_arr_);
-
- }
- }
-
- return gotcha;
-}
-
-void
-Meter_engraver::do_creation_processing()
-{
- time_.when_ = get_staff_info().when ();
}
void
Meter_engraver::do_process_requests()
{
- if (meter_req_l_)
+ Timing_engraver * timing_grav_l= (Timing_engraver*)
+ daddy_grav_l_->get_simple_engraver (Timing_engraver::static_name());
+
+ Meter_change_req *req = timing_grav_l->meter_req_l();
+ if (req)
{
- Array<Scalar> args;
- args.push (meter_req_l_->beats_i_);
- args.push (meter_req_l_->one_beat_i_);
+ Array<Scalar> args;
+ args.push (req->beats_i_);
+ args.push (req->one_beat_i_);
- meter_p_ = new Meter (args);
+ meter_p_ = new Meter (args);
}
if (meter_p_)
- announce_element (Score_elem_info (meter_p_, meter_req_l_));
+ announce_element (Score_elem_info (meter_p_, req));
}
void
{
if (meter_p_)
{
- typeset_element (meter_p_);
- meter_p_ =0;
- meter_req_l_ = 0;
- }
-
- Engraver_group_engraver * grav_l = daddy_grav_l_;
- while (grav_l->daddy_grav_l_)
- {
- grav_l = grav_l->daddy_grav_l_;
+ typeset_element (meter_p_);
+ meter_p_ =0;
}
-
- assert (grav_l->name() == Score_engraver::static_name ());
- if (!time_.cadenza_b_)
- ((Score_engraver*)grav_l)->add_moment_to_process (time_.next_bar_moment());
-}
-
-void
-Meter_engraver::do_post_move_processing()
-{
- time_.add (get_staff_info().when () - time_.when_);
}
Meter_performer::do_print() const
{
#ifndef NPRINT
- if ( meter_req_l_)
- meter_req_l_->print();
+ if (meter_req_l_)
+ meter_req_l_->print();
#endif
}
void
Meter_performer::process_requests()
{
- if ( meter_req_l_)
- play (new Audio_meter (meter_req_l_) );
+ if (meter_req_l_)
+ play (new Audio_meter (meter_req_l_));
meter_req_l_ = 0;
}
bool
Meter_performer::do_try_request (Request* req_l)
{
- if ( meter_req_l_)
- return false;
+ if (meter_req_l_)
+ return false;
- if ( req_l->command())
- meter_req_l_ = req_l->command()->meterchange ();
+ if (req_l->command())
+ meter_req_l_ = req_l->command()->meterchange ();
- if ( meter_req_l_)
- return true;
+ if (meter_req_l_)
+ return true;
return false;
}
}
Molecule*
-Meter::brew_molecule_p()const
+Meter::brew_molecule_p() const
{
Symbol s = paper()->lookup_l ()->meter (args);
return new Molecule (Atom (s));
#include "misc.hh"
#include "midi-def.hh"
#include "input-translator.hh"
-#include "performer-group-performer.hh"
+#include "audio-score.hh"
#include "assoc-iter.hh"
-
+#include "score-performer.hh"
#include "debug.hh"
// classes, alphasorted
outfile_str_ = "";
itrans_p_ = 0;
// ugh
- set_tempo (Moment (1, 4), 60 );
+ set_tempo (Moment (1, 4), 60);
}
Midi_def::Midi_def (Midi_def const& s)
Real
Midi_def::duration_to_seconds_f (Moment mom)
{
- if ( !mom)
+ if (!mom)
return 0;
return Moment (whole_seconds_f_) * mom;
}
Global_translator*
-Midi_def::get_global_translator_p() const
+Midi_def::get_global_translator_p()
{
- return itrans_p_->get_group_performer_p()->global_l ();
+ Global_translator *g = itrans_p_->get_group_performer_p()->global_l ();
+
+ assert (g->is_type_b (Score_performer::static_name()));
+ Score_performer * perf = (Score_performer*)g;
+ perf->performance_p_ = new Audio_score;
+ perf->performance_p_->midi_l_ = this;
+ return g;
}
int
Midi_def::get_tempo_i (Moment moment)
{
- return Moment (whole_seconds_f_) * Moment (60 ) * moment;
+ return Moment (whole_seconds_f_) * Moment (60) * moment;
}
void
{
#ifndef NPRINT
DOUT << "Midi {";
- DOUT << "4/min: " << Real (60) / ( whole_seconds_f_ * 4 );
+ DOUT << "4/min: " << Real (60) / (whole_seconds_f_ * 4);
DOUT << "out: " << outfile_str_;
DOUT << "}\n";
#endif
void
Midi_def::set_tempo (Moment moment, int count_per_minute_i)
{
- whole_seconds_f_ = Moment (count_per_minute_i) / Moment (60 ) / moment;
+ whole_seconds_f_ = Moment (count_per_minute_i) / Moment (60) / moment;
}
+IMPLEMENT_IS_TYPE_B1( Midi_def, Music_output_def);
String
Midi_duration::str() const
{
- return String ("<duration: ") + String (seconds_f_ ) + ">";
+ return String ("<duration: ") + String (seconds_f_) + ">";
}
Midi_header::Midi_header (int format_i, int tracks_i, int clocks_per_4_i)
Midi_instrument::str() const
{
Byte program_byte = 0;
- for ( int i = 0; instrument_name_sz_a_[i]; i++)
- if ( instrument_str_ == String (instrument_name_sz_a_[ i ]))
+ for (int i = 0; instrument_name_sz_a_[i]; i++)
+ if (instrument_str_ == String (instrument_name_sz_a_[ i ]))
{
program_byte = (Byte)i;
break;
}
- String str = String ((char)( 0xc0 + channel_i_) );
+ String str = String ((char)(0xc0 + channel_i_));
str += String ((char)program_byte);
return str;
}
Midi_item::i2varint_str (int i)
{
int buffer_i = i & 0x7f;
- while ( (i >>= 7) > 0)
+ while ((i >>= 7) > 0)
{
buffer_i <<= 8;
buffer_i |= 0x80;
}
String str;
- while ( 1)
+ while (1)
{
str += (char)buffer_i;
- if ( buffer_i & 0x80)
+ if (buffer_i & 0x80)
buffer_i >>= 8;
else
break;
int flats_i = k->flats_i();
// midi cannot handle non-conventional keys
- if ( flats_i && sharps_i)
+ if (flats_i && sharps_i)
return "";
int accidentals_i = sharps_i - flats_i;
String str = "ff5804";
str += String_convert::i2hex_str (num_i, 2, '0');
- str += String_convert::i2hex_str (intlog2( den_i) , 2, '0' );
+ str += String_convert::i2hex_str (intlog2(den_i) , 2, '0');
str += String_convert::i2hex_str (clocks_per_1_i_, 2, '0');
str += String_convert::i2hex_str (8, 2, '0');
return String_convert::hex2bin_str (str);
String
Midi_note::str() const
{
- if ( pitch_i() == INT_MAX)
+ if (pitch_i() == INT_MAX)
return String ("");
- Byte status_byte = (char)( 0x90 + channel_i_);
+ Byte status_byte = (char)(0x90 + channel_i_);
String str = String ((char)status_byte);
- str += (char)( pitch_i() + c0_pitch_i_c_);
+ str += (char)(pitch_i() + c0_pitch_i_c_);
// poor man's staff dynamics:
- str += (char)( dynamic_byte_ - 0x10 * channel_i_);
+ str += (char)(dynamic_byte_ - 0x10 * channel_i_);
return str;
}
String
Midi_note_off::str() const
{
- if ( pitch_i() == INT_MAX)
+ if (pitch_i() == INT_MAX)
return String ("");
- Byte status_byte = (char)( 0x80 + channel_i_);
+ Byte status_byte = (char)(0x80 + channel_i_);
String str = String ((char)status_byte);
- str += (char)( pitch_i() + Midi_note::c0_pitch_i_c_);
+ str += (char)(pitch_i() + Midi_note::c0_pitch_i_c_);
str += (char)aftertouch_byte_;
return str;
}
Midi_tempo::Midi_tempo (Audio_item* audio_item_l)
: Midi_item (audio_item_l)
{
- per_minute_4_i_ = ( (Audio_tempo*)audio_item_l_)->per_minute_4_i_;
+ per_minute_4_i_ = ((Audio_tempo*)audio_item_l_)->per_minute_4_i_;
}
Midi_tempo::Midi_tempo (int per_minute_4_i)
Midi_text::Midi_text (Audio_item* audio_item_l)
: Midi_item (audio_item_l)
{
- text_str_ = ( (Audio_text*)audio_item_l_)->text_str_;
- type_ = (Type)( (Audio_text*)audio_item_l_)->type_;
+ text_str_ = ((Audio_text*)audio_item_l_)->text_str_;
+ type_ = (Type)((Audio_text*)audio_item_l_)->type_;
}
Midi_text::Midi_text (Midi_text::Type type, String text_str)
void
Midi_track::add (int delta_time_i, String event_str)
{
- if ( delta_time_i < 0)
+ if (delta_time_i < 0)
{
- cout << String_convert::bin2hex_str (i2varint_str (delta_time_i) ) << endl;
+ cout << String_convert::bin2hex_str (i2varint_str (delta_time_i)) << endl;
cout << String_convert::bin2hex_str (event_str) << endl;
}
assert (delta_time_i >= 0);
assert(event_str.length_i());
- Midi_chunk::add (i2varint_str (delta_time_i) + event_str );
+ Midi_chunk::add (i2varint_str (delta_time_i) + event_str);
}
void
{
// use convention of 384 clocks per 4
// use Duration_convert
- int delta_time_i = delta_time_moment * Moment (384) / Moment (1, 4 );
- // ? int ( delta_time_moment * 4 * 384)
+ int delta_time_i = delta_time_moment * Moment (384) / Moment (1, 4);
+ // ? int (delta_time_moment * 4 * 384)
add (delta_time_i, mitem_l->str());
}
}
Midi_stream&
-Midi_stream::operator <<( String str)
+Midi_stream::operator <<(String str)
{
- if ( check_debug)
+ if (check_debug)
str = String_convert::bin2hex_str (str);
*os_p_ << str;
- if ( check_debug)
+ if (check_debug)
*os_p_ << "\n";
return *this;
}
Midi_stream&
-Midi_stream::operator <<( Midi_item const& mitem_c_r)
+Midi_stream::operator <<(Midi_item const& mitem_c_r)
{
// *this << mitem_c_r.str();
mitem_c_r.output (this);
- if ( check_debug)
+ if (check_debug)
*os_p_ << "\n";
return *this;
}
Midi_stream&
-Midi_stream::operator <<( int i)
+Midi_stream::operator <<(int i)
{
// output binary string ourselves
*this << Midi_item::i2varint_str (i);
Midi_stream::open()
{
os_p_ = new ofstream (filename_str_);
- if ( !*os_p_)
+ if (!*os_p_)
error ("can't open `" + filename_str_ + "\'");
}
}
Midi_walker::Midi_walker (Audio_staff* audio_staff_l, Midi_track* track_l)
- : PCursor<Audio_item*>( audio_staff_l->audio_item_l_list_)
+ : PCursor<Audio_item*>(audio_staff_l->audio_item_l_list_)
{
track_l_ = track_l;
last_mom_ = 0;
Midi_walker::~Midi_walker()
{
// ugh
- do_stop_notes (last_mom_ + Moment (10, 1) );
+ do_stop_notes (last_mom_ + Moment (10, 1));
}
/**
Midi_walker::do_start_note (Midi_note* note_l)
{
Moment stop_mom = note_l->duration() + ptr ()->audio_column_l_->at_mom ();
- for ( int i=0; i < stop_note_queue.size(); i++)
+ for (int i=0; i < stop_note_queue.size(); i++)
{
- if ( stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ())
+ if (stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ())
{
- if ( stop_note_queue[ i ].key < stop_mom)
+ if (stop_note_queue[ i ].key < stop_mom)
stop_note_queue[ i ].ignore_b_ = true;
else // skip the stopnote
return;
void
Midi_walker::do_stop_notes (Moment max_mom)
{
- while ( stop_note_queue.size() && stop_note_queue.front ().key <= max_mom)
+ while (stop_note_queue.size() && stop_note_queue.front ().key <= max_mom)
{
Midi_note_event e = stop_note_queue.get();
- if ( e.ignore_b_)
+ if (e.ignore_b_)
continue;
Moment stop_mom = e.key;
do_stop_notes (ptr()->audio_column_l_->at_mom ());
Midi_item* p = ptr()->midi_item_p ();
- if ( !p )
+ if (!p)
return;
p->channel_i_ = track_l_->number_i_;
- if ( p->name() != Midi_note::static_name ())
+ if (p->name() != Midi_note::static_name ())
output_event (ptr()->audio_column_l_->at_mom (), p);
else
do_start_note ((Midi_note*)p);
/*
- music-iterator.cc -- implement {Music,Chord,Voice}_iterator
+ music-iterator.cc -- implement Music_iterator
source file of the GNU LilyPond music typesetter
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-
+#include "debug.hh"
#include "music-list.hh"
#include "music-iterator.hh"
+#include "voice-iterator.hh"
+#include "chord-iterator.hh"
+#include "request-iterator.hh"
#include "translator.hh"
-#include "request.hh"
-#include "debug.hh"
IMPLEMENT_IS_TYPE_B(Music_iterator);
-Chord_iterator::~Chord_iterator()
-{
-}
void
-Music_iterator::do_print()const
+Music_iterator::do_print() const
{
}
Music_iterator::print() const
{
#ifndef NPRINT
- if ( !check_debug)
- return ;
+ if (!check_debug)
+ return ;
DOUT << name() << "{";
DOUT << "report to " <<
- report_to_l() << " (" << report_to_l ()->name () << ")\n";
- DOUT << "next at " << next_moment() << " ";
+ report_to_l() << " (" << report_to_l ()->name () << ")\n";
+ if (ok())
+ DOUT << "next at " << next_moment() << " ";
+ else
+ DOUT << "not feeling well today..";
do_print();
DOUT << "}\n";
#endif
{
assert (report_to_l());
if (report_to_l()->is_bottom_engraver_b ())
- return report_to_l();
+ return report_to_l();
set_translator (report_to_l()->get_default_interpreter ());
return report_to_l();
}
Translator*
-Music_iterator::report_to_l()const
+Music_iterator::report_to_l() const
{
if (! report_to_l_arr_.size())
- return 0;
+ return 0;
return report_to_l_arr_.top();
}
Music_iterator::set_translator (Translator*trans)
{
if (report_to_l()==trans)
- return;
- if ( report_to_l())
- pop_translator();
+ return;
+ if (report_to_l())
+ pop_translator();
if (trans)
- push_translator (trans);
+ push_translator (trans);
}
void
}
Moment
-Music_iterator::next_moment()const
+Music_iterator::next_moment() const
{
return 0;
}
}
bool
-Music_iterator::ok()const
+Music_iterator::ok() const
{
return first_b_;
}
Music_iterator*
Music_iterator::static_get_iterator_p (Music *m,
- Translator *report_l)
+ Translator *report_l)
{
Music_iterator * p =0;
if (m->is_type_b (Request_chord::static_name()))
- p = new Request_chord_iterator ((Request_chord*) m);
+ p = new Request_chord_iterator ((Request_chord*) m);
else if (m->is_type_b (Chord::static_name()))
- p = new Chord_iterator ((Chord*) m);
+ p = new Chord_iterator ((Chord*) m);
else if (m->is_type_b (Voice::static_name()))
- p = new Voice_iterator ((Voice*) m);
+ p = new Voice_iterator ((Voice*) m);
if (m -> type_str_ != "")
{
- Translator * a =report_l->
- find_get_translator_l (m-> type_str_, m->id_str_);
- p->set_translator (a);
+ Translator * a =report_l->
+ find_get_translator_l (m-> type_str_, m->id_str_);
+ p->set_translator (a);
}
if (! p->report_to_l())
- p ->set_translator (report_l);
+ p ->set_translator (report_l);
return p;
}
Music_iterator*
-Music_iterator::get_iterator_p (Music*m)const
+Music_iterator::get_iterator_p (Music*m) const
{
Music_iterator*p = static_get_iterator_p (m,report_to_l());
p->daddy_iter_l_ = (Music_iterator*)this;
first_b_ = true;
}
-/* ************** */
-
-Chord_iterator::Chord_iterator (Chord const *chord_C)
-{
- chord_C_ = chord_C;
-}
-
-void
-Chord_iterator::construct_children()
-{
- int j = 0;
- for (PCursor<Music*> i (chord_C_->music_p_list_.top()); //, int j = 0;
- i.ok(); j++, i++)
- {
- Music_iterator * mi = get_iterator_p (i.ptr());
- if ( mi->ok())
- {
- set_translator (mi->report_to_l()->ancestor_l (
- chord_C_->multi_level_i_) );
- children_p_list_.bottom().add (mi);
- }
- else
- delete mi;
- }
-}
-void
-Chord_iterator::do_print() const
-{
-#ifndef NPRINT
- for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++)
- {
- i->print();
- }
-#endif
-}
-
-void
-Chord_iterator::process_and_next (Moment until)
-{
- for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok ();)
- {
- if (i->next_moment() == until)
- {
- i->process_and_next (until);
- }
- if (!i->ok())
- delete i.remove_p();
- else
- i++;
- }
- Music_iterator::process_and_next (until);
-}
-
-
-IMPLEMENT_IS_TYPE_B1(Chord_iterator,Music_iterator);
-
-Moment
-Chord_iterator::next_moment()const
-{
- Moment next_ = infinity_mom;
- for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++)
- next_ = next_ <? i->next_moment() ;
- return next_;
-}
-
-
-
-bool
-Chord_iterator::ok()const
-{
- return children_p_list_.size();
-}
-
-/* ************** */
-
-void
-Voice_iterator::do_print()const
-{
- if (iter_p_)
- iter_p_->print();
-}
-
-Voice_iterator::Voice_iterator (Voice const*v)
- : PCursor<Music*> ( v->music_p_list_)
-{
- here_mom_ = v->offset_mom_;
- voice_C_ = v;
- iter_p_ =0;
-}
-
-void
-Voice_iterator::construct_children()
-{
- while (PCursor<Music*>::ok())
- {
- start_next_element();
- if ( !iter_p_->ok())
- {
- leave_element();
- }
- else
- {
- set_voice_translator();
- break;
- }
- }
-}
-
-void
-Voice_iterator::leave_element()
-{
- delete iter_p_;
- iter_p_ =0;
- MInterval elt_time = ptr()->time_int ();
- if (!elt_time.empty_b())
- here_mom_ += elt_time.length();
- PCursor<Music*>::next();
-}
-
-void
-Voice_iterator::start_next_element()
-{
- assert (!iter_p_);
- iter_p_ = get_iterator_p (ptr());
-}
-
-void
-Voice_iterator::set_voice_translator()
-{
- if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ())
- set_translator (iter_p_->report_to_l());
-}
-
-Voice_iterator::~Voice_iterator()
-{
- assert (! iter_p_);
-}
-
-
-IMPLEMENT_IS_TYPE_B1(Voice_iterator,Music_iterator);
-
-void
-Voice_iterator::process_and_next (Moment until)
-{
- while (1)
- {
- Moment local_until = until - here_mom_;
- while ( iter_p_->ok())
- {
- Moment here = iter_p_->next_moment();
- if (here != local_until)
- goto loopexit;
-
- iter_p_->process_and_next (local_until);
- }
-
- if (!iter_p_->ok())
- {
- leave_element();
- if ( PCursor<Music*>::ok())
- {
- start_next_element();
- set_voice_translator();
- }
- else
- {
- goto loopexit;
- }
- }
- }
-
-loopexit:
-
- Music_iterator::process_and_next (until);
-}
-
-Moment
-Voice_iterator::next_moment()const
-{
- return iter_p_->next_moment() + here_mom_;
-}
-
-bool
-Voice_iterator::ok()const
-{
- return iter_p_;
-}
-
-
-IMPLEMENT_IS_TYPE_B1(Request_chord_iterator,Music_iterator);
-
-void
-Request_chord_iterator::construct_children()
-{
- get_req_translator_l();
-}
-
-Request_chord_iterator::Request_chord_iterator (Request_chord*el_l)
-{
- elt_l_ = el_l;
- elt_duration_ = el_l->time_int().length ();
- last_b_ = false;
-}
-
-
-bool
-Request_chord_iterator::ok()const
-{
- return (elt_duration_ && !last_b_) || first_b_;
-}
-
-
-
-Moment
-Request_chord_iterator::next_moment()const
-{
- Moment m (0);
- if (!first_b_)
- m = elt_duration_;
- return m;
-}
-
-void
-Request_chord_iterator::do_print() const
-{
-#ifndef NPRINT
- DOUT << "duration: " << elt_duration_;
-#endif
-}
-void
-Request_chord_iterator::process_and_next (Moment mom)
-{
- if ( first_b_)
- {
- for (PCursor<Music*> i (elt_l_->music_p_list_); i.ok(); i++)
- {
- assert (i->is_type_b (Request::static_name()));
- Request * req_l = (Request*)i.ptr();
- bool gotcha = report_to_l()->try_request (req_l);
- if (!gotcha)
- req_l->warning ("Junking request: " + String (req_l->name()));
-
- }
- first_b_ = false;
- }
-
- if ( mom >= elt_duration_)
- last_b_ = true;
-}
IMPLEMENT_IS_TYPE_B1(Chord,Music_list);
MInterval
-Chord::time_int()const
+Chord::time_int() const
{
MInterval m;
for (iter (music_p_list_.top(), i); i.ok (); i++)
/*
c4 <> c4
*/
- if ( !interval.empty_b())
+ if (!interval.empty_b())
last += interval.length();
}
return offset_mom_ + MInterval (0,last);
}
void
-Music_list::do_print()const
+Music_list::do_print() const
{
#ifndef NPRINT
for (iter (music_p_list_.top(),i); i.ok (); i++)
--- /dev/null
+/*
+ music-output-def.cc -- implement Music_output_def
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "music-output-def.hh"
+
+IMPLEMENT_IS_TYPE_B(Music_output_def);
+
}
void
-Music::print()const
+Music::print() const
{
#ifndef NPRINT
- if ( ! check_debug)
+ if (! check_debug)
return ;
DOUT << name() << "{";
if (type_str_!="" || id_str_!="")
}
void
-Music::do_print()const
+Music::do_print() const
{
}
#include "music-list.hh"
-IMPLEMENT_IS_TYPE_B1(Stem_req,Rhythmic_req);
-
-void
-Stem_req::do_print() const
-{
-#ifndef NPRINT
- Rhythmic_req::do_print();
- DOUT << "dir : " << dir_i_;
-#endif
-}
-
-Stem_req::Stem_req()
-{
- dir_i_ = 0;
-}
-
-/* ************** */
IMPLEMENT_IS_TYPE_B1(Musical_req,Request);
void
-Musical_req::do_print()const{}
+Musical_req::do_print() const{}
void
-Tie_req::do_print()const{}
+Tie_req::do_print() const{}
/* *************** */
IMPLEMENT_IS_TYPE_B1(Spacing_req,Request);
void
-Spacing_req::do_print()const
+Spacing_req::do_print() const
{
#ifndef NPRINT
DOUT << "next " << next << "dist " << distance << "strength\n";
IMPLEMENT_IS_TYPE_B2(Blank_req,Spacing_req,Rhythmic_req);
void
-Blank_req::do_print()const
+Blank_req::do_print() const
{
Spacing_req::do_print();
}
IMPLEMENT_IS_TYPE_B1(Melodic_req,Musical_req);
bool
-Melodic_req::do_equal_b (Request*r)const
+Melodic_req::do_equal_b (Request*r) const
{
Melodic_req* m= r->musical()->melodic ();
return !compare (*m, *this);
if (o)
return o;
- if ( n)
+ if (n)
return n;
if (a)
return a;
}
bool
-Rhythmic_req::do_equal_b (Request*r)const
+Rhythmic_req::do_equal_b (Request*r) const
{
Rhythmic_req* rh = r->musical()->rhythmic ();
:Text_req (0, def_p)
{
def_p->align_i_ = 0; // centre
- dir_i_ = -1; // lyrics below (invisible) staff
+ dir_ = DOWN; // lyrics below (invisible) staff
}
/* *************** */
bool
-Note_req::do_equal_b (Request*r)const
+Note_req::do_equal_b (Request*r) const
{
return Rhythmic_req::do_equal_b (r) && Melodic_req::do_equal_b (r);
}
IMPLEMENT_IS_TYPE_B1(Beam_req,Span_req);
void
-Beam_req::do_print()const{}
+Beam_req::do_print() const{}
/* *************** */
IMPLEMENT_IS_TYPE_B1(Slur_req,Span_req);
void
-Slur_req::do_print()const{}
+Slur_req::do_print() const{}
/* *************** */
bool
-Span_req:: do_equal_b (Request*r)const
+Span_req:: do_equal_b (Request*r) const
{
Span_req * s = r->span();
return spantype - s->spantype;
/* *************** */
Script_req::Script_req (Script_req const&s)
{
- dir_i_ = s.dir_i_;
+ dir_ = s.dir_;
scriptdef_p_ = s.scriptdef_p_ ? s.scriptdef_p_->clone() : 0;
}
/*
don't check dirs?
- (d1.dir_i_ == d2.dir_i_)
+ (d1.dir_ == d2.dir_)
*/
bool
-Script_req::do_equal_b (Request*r)const
+Script_req::do_equal_b (Request*r) const
{
Script_req * s = r->script();
Script_req::Script_req()
{
- dir_i_ = 0;
+ dir_ = CENTER;
scriptdef_p_ = 0;
}
Script_req::do_print() const
{
#ifndef NPRINT
- DOUT << " dir " << dir_i_ ;
+ DOUT << " dir " << dir_ ;
scriptdef_p_->print();
#endif
}
Text_req::Text_req (Text_req const& src)
{
tdef_p_ = new Text_def (*src.tdef_p_);
- dir_i_ = src.dir_i_;
+ dir_ = src.dir_;
}
Text_req::Text_req (int dir_i, Text_def* tdef_p)
{
- dir_i_ = dir_i;
+ dir_ = Direction(dir_i);
tdef_p_ = tdef_p;
}
Text_req::do_print() const
{
#ifndef NPRINT
- DOUT << " dir " << dir_i_ ;
+ DOUT << " dir " << dir_ ;
tdef_p_->print();
#endif
}
Span_dynamic_req::Span_dynamic_req()
{
- dynamic_dir_i_ = 0;
+ dynamic_dir_ = CENTER;
}
IMPLEMENT_IS_TYPE_B1(Span_dynamic_req,Musical_req);
void
-Span_dynamic_req::do_print()const
+Span_dynamic_req::do_print() const
{
#ifndef NPRINT
Span_req::do_print();
- DOUT << "louder/louder: " <<dynamic_dir_i_;
+ DOUT << "softer/louder: " <<dynamic_dir_;
#endif
}
Identifier *old = lookup_identifier (name_str);
if (old)
{
- old->warning( "redeclaration of \\" + name_str);
+ old->warning("redeclaration of \\" + name_str);
delete old;
}
(*identifier_assoc_p_)[name_str] = i;
delete identifier_assoc_p_;
}
void
-My_lily_lexer::print_declarations (bool init_b)const
+My_lily_lexer::print_declarations (bool init_b) const
{
for (Assoc_iter<String,Identifier*> ai (*identifier_assoc_p_); ai.ok();
ai++)
#ifndef NPRINT
String s = "";
if (init_parse_b_)
- s = "Init";
+ s = "Init";
set_yydebug (!monitor->silence (s+"Parser") && check_debug);
lexer_p_->set_debug (!monitor->silence (s+"Lexer") && check_debug);
#endif
String s = "";
if (init_parse_b_)
- s = "Init";
+ s = "Init";
if (!monitor->silence (s+"Declarations") && check_debug)
{
- lexer_p_->print_declarations (init_parse_b_);
+ lexer_p_->print_declarations (init_parse_b_);
}
#endif
}
print_declarations();
init_parse_b_ = false;
- set_debug();
+ set_debug();
lexer_p_->new_input (s , source_l_);
do_yyparse();
print_declarations();
if (!define_spot_array_.empty())
- warning ("Braces don't match.");
+ warning ("Braces don't match.");
}
My_lily_parser::~My_lily_parser()
}
char const *
-My_lily_parser::here_ch_C()const
+My_lily_parser::here_ch_C() const
{
return lexer_p_->here_ch_C();
}
My_lily_parser::parser_error (String s)
{
here_input().error (s);
- if ( fatal_error_i_)
- exit (fatal_error_i_);
+ if (fatal_error_i_)
+ exit (fatal_error_i_);
error_level_i_ = 1;
}
My_lily_parser::set_last_duration (Duration const *d)
{
if (last_duration_mode_b_)
- default_duration_ = *d;
+ default_duration_ = *d;
}
Chord* velt_p = new Request_chord;
velt_p->set_spot (here_input());
- if (s=="s") { /* Space */
- Skip_req * skip_p = new Skip_req;
- skip_p->duration_ = *duration_p;
+ if (s=="s")
+ { /* Space */
+ Skip_req * skip_p = new Skip_req;
+ skip_p->duration_ = *duration_p;
- skip_p->set_spot (here_input());
- velt_p->add (skip_p);
+ skip_p->set_spot (here_input());
+ velt_p->add (skip_p);
}
else
{
- Rest_req * rest_req_p = new Rest_req;
- rest_req_p->duration_ = *duration_p;
- rest_req_p->set_spot (here_input());
+ Rest_req * rest_req_p = new Rest_req;
+ rest_req_p->duration_ = *duration_p;
+ rest_req_p->set_spot (here_input());
- velt_p->add (rest_req_p);
+ velt_p->add (rest_req_p);
}
- Stem_req * stem_p = new Stem_req;
- stem_p->duration_ = *duration_p;
- stem_p->set_spot ( here_input());
- velt_p->add (stem_p);
delete duration_p;
return velt_p;
v->add (rq);
- if (duration_p->durlog_i_ >= 1)
- {
- Stem_req * stem_req_p = new Stem_req();
- stem_req_p->duration_ = *duration_p;
-
- stem_req_p->set_spot (here_input());
- v->add (stem_req_p);
- }
-
rq->set_duration (*duration_p);
rq->set_spot (here_input());
delete duration_p ;
switch (c)
{
- case '~':
- req_p = new Tie_req;
- break;
- case '[':
- case ']':
- {
+ case '~':
+ req_p = new Tie_req;
+ break;
+ case '[':
+ case ']':
+ {
Beam_req*b = new Beam_req;
int p_i=plet_.type_i_ ; // ugh . Should junk?
if (p_i!= 1)
- b->nplet = p_i;
+ b->nplet = p_i;
req_p = b;
- }
- break;
-
- case '>':
- case '!':
- case '<':
- req_p = new Span_dynamic_req;
- break;
+ }
+ break;
+
+ case '>':
+ case '!':
+ case '<':
+ req_p = new Span_dynamic_req;
+ break;
- case ')':
- case '(':
- req_p = new Slur_req;
- break;
- default:
- assert (false);
- break;
+ case ')':
+ case '(':
+ req_p = new Slur_req;
+ break;
+ default:
+ assert (false);
+ break;
}
switch (c)
{
- case '<':
- case '>':
- case '(':
- case '[':
- req_p->span()->spantype = Span_req::START;
- break;
- case '!':
- case ')':
- case ']':
- req_p->span()->spantype = Span_req::STOP;
- break;
+ case '<':
+ case '>':
+ case '(':
+ case '[':
+ req_p->span()->spantype = Span_req::START;
+ break;
+ case '!':
+ case ')':
+ case ']':
+ req_p->span()->spantype = Span_req::STOP;
+ break;
- default:
- break;
+ default:
+ break;
}
- if (req_p->musical()->span_dynamic ())
- {
- Span_dynamic_req* s_l= (req_p->musical()->span_dynamic ()) ;
- s_l->dynamic_dir_i_ = (c == '<') ? 1:-1;
+ if (req_p->musical()->span_dynamic ())
+ {
+ Span_dynamic_req* s_l= (req_p->musical()->span_dynamic ()) ;
+ s_l->dynamic_dir_ = (c == '<') ? UP:DOWN;
}
req_p->set_spot (here_input());
{
for (int i = 0; i < pre_reqs.size(); i++)
{
- v->add (pre_reqs[i]);
+ v->add (pre_reqs[i]);
}
pre_reqs.clear();
for (int i = 0; i <post_reqs.size(); i++)
{
- v->add (post_reqs[i]);
+ v->add (post_reqs[i]);
}
post_reqs.clear();
}
}
Input
-My_lily_parser::here_input()const
+My_lily_parser::here_input() const
{
Source_file * f_l= lexer_p_->source_file_l();
return Input (f_l, here_ch_C());
#include "rest-column.hh"
bool
-Note_column_engraver::acceptable_elem_b (Score_elem const*elem_C)const
+Note_column_engraver::acceptable_elem_b (Score_elem const*elem_C) const
{
char const*nC = elem_C->name();
return (nC == Script::static_name() || nC == Note_head::static_name ()
- || nC == Stem::static_name());
+ || nC == Stem::static_name());
}
Note_column*
Note_column_engraver::note_col_l()
{
if (!ncol_p_)
{
- ncol_p_ = new Note_column;
- announce_element (Score_elem_info (ncol_p_, 0));
+ ncol_p_ = new Note_column;
+ announce_element (Score_elem_info (ncol_p_, 0));
}
return ncol_p_;
}
{
if (!restcol_p_)
{
- restcol_p_ = new Rest_column;
- announce_element (Score_elem_info (restcol_p_,0));
+ restcol_p_ = new Rest_column;
+ announce_element (Score_elem_info (restcol_p_,0));
}
return restcol_p_;
}
Note_column_engraver::acknowledge_element (Score_elem_info i)
{
if (!acceptable_elem_b (i.elem_l_))
- return;
+ return;
char const*nC = i.elem_l_->name();
if (nC == Script::static_name() && i.req_l_ && i.req_l_->musical ())
{
- script_l_arr_.push ((Script*)i.elem_l_->item());
+ script_l_arr_.push ((Script*)i.elem_l_->item());
}
else if (nC == Note_head::static_name())
{
- Note_head * h_l = (Note_head*)i.elem_l_->item();
- if (h_l->rest_b_)
- rest_col_l()->add (h_l);
- else
- note_col_l()->add (h_l);
+ Note_head * h_l = (Note_head*)i.elem_l_->item();
+ if (h_l->rest_b_)
+ rest_col_l()->add (h_l);
+ else
+ note_col_l()->add (h_l);
}
else if (nC == Stem::static_name())
{
- stem_l_ = (Stem*)i.elem_l_->item();
+ stem_l_ = (Stem*)i.elem_l_->item();
}
- if ( ncol_p_ || restcol_p_)
+ if (ncol_p_ || restcol_p_)
{
- if ( stem_l_)
- {
- if (restcol_p_&& !restcol_p_->stem_l_)
- restcol_p_->set (stem_l_);
- if (ncol_p_ && !ncol_p_->stem_l_)
- ncol_p_->set (stem_l_);
- }
+ if (stem_l_)
+ {
+ if (restcol_p_&& !restcol_p_->stem_l_)
+ restcol_p_->set (stem_l_);
+ if (ncol_p_ && !ncol_p_->stem_l_)
+ ncol_p_->set (stem_l_);
+ }
- for (int i=0; i < script_l_arr_.size(); i++)
- {
- if (restcol_p_)
- restcol_p_->add (script_l_arr_[i]);
- if ( ncol_p_)
- ncol_p_->add (script_l_arr_[i]);
- }
+ for (int i=0; i < script_l_arr_.size(); i++)
+ {
+ if (restcol_p_)
+ restcol_p_->add (script_l_arr_[i]);
+ if (ncol_p_)
+ ncol_p_->add (script_l_arr_[i]);
+ }
- script_l_arr_.clear();
+ script_l_arr_.clear();
}
}
{
if (ncol_p_)
{
- if (! ncol_p_->h_shift_b_)
- ncol_p_->h_shift_b_ = h_shift_b_;
- if (! ncol_p_->dir_i_)
- ncol_p_->dir_i_ = dir_i_;
+ if (! ncol_p_->h_shift_b_)
+ ncol_p_->h_shift_b_ = h_shift_b_;
+ if (! ncol_p_->dir_)
+ ncol_p_->dir_ = dir_;
- typeset_element (ncol_p_);
- ncol_p_ =0;
+ typeset_element (ncol_p_);
+ ncol_p_ =0;
}
if (restcol_p_)
{
- if (! restcol_p_->dir_i_)
- restcol_p_->dir_i_ = dir_i_;
+ if (! restcol_p_->dir_)
+ restcol_p_->dir_ = dir_;
- typeset_element (restcol_p_);
- restcol_p_ =0;
+ typeset_element (restcol_p_);
+ restcol_p_ =0;
}
}
void
Note_column_engraver::set_feature (Feature i)
{
- if (i.type_ == "vdir")
- dir_i_ = i.value_;
- if (i.type_ == "hshift")
- h_shift_b_ = (bool)(int)i.value_;
+ if (i.type_ == "vdir")
+ dir_ = (Direction) int(i.value_);
+ if (i.type_ == "hshift")
+ h_shift_b_ = (bool)(int)i.value_;
}
Note_column_engraver::Note_column_engraver()
{
- dir_i_ =0;
+ dir_ =CENTER;
h_shift_b_ = false;
ncol_p_=0;
IMPLEMENT_IS_TYPE_B1(Note_column,Head_column);
-void
-Note_column::set (Stem*s)
-{
- stem_l_ = s;
- add_support (s);
-}
-
Note_column::Note_column()
{
h_shift_b_ =false;
}
Interval_t<int>
-Note_column::head_positions_interval()const
+Note_column::head_positions_interval() const
{
((Note_column*)this)->sort();
- return Interval_t<int> ( head_l_arr_[0]->position_i_,
+ return Interval_t<int> (head_l_arr_[0]->position_i_,
head_l_arr_.top()->position_i_);
}
void
Note_column::do_pre_processing()
{
- if (!dir_i_&& !stem_l_)
+ if (!dir_&& !stem_l_)
{
- dir_i_ = (head_positions_interval().center () >= 5) ? -1 : 1;
+ dir_ = (head_positions_interval().center () >= 5) ? DOWN:UP;
}
Head_column::do_pre_processing();
}
Note_performer::do_print() const
{
#ifndef NPRINT
- if ( note_req_l_)
+ if (note_req_l_)
{
note_req_l_->print();
}
Note_performer::process_requests()
{
// this is _really_ braindead, but it generates some output
- if ( !note_req_l_ || !note_req_l_->melodic() || !note_req_l_->rhythmic ())
+ if (!note_req_l_ || !note_req_l_->melodic() || !note_req_l_->rhythmic ())
return;
- play (new Audio_note (note_req_l_) );
+ play (new Audio_note (note_req_l_));
note_req_l_ = 0;
}
bool
Note_performer::do_try_request (Request* req_l)
{
- if ( note_req_l_)
+ if (note_req_l_)
return false;
- if ( !req_l->musical() || !req_l->musical ()->note ())
+ if (!req_l->musical() || !req_l->musical ()->note ())
return false;
note_req_l_ = req_l->musical()->melodic ();
get_script_req (int d , General_script_def*def)
{
Musical_script_req* script_req_p = new Musical_script_req;
- script_req_p->dir_i_ =d;
+ script_req_p->dir_ =d;
script_req_p->scriptdef_p_=def;
return script_req_p;
}
Note_head::Note_head (int ss)
{
- x_dir_i_ = 0;
+ x_dir_ = CENTER;
staff_size_i_=ss;
position_i_ = 0;
balltype_i_ = 0;
{
// 8 ball looks the same as 4 ball:
if (balltype_i_ > 2 && !rest_b_)
- balltype_i_ = 2;
+ balltype_i_ = 2;
if (rest_b_)
{
- if (balltype_i_ == 0)
- position_i_ += 6;
- else if (balltype_i_ == 0)
- position_i_ += 4;
+ if (balltype_i_ == 0)
+ position_i_ += 6;
+ else if (balltype_i_ == 0)
+ position_i_ += 4;
}
}
IMPLEMENT_IS_TYPE_B1(Note_head,Item);
void
-Note_head::do_print()const
+Note_head::do_print() const
{
#ifndef NPRINT
if (rest_b_)
- DOUT << "REST! ";
+ DOUT << "REST! ";
DOUT << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_
- << "dots_i_ " << dots_i_;
+ << "dots_i_ " << dots_i_;
#endif
}
Note_head::set_dots()
{
if (!(position_i_ %2) && rest_b_ && balltype_i_ == 0)
- dot_delta_y_i_ = -1;
+ dot_delta_y_i_ = -1;
else if (!(position_i_ %2))
- dot_delta_y_i_ = 1;
+ dot_delta_y_i_ = 1;
}
/*
bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1);
if (!rest_b_)
- s = p->lookup_l()->ball (balltype_i_);
+ s = p->lookup_l()->ball (balltype_i_);
else
{
- s = p->lookup_l()->rest (balltype_i_, streepjes_b);
+ s = p->lookup_l()->rest (balltype_i_, streepjes_b);
}
out = new Molecule (Atom (s));
- out->translate (x_dir_i_ * s.dim.x().length () , X_AXIS);
+ out->translate (x_dir_ * s.dim.x().length () , X_AXIS);
if (dots_i_)
{
- Symbol d = p->lookup_l()->dots (dots_i_);
- Molecule dm;
- dm.add (Atom (d));
- dm.translate (inter_f * dot_delta_y_i_ , Y_AXIS);
- out->add_right (dm);
+ Symbol d = p->lookup_l()->dots (dots_i_);
+ Molecule dm;
+ dm.add (Atom (d));
+ dm.translate (inter_f * dot_delta_y_i_ , Y_AXIS);
+ out->add_right (dm);
}
if (rest_b_)
{
- streepjes_b = false;
+ streepjes_b = false;
}
if (streepjes_b)
{
- int dir = sign (position_i_);
- int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2;
+ int dir = sign (position_i_);
+ int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2;
- Symbol str = p->lookup_l()->streepjes (s);
- Molecule sm;
- sm.add (Atom (str));
- if (position_i_ % 2)
- sm.translate (-inter_f* dir, Y_AXIS);
- out->add (sm);
+ Symbol str = p->lookup_l()->streepjes (s);
+ Molecule sm;
+ sm.add (Atom (str));
+ if (position_i_ % 2)
+ sm.translate (-inter_f* dir, Y_AXIS);
+ out->add (sm);
}
out->translate (inter_f*position_i_, Y_AXIS);
/*
- p-col.cc -- implement PCol
+ p-col.cc -- implement Paper_column
source file of the GNU LilyPond music typesetter
#include "p-col.hh"
#include "p-score.hh"
-
#include "debug.hh"
-Interval
-PCol::width() const
-{
- Interval w;
-
- for (iter_top (its,i); i.ok(); i++)
- w.unite (i->width());
- if (w.empty_b())
- w.unite (Interval (0,0));
- return w;
-}
-
-void
-PCol::clean_breakable_items()
-{
- if (!line_l_)
- {
- its.junk_links();
- }
- if (prebreak_p_)
- prebreak_p_->clean_breakable_items();
- if (postbreak_p_)
- postbreak_p_->clean_breakable_items();
-}
int
-PCol::rank_i() const
+Paper_column::rank_i() const
{
return rank_i_;
}
void
-PCol::set_rank (int i)
+Paper_column::set_rank (int i)
{
rank_i_ = i;
- if (prebreak_p_)
- prebreak_p_->rank_i_ = i;
- if (postbreak_p_)
- postbreak_p_->rank_i_ = i;
+ if (prebreak_l())
+ prebreak_l()->rank_i_ = i;
+ if (postbreak_l())
+ postbreak_l()->rank_i_ = i;
}
void
-PCol::print() const
+Paper_column::do_print() const
{
#ifndef NPRINT
- DOUT << "PCol {";
-
DOUT << "rank: " << rank_i_ << '\n';
-
- DOUT << "# symbols: " << its.size() ;
- if (prebreak_p_){
- DOUT << "\npre: ";
- prebreak_p_->print();
+ if (prebreak_l())
+ {
+ DOUT << "\npre: ";
+ prebreak_l()->print();
}
- if (postbreak_p_) {
+ if (postbreak_l())
+ {
DOUT << "post: ";
- postbreak_p_->print();
+ postbreak_l()->print();
}
- else if (daddy_l_)
+ if (break_status_i_)
{
- DOUT <<'\n' << ((this == daddy_l_->prebreak_p_) ?
- "prebreak" : "postbreak");
- DOUT << '\n';
+ DOUT <<'\n' << ((break_status_i_ == -1)? "prebreak" : "postbreak");
+ DOUT << '\n';
}
DOUT << "extent: " << width().str () << "\n";
- DOUT << "}\n";
#endif
}
int
-PCol::compare (PCol const &c1, PCol const &c2)
+Paper_column::compare (Paper_column const &c1, Paper_column const &c2)
{
return c1.rank_i() - c2.rank_i ();
}
-void
-PCol::OK() const
+Paper_column*
+Paper_column::prebreak_l() const
{
-#ifndef NDEBUG
- if (prebreak_p_ || postbreak_p_)
- {
- assert (prebreak_p_&&postbreak_p_);
- assert (prebreak_p_->daddy_l_ == this);
- assert (postbreak_p_->daddy_l_ == this);
- }
-#endif
+ return (Paper_column*)broken_to_drul_[LEFT];
}
-void
-PCol::set_breakable()
+Paper_column*
+Paper_column::postbreak_l() const
{
- if (breakable_b())
- return;
-
- do_set_breakable();
- prebreak_p_->pscore_l_ = pscore_l_;
- postbreak_p_->pscore_l_ = pscore_l_;
-
- prebreak_p_->daddy_l_ = postbreak_p_->daddy_l_ = this;
+ return(Paper_column*) broken_to_drul_[RIGHT];
}
-void
-PCol::do_set_breakable()
-{
- prebreak_p_ = new PCol;
- postbreak_p_ = new PCol;
-}
-
-
bool
-PCol::breakpoint_b() const
+Paper_column::breakpoint_b() const
{
return !line_l_;
}
-bool
-PCol::breakable_b() const
-{
- return prebreak_p_||postbreak_p_||daddy_l_;
-}
-
-PCol::PCol()
+Paper_column::Paper_column()
{
used_b_ = false;
error_mark_b_ = false;
- daddy_l_ = 0;
- prebreak_p_=0;
- postbreak_p_=0;
line_l_=0;
- hpos_f_ = -1.0;
- pscore_l_ = 0;
rank_i_ = -1;
}
-PCol::~PCol()
-{
- delete prebreak_p_;
- delete postbreak_p_;
-}
-
-void
-PCol::add (Item *i)
+Line_of_score*
+Paper_column::line_l() const
{
- its.bottom().add (i);
- i->pcol_l_ = this;
+ return line_l_;
}
bool
-PCol::used_b()const
+Paper_column::used_b() const
{
- return daddy_l_ || breakable_b() || its.size ()|| used_b_;
+ return linked_b();
}
+
+IMPLEMENT_IS_TYPE_B1(Paper_column, Horizontal_group_item);
+
#include "p-score.hh"
#include "tex-stream.hh"
#include "p-col.hh"
-
+#include "header.hh"
#include "word-wrap.hh"
#include "gourlay-breaking.hh"
-Paper_score::Paper_score (Paper_def*p)
+Paper_score::Paper_score ()
{
- paper_l_ = p;
super_elem_l_ = new Super_elem;
typeset_element (super_elem_l_);
}
-Paper_score::~Paper_score()
+Paper_score::~Paper_score ()
{
- super_elem_l_->unlink_all();
+ super_elem_l_->unlink_all ();
+ for (PCursor<Score_elem*> i(elem_p_list_.top()); i.ok(); i++)
+ assert(!i->linked_b());
}
void
Paper_score::typeset_element (Score_elem * elem_p)
{
- elem_p_list_.bottom().add (elem_p);
+ elem_p_list_.bottom ().add (elem_p);
elem_p->pscore_l_ = this;
- elem_p->add_processing();
-}
-
-void
-Paper_score::typeset_item (Item *i, PCol *c)
-{
- assert (c && i);
- int breakstat = i->break_status_i_;
-
- if (breakstat == -1)
- {
- c = c->prebreak_p_;
- }else if (breakstat == 1)
- {
- c = c->postbreak_p_;
- }
-
- c->add (i);
- typeset_element (i);
+ elem_p->add_processing ();
}
void
Paper_score::typeset_broken_spanner (Spanner*span_p)
{
- span_p->left_col_l_->starters.bottom().add (span_p);
- assert (span_p->left_col_l_->line_l_ == span_p->right_col_l_->line_l_);
-
typeset_element (span_p);
}
void
Paper_score::typeset_unbroken_spanner (Spanner*span_p)
{
- span_p_list_.bottom().add (span_p);
+ span_p_list_.bottom ().add (span_p);
span_p->pscore_l_=this;
- if (span_p->left_col_l_)
- span_p->left_col_l_->used_b_ = true;
- if ( span_p->right_col_l_)
- span_p->right_col_l_->used_b_ = true;
// do not init start/stop fields. These are for broken spans only.
- span_p->add_processing();
+ span_p->add_processing ();
}
void
-Paper_score::clean_cols()
+Paper_score::clean_cols ()
{
int rank_i = 0;
- for (iter_top (col_p_list_,c); c.ok();)
- if (!c->used_b())
- {
- delete c.remove_p();
- }
- else
- {
- c->set_rank (rank_i++);
- c++;
- }
-}
-
-void
-Paper_score::add (PCol *p)
-{
- p->pscore_l_ = this;
- if (p->breakable_b())
+ for (iter_top (col_p_list_,c); c.ok ();)
{
- p->prebreak_p_->pscore_l_ = this;
- p->postbreak_p_->pscore_l_ = this;
+ c->set_rank (rank_i++);
+ c++;
}
- col_p_list_.bottom().add (p);
}
void
-Paper_score::output (Tex_stream &ts)
+Paper_score::add_column (Paper_column *p)
{
- ts << "\n "<< paper_l_->lookup_l()->texsetting << "%(Tex id)\n";
- ts<< super_elem_l_->TeX_string();
- ts << "\n\\EndLilyPondOutput";
+ col_p_list_.bottom ().add (p);
+ typeset_element(p);
}
+
void
-Paper_score::OK()const
+Paper_score::OK () const
{
#ifndef NDEBUG
- for (iter_top (col_p_list_,cc); cc.ok(); cc++)
- cc->OK();
- for (PCursor<Score_elem*> i (elem_p_list_.top()); i.ok (); i++)
- i->OK();
+ for (PCursor<Score_elem*> i (elem_p_list_.top ()); i.ok (); i++)
+ i->OK ();
#endif
}
void
-Paper_score::print() const
+Paper_score::print () const
{
#ifndef NPRINT
- if ( !check_debug)
- return ;
+ if (!check_debug)
+ return ;
DOUT << "Paper_score { ";
- paper_l_->print();
DOUT << "\n elements: ";
- for (iter_top (elem_p_list_,cc); cc.ok(); cc++)
- cc->print();
+ for (iter_top (elem_p_list_,cc); cc.ok (); cc++)
+ cc->print ();
DOUT << "\n unbroken spanners: ";
- for (iter (span_p_list_.top(), i); i.ok (); i++)
- i->print();
- DOUT << "\ncolumns: ";
- for (iter_top (col_p_list_,cc); cc.ok(); cc++)
- cc->print();
+ for (iter (span_p_list_.top (), i); i.ok (); i++)
+ i->print ();
DOUT << "}\n";
#endif
}
void
-Paper_score::preprocess()
+Paper_score::preprocess ()
{
- super_elem_l_->breakable_col_processing();
- super_elem_l_->pre_processing();
+ super_elem_l_->breakable_col_processing ();
+ super_elem_l_->pre_processing ();
}
void
-Paper_score::postprocess()
+Paper_score::postprocess ()
{
- super_elem_l_->post_processing();
- super_elem_l_->molecule_processing();
+ super_elem_l_->post_processing ();
+ super_elem_l_->molecule_processing ();
}
-PCursor<PCol *>
-Paper_score::find_col (PCol const *c)const
+PCursor<Paper_column *>
+Paper_score::find_col (Paper_column const *c) const
{
- PCol const *what = c;
- if (what->daddy_l_)
- what = what->daddy_l_;
+ Paper_column const *what = c;
- return col_p_list_.find ((PCol*)what);
+ return col_p_list_.find ((Paper_column*)what);
}
Paper_score::set_breaking (Array<Col_hpositions> const &breaking)
{
super_elem_l_->line_of_score_l_->set_breaking (breaking);
- super_elem_l_->break_processing();
+ super_elem_l_->break_processing ();
- for (iter (span_p_list_.top(),i); i.ok ();)
+ for (iter (span_p_list_.top (),i); i.ok ();)
{
- Spanner *span_p = i.remove_p();
- if (span_p->broken_b())
- {
- span_p->unlink();
- delete span_p;
+ Spanner *span_p = i.remove_p ();
+ if (span_p->broken_b ())
+ {
+ span_p->unlink ();
+ delete span_p;
}else
{
typeset_broken_spanner (span_p);
}
}
- for (iter (elem_p_list_.top(),i); i.ok () ;)
+ for (iter (elem_p_list_.top (),i); i.ok () ;)
{
- Item *i_l =i->item();
- if ( i_l && !i_l->pcol_l_->line_l_)
- {
- i_l->unlink();
- delete i.remove_p();
- }
- else
- i++;
+ Item *i_l =i->item ();
+ if (i_l && !i_l->line_l ())
+ {
+ i_l->unlink ();
+ delete i.remove_p ();
+ }
+ else
+ i++;
}
-
- for (iter_top (col_p_list_, i); i.ok(); i++)
- i->clean_breakable_items();
}
void
-Paper_score::calc_breaking()
+Paper_score::calc_breaking ()
{
- Break_algorithm *algorithm_p;
+ Break_algorithm *algorithm_p=0;
Array<Col_hpositions> sol;
bool try_wrap = ! paper_l_->get_var ("castingalgorithm");
if (!try_wrap)
{
- algorithm_p = new Gourlay_breaking ;
- algorithm_p->set_pscore (this);
- sol = algorithm_p->solve();
- delete algorithm_p;
- if ( ! sol.size())
- {
- warning ("Can not solve this casting problem exactly; revert to Word_wrap");
- try_wrap = true;
- }
+ algorithm_p = new Gourlay_breaking ;
+ algorithm_p->set_pscore (this);
+ sol = algorithm_p->solve ();
+ delete algorithm_p;
+ if (! sol.size ())
+ {
+ warning ("Can not solve this casting problem exactly; revert to Word_wrap");
+ try_wrap = true;
+ }
}
if (try_wrap)
{
- algorithm_p = new Word_wrap;
- algorithm_p->set_pscore (this);
- sol = algorithm_p->solve();
- delete algorithm_p;
+ algorithm_p = new Word_wrap;
+ algorithm_p->set_pscore (this);
+ sol = algorithm_p->solve ();
+ delete algorithm_p;
}
set_breaking (sol);
}
void
-Paper_score::process()
+Paper_score::process ()
{
- clean_cols();
- print();
+ clean_cols ();
+ print ();
*mlog << "Preprocessing elements... " <<flush;
- preprocess();
+ preprocess ();
*mlog << "\nCalculating column positions ... " <<flush;
- calc_breaking();
+ calc_breaking ();
*mlog << "\nPostprocessing elements..." << endl;
- postprocess();
+ postprocess ();
+
+ // output
+ String outname = paper_l_->outfile_str_ ;
+ if (outname == "")
+ outname = default_out_str_+ ".tex";
-#ifndef NDEBUGA
- for (PCursor<Score_elem*> i (elem_p_list_.top()); i.ok (); i++)
- assert (i->status() >= 9);
-#endif
+ *mlog << "TeX output to " << outname << " ...\n";
+
+ Tex_stream the_output (outname);
+
+ the_output << "% outputting Score, defined at: " << origin_str_ << "\n";
+ if (header_l_)
+ {
+ the_output << header_l_->TeX_string();
+ }
+
+ the_output << "\n "<< paper_l_->lookup_l ()->texsetting << "%(Tex id)\n";
+ the_output<< super_elem_l_->TeX_output_str ();
+ the_output << "\n\\EndLilyPondOutput";
}
/** Get all breakable columns between l and r, (not counting l and r). */
-Link_array<PCol>
-Paper_score::breakable_col_range (PCol*l,PCol*r)const
+Link_array<Paper_column>
+Paper_score::breakable_col_range (Paper_column*l,Paper_column*r) const
{
- Link_array<PCol> ret;
+ Link_array<Paper_column> ret;
- PCursor<PCol*> start (l ? find_col (l)+1 : col_p_list_.top());
- PCursor<PCol*> stop (r ? find_col (r) : col_p_list_.bottom());
+ PCursor<Paper_column*> start (l ? find_col (l)+1 : col_p_list_.top ());
+ PCursor<Paper_column*> stop (r ? find_col (r) : col_p_list_.bottom ());
/*
ugh! windows-suck-suck-suck.
- */
- while ( PCursor<PCol*>::compare (start,stop) < 0)
+ */
+ while (PCursor<Paper_column*>::compare (start,stop) < 0)
{
- if (start->breakable_b())
- ret.push (start);
- start++;
+ if (start->breakable_b_)
+ ret.push (start);
+ start++;
}
return ret;
}
-Link_array<PCol>
-Paper_score::col_range (PCol*l,PCol*r)const
+Link_array<Paper_column>
+Paper_score::col_range (Paper_column*l, Paper_column*r) const
{
- Link_array<PCol> ret;
+ Link_array<Paper_column> ret;
- PCursor<PCol*> start (l ? find_col (l)+1 : col_p_list_.top());
- PCursor<PCol*> stop (r ? find_col (r) : col_p_list_.bottom());
+ PCursor<Paper_column*> start (l ? find_col (l)+1 : col_p_list_.top ());
+ PCursor<Paper_column*> stop (r ? find_col (r) : col_p_list_.bottom ());
ret.push (l);
/*
ugh! windows-suck-suck-suck.
- */
- while ( PCursor<PCol*>::compare (start,stop) < 0)
- ret.push (start++);
+ */
+ while (PCursor<Paper_column*>::compare (start,stop) < 0)
+ ret.push (start++);
ret.push (r);
return ret;
}
-Link_array<PCol>
-Paper_score::broken_col_range (PCol*l,PCol*r)const
+Link_array<Item>
+Paper_score::broken_col_range (Item const*l_item_l, Item const*r_item_l) const
{
- Link_array<PCol> ret;
-
- PCursor<PCol*> start (l ? find_col (l)+1 : col_p_list_.top());
- PCursor<PCol*> stop (r ? find_col (r) : col_p_list_.bottom());
+ Link_array<Item> ret;
+ Item const*l=l_item_l;
+ Item const*r=r_item_l;
+
+ while (! l->is_type_b(Paper_column::static_name ()))
+ l = l->axis_group_l_a_[X_AXIS]->item ();
+
+ while (! r->is_type_b(Paper_column::static_name ()))
+ r = r->axis_group_l_a_[X_AXIS]->item ();
+
+ PCursor<Paper_column*> start (l ? find_col ((Paper_column*)l)+1 : col_p_list_.top ());
+ PCursor<Paper_column*> stop (r ? find_col ((Paper_column*)r) : col_p_list_.bottom ());
/*
ugh! windows-suck-suck-suck.
*/
- while ( PCursor<PCol*>::compare (start,stop) < 0)
+ while (PCursor<Paper_column*>::compare (start,stop) < 0)
{
- if (start->breakable_b() && !start->line_l_)
- ret.push (start);
- start++;
+ if (start->breakable_b_ && !start->line_l_)
+ ret.push (start);
+ start++;
}
return ret;
#include "lookup.hh"
#include "dimen.hh"
#include "input-translator.hh"
-#include "engraver-group.hh"
#include "assoc-iter.hh"
+#include "score-grav.hh"
+#include "p-score.hh"
+#include "main.hh"
void
Paper_def::set_var (String s, Real r)
{
- real_vars_p_->elem (s) = r;
+ real_vars_p_->elem (s) = r;
}
Real
-Paper_def::get_var (String s)const
+Paper_def::get_var (String s) const
{
if (! real_vars_p_->elt_b (s))
- error ( "unknown paper variable `" + s+"'");
+ error ("unknown paper variable `" + s+"'");
return real_vars_p_->elem (s);
}
}
Real
-Paper_def::duration_to_dist (Moment d,Real k)const
+Paper_def::duration_to_dist (Moment d,Real k) const
{
if (get_var("geometric"))
return geometric_spacing(d);
}
Real
-Paper_def::arithmetic_spacing(Moment d ,Real k)const
+Paper_def::arithmetic_spacing(Moment d ,Real k) const
{
- return (log_2(d) + k)* get_var( "arithmetic_multiplier");
+ return (log_2(d) + k)* get_var("arithmetic_multiplier");
}
Real
Real
-Paper_def::rule_thickness()const
+Paper_def::rule_thickness() const
{
return get_var ("rule_thickness");
}
}
Real
-Paper_def::note_width()const
+Paper_def::note_width() const
{
return get_var ("notewidth");
}
itrans_p_->print();
for (Assoc_iter<String,Real> i (*real_vars_p_); i.ok(); i++)
{
- DOUT << i.key() << "= " << i.val () << "\n";
+ DOUT << i.key() << "= " << i.val () << "\n";
}
DOUT << "}\n";
#endif
}
Global_translator*
-Paper_def::get_global_translator_p() const
+Paper_def::get_global_translator_p()
{
- return itrans_p_->get_group_engraver_p()->global_l ();
+ if (only_midi)
+ {
+ return 0;
+ }
+
+ Global_translator* g = itrans_p_->get_group_engraver_p()->global_l ();
+ assert (g->is_type_b (Score_engraver::static_name()));
+ Score_engraver*grav = (Score_engraver*) g;
+ grav->pscore_p_ = new Paper_score;
+ grav->pscore_p_->paper_l_ = this;
+ return g;
}
+
+IMPLEMENT_IS_TYPE_B1(Paper_def, Music_output_def);
Box *box;
Chord * chord;
Duration *duration;
- Identifier *id;
+ Identifier *id;
Input_translator* itrans;
Music *music;
Music_list *musiclist;
Interval *interval;
Lookup*lookup;
Melodic_req * melreq;
+ Music_output_def * outputdef;
Midi_def* midi;
Moment *moment;
Note_req *notereq;
}
%{
-int
+int
yylex(YYSTYPE *s, void * v_l)
{
My_lily_parser *pars_l = (My_lily_parser*) v_l;
My_lily_lexer * lex_l = pars_l->lexer_p_;
-
+
lex_l->lexval_l = (void*) s;
return lex_l->yylex();
}
%token <melreq> NOTENAME_ID
%token <id> DURATION_IDENTIFIER
%token <id> IDENTIFIER
-%token <id> MELODIC_REQUEST_IDENTIFIER
+%token <id> MELODIC_REQUEST_IDENTIFIER
%token <id> MUSIC_IDENTIFIER
%token <id> VOICE_IDENTIFIER
%token <id> POST_REQUEST_IDENTIFIER
%token <id> MIDI_IDENTIFIER
%token <id> PAPER_IDENTIFIER
%token <id> REQUEST_IDENTIFIER
-%token <real> REAL
+%token <real> REAL
%token <string> DURATION RESTNAME
-%token <string> STRING
+%token <string> STRING
%token <string> FIELDNAME RECORDLINE
-%token <i> POST_QUOTES
+%token <i> POST_QUOTES
%token <i> PRE_QUOTES
-
+%type <outputdef> output_def
%type <header> mudela_header mudela_header_body
%type <box> box
%type <c> open_request_parens close_request_parens
%type <i> int
%type <i> script_dir
%type <id> identifier_init
-%type <duration> explicit_steno_duration notemode_duration
+%type <duration> explicit_steno_duration notemode_duration
%type <duration> entered_notemode_duration explicit_duration
%type <interval> dinterval
%type <intvec> intastint_list
%type <lookup> symtables symtables_body
%type <melreq> melodic_request steno_melodic_req
%type <notereq> steno_note_req
-%type <melreqvec> pitch_list
+%type <melreqvec> pitch_list
%type <midi> midi_block midi_body
%type <moment> duration_length
%type <music> Music transposed_music
-%type <musiclist> Voice Voice_body
+%type <musiclist> Voice Voice_body
%type <chord> Chord Chord_body
%type <paper> paper_block paper_body
%type <real> dim real
%type <real> unit
-%type <request> post_request pre_request command_req verbose_command_req
+%type <request> post_request pre_request command_req verbose_command_req
%type <request> abbrev_command_req
-%type <request> script_req dynamic_req
+%type <request> script_req dynamic_req
%type <score> score_block score_body
%type <script> script_definition script_body mudela_script gen_script_def
%type <textdef> text_def
THIS->default_header_p_ = $2;
}
| mudela score_block {
- add_score($2);
+ add_score($2);
}
| mudela add_declaration { }
| mudela error
- | mudela check_version { }
+ | mudela check_version { }
| mudela add_notenames { }
;
HEADER {
THIS->lexer_p_->push_header_state();
}
-
+
'{' mudela_header_body '}' {
$$ = $4;
THIS->lexer_p_->pop_state();
identifier_init:
score_block {
$$ = new Score_id($1, SCORE_IDENTIFIER);
-
+
}
| paper_block {
$$ = new Paper_def_id($1, PAPER_IDENTIFIER);
-
+
}
| midi_block {
$$ = new Midi_def_id($1, MIDI_IDENTIFIER);
-
+
}
| script_definition {
$$ = new Script_id($1, SCRIPT_IDENTIFIER);
-
+
}
| Music {
$$ = new Music_id($1, MUSIC_IDENTIFIER);
-
+
}
| symtables {
$$ = new Lookup_id($1, IDENTIFIER);
-
+
}
| real {
$$ = new Real_id(new Real($1), REAL_IDENTIFIER);
-
+
}
| int {
$$ = new Int_id(new int($1), INT_IDENTIFIER);
-
+
}
| post_request {
$$ = new Request_id($1, POST_REQUEST_IDENTIFIER);
-
+
}
| melodic_request {
$$ = new Request_id($1, MELODIC_REQUEST_IDENTIFIER);
-
+
}
| input_translator_spec {
$$ = new Input_translator_id ( $1, INPUT_TRANS_IDENTIFIER);
$$ = $1->input_translator();
$$-> set_spot( THIS->here_input() );
}
- | STRING STRING {
- $$ = new Input_translator;
+ | STRING STRING {
+ $$ = new Input_translator;
$$->base_str_ = *$1;
$$->type_str_ =*$2;
$$->set_spot ( THIS->here_input() );
/*cont*/ '{' score_body '}' {
$$ = $4;
$$->set_spot(THIS->pop_spot());
- if (!$$->paper_p_ && ! $$->midi_p_)
- $$->paper_p_ = THIS->default_paper();
+ if (!$$->def_p_arr_.size ())
+ $$->add ( THIS->default_paper());
/* handle error levels. */
$$->errorlevel_i_ = THIS->error_level_i_;
}
;
-score_body: {
- $$ = new Score;
+score_body: {
+ $$ = new Score;
}
| SCORE_IDENTIFIER {
$$ = $1->score();
| score_body Music {
$$->music_p_ = $2;
}
- | score_body paper_block {
- $$->paper_p_ = $2;
- }
- | score_body midi_block {
- $$->midi_p_ = $2;
+ | score_body output_def {
+ $$->add( $2);
}
| score_body error {
}
;
+output_def:
+ paper_block {
+ $$ = $1;
+ }
+ | midi_block {
+ $$= $1;
+ }
+ ;
+
intastint_list:
/* */ { $$ =new Array<int>; }
| intastint_list int '*' int {
| PAPER_IDENTIFIER {
$$ = $1->paperdef();
}
- | paper_body OUTPUT STRING ';' { $$->outfile_str_ = *$3;
+ | paper_body OUTPUT STRING ';' {
+ $$->outfile_str_ = *$3;
delete $3;
}
| paper_body symtables { $$->set($2); }
- | paper_body STRING '=' dim ';' {
+ | paper_body STRING '=' dim ';' {
$$->set_var(*$2, $4);
}
| paper_body STRING '=' real ';' {
midi_body: /* empty */ {
$$ = THIS->default_midi();
}
- | midi_body OUTPUT STRING ';' {
- $$->outfile_str_ = *$3;
- delete $3;
+ | midi_body OUTPUT STRING ';' {
+ $$->outfile_str_ = *$3;
+ delete $3;
}
| midi_body tempo_request ';' {
$$->set_tempo( $2->dur_.length(), $2->metronome_i_ );
}
| Voice_body ID STRING STRING ';' {
$$ = new Voice;
- $$->type_str_ = *$3;
+ $$->type_str_ = *$3;
$$->id_str_ = *$4;
delete $3;
delete $4;
| Chord { $$ = $1; }
| transposed_music { $$ = $1; }
| MUSIC_IDENTIFIER { $$ = $1->music(); }
- | MELODIC
- { THIS->lexer_p_->push_note_state(); }
+ | MELODIC
+ { THIS->lexer_p_->push_note_state(); }
Music
{ $$=$3; THIS->lexer_p_->pop_state(); }
- | LYRIC
- { THIS->lexer_p_->push_lyric_state(); }
+ | LYRIC
+ { THIS->lexer_p_->push_lyric_state(); }
Music
{ $$ = $3; THIS->lexer_p_->pop_state(); }
- ;
+ ;
Chord:
'<' Chord_body '>' { $$ = $2; }
$$->multi_level_i_=$3;
}
| Chord_body ID STRING STRING ';' {
- $$->type_str_ = *$3;
+ $$->type_str_ = *$3;
$$->id_str_ = *$4;
- delete $4;
+ delete $4;
delete $3;
}
| Chord_body Music {
}
| command_elt
| voice_command ';' { $$ = 0; }
- ;
+ ;
simple_element:
- music_elt
+ music_elt
| lyrics_elt
;
;
command_req:
- abbrev_command_req
+ abbrev_command_req
| verbose_command_req ';' { $$ = $1; }
;
abbrev_command_req:
- '|' {
+ '|' {
$$ = new Barcheck_req;
}
| COMMAND_IDENTIFIER {
// sorry hw, i need meter at output of track,
// but don-t know where to get it... statics should go.
// HW : default: 4/4, meterchange reqs may change it.
-
+
Midi_def::num_i_s = $2;
Midi_def::den_i_s = $4;
$$ = m;
}
| SKIP duration_length {
Skip_req * skip_p = new Skip_req;
- skip_p->duration_.set_plet($2->numerator().as_long(),
+ skip_p->duration_.set_plet($2->numerator().as_long(),
$2->denominator().as_long());
-
+
delete $2;
$$ = skip_p;
}
$$ = new Clef_change_req(*$2);
delete $2;
}
- | KEY pitch_list {
+ | KEY pitch_list {
Key_change_req *key_p= new Key_change_req;
key_p->melodic_p_arr_ = *$2;
$$ = key_p;
POST_REQUEST_IDENTIFIER {
$$ = (Request*)$1->request();
}
- |close_request_parens {
- $$ = THIS->get_parens_request($1);
+ |close_request_parens {
+ $$ = THIS->get_parens_request($1);
}
| script_req
| dynamic_req
$$ = $1->clone()->musical()->melodic();
$$->octave_i_ += THIS->default_octave_i_;
}
- | steno_melodic_req POST_QUOTES {
+ | steno_melodic_req POST_QUOTES {
$$-> octave_i_ += $2;
}
- | PRE_QUOTES steno_melodic_req {
+ | PRE_QUOTES steno_melodic_req {
$$ = $2;
$2-> octave_i_ -= $1;
}
}
| steno_note_req '!' {
$$->forceacc_b_ = ! $$->forceacc_b_;
- }
+ }
/* have to duration here. */
;
| SPANDYNAMIC '{' int int '}' {
Span_dynamic_req * sp_p = new Span_dynamic_req;
sp_p->spantype = $4;
- sp_p-> dynamic_dir_i_ = $3;
+ sp_p-> dynamic_dir_ = $3;
$$ = sp_p;
}
;
'~' {
$$ = '~';
}
- | '(' {
+ | '(' {
$$='(';
}
- | ']' {
+ | ']' {
$$ = ']';
}
| close_plet_parens {
E_EXCLAMATION {
$$ = '!';
}
- | ')' {
+ | ')' {
$$=')';
}
| '[' {
s->set_from_input(*$1,$2, $3,$4,$5, $6);
$$ = s;
delete $1;
- }
+ }
;
script_req:
- script_dir gen_script_def {
+ script_dir gen_script_def {
Musical_script_req *m = new Musical_script_req;
- $$ = m;
+ $$ = m;
m-> scriptdef_p_ = $2;
m-> set_spot ( THIS->here_input() );
- m-> dir_i_ = $1;
+ m-> dir_ = $1;
}
;
gen_script_def:
text_def { $$ = $1; }
- | mudela_script { $$ = $1;
+ | mudela_script { $$ = $1;
$$-> set_spot( THIS->here_input() );
}
;
text_def:
- STRING {
+ STRING {
Text_def *t = new Text_def;
$$ = t;
- t->text_str_ = *$1;
+ t->text_str_ = *$1;
delete $1;
t->style_str_ = THIS->textstyle_str_;
$$->set_spot( THIS->here_input() );
$$ = get_scriptdef('.');
}
;
-
+
mudela_script:
SCRIPT_IDENTIFIER { $$ = $1->script(); }
| script_definition { $$ = $1; }
- | script_abbreviation {
+ | script_abbreviation {
$$ = THIS->lexer_p_->lookup_identifier(*$1)->script();
delete $1;
}
}
;
-pre_request:
- open_request_parens {
- $$ = THIS->get_parens_request($1);
+pre_request:
+ open_request_parens {
+ $$ = THIS->get_parens_request($1);
}
;
THIS->set_default_duration($2);
delete $2;
}
- | OCTAVE {
+ | OCTAVE {
/*
This is weird, but default_octave_i_
is used in steno_note_req too
}
;
-duration_length:
+duration_length:
{
$$ = new Moment(0,1);
}
- | duration_length explicit_steno_duration {
+ | duration_length explicit_steno_duration {
*$$ += $2->length();
}
;
;
entered_notemode_duration:
- /* */ {
+ /* */ {
$$ = new Duration(THIS->default_duration_);
}
| dots {
- $$ = new Duration(THIS->default_duration_);
+ $$ = new Duration(THIS->default_duration_);
$$->dots_i_ = $1;
}
| explicit_steno_duration {
$$->dots_i_ ++;
}
| explicit_steno_duration '*' int {
- $$->plet_.iso_i_ *= $3;
+ $$->plet_.iso_i_ *= $3;
}
| explicit_steno_duration '/' int {
- $$->plet_.type_i_ *= $3;
+ $$->plet_.type_i_ *= $3;
}
;
delete r_p;
}
;
-
+
dim:
|MM_T { $$ = 1 MM; }
|PT_T { $$ = 1 PT; }
;
-
+
/*
symbol tables
*/
;
dinterval: dim dim {
- $$ = new Interval($1, $2);
+ $$ = new Interval($1, $2);
}
;
%%
-void
+void
My_lily_parser::set_yydebug(bool b )
{
#ifdef YYDEBUG
void
Performer_group_performer::do_creation_processing()
{
- for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+ for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++)
i->creation_processing();
}
void
-Performer_group_performer::do_print()const
+Performer_group_performer::do_print() const
{
#ifndef NPRINT
- if ( !check_debug)
+ if (!check_debug)
return ;
- for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+ for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++)
i->print();
#endif
}
void
Performer_group_performer::do_removal_processing()
{
- for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+ for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++)
i->do_removal_processing();
}
bool hebbes_b =false;
for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++)
hebbes_b =nongroup_l_arr_[i]->try_request (req_l);
- if ( !hebbes_b && daddy_perf_l_)
+ if (!hebbes_b && daddy_perf_l_)
hebbes_b = daddy_perf_l_->try_request (req_l);
return hebbes_b ;
}
Performer_group_performer::find_get_translator_l (String n,String id)
{
Translator * ret=0;
- Input_translator* itrans_l= itrans_l_-> recursive_find ( n);
+ Input_translator* itrans_l= itrans_l_-> recursive_find (n);
if (itrans_l)
{
ret = find_performer_l (n,id);
add (group);
ret = group;
- if (group->itrans_l_->is_name_b (n) )
+ if (group->itrans_l_->is_name_b (n))
ret ->id_str_ = id;
else
return ret->find_get_translator_l (n,id);
Performer_group_performer::get_default_interpreter()
{
// ?
- if ( is_bottom_performer_b())
+ if (is_bottom_performer_b())
return daddy_perf_l_->get_default_interpreter();
Performer_group_performer *perf_p= itrans_l_->
void
Performer_group_performer::process_requests()
{
- for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+ for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++)
i->process_requests();
}
}
int
-Performer::get_tempo_i()const
+Performer::get_tempo_i() const
{
return daddy_perf_l_->get_tempo_i();
}
--- /dev/null
+/*
+ request-iterator.cc -- implement Request_chord_iterator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "translator.hh"
+#include "debug.hh"
+#include "request-iterator.hh"
+#include "music-list.hh"
+#include "request.hh"
+
+IMPLEMENT_IS_TYPE_B1(Request_chord_iterator,Music_iterator);
+
+void
+Request_chord_iterator::construct_children()
+{
+ get_req_translator_l();
+}
+
+Request_chord_iterator::Request_chord_iterator (Request_chord*el_l)
+{
+ elt_l_ = el_l;
+ MInterval elt_dur =el_l->time_int();
+ elt_duration_ = elt_dur.length ();
+ last_b_ = false;
+}
+
+
+bool
+Request_chord_iterator::ok() const
+{
+ return (elt_duration_ && !last_b_) || first_b_;
+}
+
+
+
+Moment
+Request_chord_iterator::next_moment() const
+{
+ Moment m (0);
+ if (!first_b_)
+ m = elt_duration_;
+ return m;
+}
+
+void
+Request_chord_iterator::do_print() const
+{
+#ifndef NPRINT
+ DOUT << "duration: " << elt_duration_;
+#endif
+}
+void
+Request_chord_iterator::process_and_next (Moment mom)
+{
+ if (first_b_)
+ {
+ for (PCursor<Music*> i (elt_l_->music_p_list_); i.ok(); i++)
+ {
+ assert (i->is_type_b (Request::static_name()));
+ Request * req_l = (Request*)i.ptr();
+ bool gotcha = report_to_l()->try_request (req_l);
+ if (!gotcha)
+ req_l->warning ("Junking request: " + String (req_l->name()));
+
+ }
+ first_b_ = false;
+ }
+
+ if (mom >= elt_duration_)
+ last_b_ = true;
+}
bool
-Request::equal_b (Request *r)const
+Request::equal_b (Request *r) const
{
- if ( is_type_b ( r->name()) )
+ if (is_type_b (r->name()))
return r->do_equal_b ((Request*)this);
- if ( r->is_type_b (name()))
+ if (r->is_type_b (name()))
return do_equal_b (r);
return false;
}
bool
-Request::do_equal_b (Request*)const
+Request::do_equal_b (Request*) const
{
return false;
}
Rest_collision_engraver::do_print() const
{
#ifndef NPRINT
- if ( rest_collision_p_)
+ if (rest_collision_p_)
rest_collision_p_->print();
#endif
}
if (!(stem_l->beams_left_i_ || stem_l->beams_right_i_))
return;
- int dir_i = rest_l_arr_[0]->dir_i_;
+ int dir_i = rest_l_arr_[0]->dir_;
int midpos = 4;
#if 1
// ugh
int stem_length_i = 7 - 2;
// ugh, Stem::stem_start vs Stem::stem_end
- int pos = (stem_l->stem_end_f() - midpos) - dir_i * stem_length_i;
+ int pos = (int)(stem_l->stem_end_f() - midpos) - dir_i * stem_length_i;
#else // nogo: stem_start not set for rests?
int pos = (stem_l->stem_start_f() - midpos) + dir_i * 2;
#endif
{
int dy = rest_l_arr_.size() > 2 ? 6 : 4;
- rest_l_arr_[0]->translate_heads (rest_l_arr_[0]->dir_i_ *dy);
+ rest_l_arr_[0]->translate_heads (rest_l_arr_[0]->dir_ *dy);
// top is last element...
- rest_l_arr_.top()->translate_heads (rest_l_arr_.top ()->dir_i_* dy);
+ rest_l_arr_.top()->translate_heads (rest_l_arr_.top ()->dir_* dy);
}
// meisjes met jongetjes
else
int dir_i = -1;
rest_l_arr_[0]->translate_heads (dir_i * 3);
#else
- // int dir_i = - ncol_l_arr_[0]->dir_i_;
- int dir_i = rest_l_arr_[0]->dir_i_;
+ // int dir_i = - ncol_l_arr_[0]->dir_;
+ int dir_i = rest_l_arr_[0]->dir_;
// hope it's 4: if it works->doco
int midpos = 4;
{
// how to know whether to sort?
ncol_l_arr_[i]->sort();
- for ( int j = 0; j < ncol_l_arr_[i]->head_l_arr_.size(); j++)
+ for (int j = 0; j < ncol_l_arr_[i]->head_l_arr_.size(); j++)
minpos = minpos >? dir_i *
(ncol_l_arr_[i]->head_l_arr_[j]->position_i_ -midpos) + sep_i;
}
announce_element (Score_elem_info (align_p_,0));
}
Score_elem * unbound_elem = inf.elem_l_;
- while ( unbound_elem->axis_group_l_a_[X_AXIS])
+ while (unbound_elem->axis_group_l_a_[X_AXIS])
unbound_elem = unbound_elem->axis_group_l_a_[X_AXIS];
align_p_->add_element (unbound_elem);
}
}
void
-Score_column::print() const
+Score_column::do_print() const
{
#ifndef NPRINT
- DOUT << "Score_column { mus "<< musical_b_ <<" at " << when_<<'\n';
+ DOUT << "mus "<< musical_b_ <<" at " << when_<<'\n';
DOUT << "durations: [";
for (int i=0; i < durations.size(); i++)
- DOUT << durations[i] << " ";
+ DOUT << durations[i] << " ";
DOUT << "]\n";
- PCol::print();
- DOUT << "}\n";
+ Paper_column::do_print();
#endif
}
assert (d);
for (int i = 0; i< durations.size(); i++)
{
- if (d == durations[i])
- return ;
+ if (d == durations[i])
+ return ;
}
durations.push (d);
}
-void
-Score_column::do_set_breakable()
-{
- Score_column *c1 = new Score_column (when_);
- Score_column *c2 = new Score_column (when_);
- prebreak_p_ =c1;
- postbreak_p_ = c2;
- c1->durations = durations;
- c2->durations = durations;
- c1->musical_b_
- = c2->musical_b_ = musical_b_;
-}
+IMPLEMENT_IS_TYPE_B1(Score_column, Paper_column);
#include "p-col.hh"
Score_elem*
-Score_elem::dependency (int i)const
+Score_elem::dependency (int i) const
{
- return (Score_elem*) get_out_edge_arr()[i];
+ return (Score_elem*) get_out_edge_arr ()[i];
}
int
-Score_elem::dependency_size() const
+Score_elem::dependency_size () const
{
- return get_out_edge_arr().size ();
+ return get_out_edge_arr ().size ();
}
Score_elem*
return get_in_edge_arr().size ();
}
-
-
String
-Score_elem::TeX_string_without_offset (Offset o)const
+Score_elem::make_TeX_string (Offset o)const
{
- if (transparent_b_)
- return "";
String s ("\\placebox{%}{%}{%}");
Array<String> a;
a.push (print_dimen (o.y()));
a.push (print_dimen (o.x()));
String t = output->TeX_string();
if (t == "")
- return t;
+ return t;
a.push (t);
String r;
if (check_debug)
- r = String ("\n%start: ") + name() + "\n";
- r += substitute_args (s, a);;
+ r = String ("\n%start: ") + name() + "\n";
+ r += substitute_args (s, a);
return r;
}
-
String
-Score_elem::TeX_string() const
+Score_elem::do_TeX_output_str () const
{
- assert (status_ > POSTCALCED);
- return TeX_string_without_offset (offset_);
+ return make_TeX_string(absolute_offset());
}
-void
-Score_elem::copy_dependencies (Score_elem const &s)
+Score_elem::Score_elem (Score_elem const&s)
{
/* called from derived ctor, so most info points to the same deps
- as (Directed_graph_node&)s. Nobody points to us, so don't copy
- dependents.
+ as (Directed_graph_node&)s. Nobody points to us, so don't copy
+ dependents.
*/
copy_edges_out (s);
-}
-
-Score_elem::Score_elem (Score_elem const&s)
-{
transparent_b_ = s.transparent_b_;
empty_b_ = s.empty_b_;
axis_group_l_a_[0] = axis_group_l_a_[1] =0;
delete output;
status_ = DELETED;
output = 0;
-
}
/*
GEOMETRY
*/
Real
-Score_elem::absolute_coordinate (Axis a)const
+Score_elem::absolute_coordinate (Axis a) const
{
Real r = offset_[a];
- for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
- axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a])
+ for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
+ axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a])
- r += axis_group_l->offset_[a];
+ r += axis_group_l->offset_[a];
return r;
}
return Offset (absolute_coordinate (X_AXIS), absolute_coordinate (Y_AXIS));
}
- void
+void
Score_elem::translate (Real y, Axis a)
{
offset_[a] += y;
}
Real
-Score_elem::relative_coordinate (Axis_group_element*e, Axis a)const
+Score_elem::relative_coordinate (Axis_group_element*e, Axis a) const
{
Real r =0.0;
- for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
- axis_group_l != e;
- axis_group_l = axis_group_l->axis_group_l_a_[a])
- r += axis_group_l->offset_[a];
+ for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
+ axis_group_l != e;
+ axis_group_l = axis_group_l->axis_group_l_a_[a])
+ r += axis_group_l->offset_[a];
return r;
}
Axis_group_element*
-Score_elem::common_group (Score_elem const* s, Axis a)const
+Score_elem::common_group (Score_elem const* s, Axis a) const
{
Link_array<Axis_group_element> my_groups;
- for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
- axis_group_l;
- axis_group_l = axis_group_l->axis_group_l_a_[a])
- my_groups.push (axis_group_l);
+ for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
+ axis_group_l;
+ axis_group_l = axis_group_l->axis_group_l_a_[a])
+ my_groups.push (axis_group_l);
Axis_group_element* common_l=0;
- for ( Axis_group_element * axis_group_l = s->axis_group_l_a_[a];
- !common_l && axis_group_l;
- axis_group_l = axis_group_l->axis_group_l_a_[a])
- common_l = my_groups.find_l (axis_group_l);
+ for (Axis_group_element * axis_group_l = s->axis_group_l_a_[a];
+ !common_l && axis_group_l;
+ axis_group_l = axis_group_l->axis_group_l_a_[a])
+ common_l = my_groups.find_l (axis_group_l);
return common_l;
}
if (!output)
{
- Molecule*m = brew_molecule_p();
- r = m->extent().x ();
- delete m;
+ Molecule*m = brew_molecule_p();
+ r = m->extent().x ();
+ delete m;
}
else
- r = output->extent().x ();
+ r = output->extent().x ();
return r;
}
}
Interval
-Score_elem::extent (Axis a)const
+Score_elem::extent (Axis a) const
{
Interval r;
- if ( !empty_b_)
+ if (!empty_b_)
{
- r = (a == X_AXIS)? do_width(): do_height ();
+ r = (a == X_AXIS)? do_width(): do_height ();
}
if (!r.empty_b()) // float exception on DEC Alpha
- r+=offset_[a];
+ r+=offset_[a];
return r;
}
Interval r;
if (!output)
{
- Molecule*m = brew_molecule_p();
- r = m->extent().y ();
- delete m;
+ Molecule*m = brew_molecule_p();
+ r = m->extent().y ();
+ delete m;
}
else
- r = output->extent().y ();
+ r = output->extent().y ();
return r;
}
STANDARD METHS
*/
void
-Score_elem::print()const
+Score_elem::print() const
{
#ifndef NPRINT
DOUT << name() << "{\n";
DOUT << "dets: " << dependent_size() << "dependencies: " <<
- dependency_size();
+ dependency_size();
if (offset_.x() || offset_.y ())
- DOUT << "offset (" << offset_.x() << ", " << offset_.y () <<")";
+ DOUT << "offset (" << offset_.x() << ", " << offset_.y () <<")";
DOUT << "\n";
do_print();
if (output)
- output->print();
+ output->print();
DOUT << "}\n";
#endif
Score_elem::add_processing()
{
if (status_ >= VIRGIN)
- return;
+ return;
status_ = VIRGIN;
do_add_processing();
}
Score_elem::pre_processing()
{
if (status_ >= PRECALCED)
- return;
+ return;
assert (status_ != PRECALCING); // cyclic dependency
status_ = PRECALCING;
for (int i=0; i < dependency_size(); i++)
- dependency (i)->pre_processing();
+ dependency (i)->pre_processing();
Link_array<Score_elem> extra (get_extra_dependencies());
for (int i=0; i < extra.size(); i++)
- extra[i]->pre_processing();
+ extra[i]->pre_processing();
do_pre_processing();
status_ = PRECALCED;
Score_elem::breakable_col_processing()
{
if (status_ >= PREBROKEN)
- return;
+ return;
if (status_== PREBREAKING)
{
- status_ = PREBROKEN;
- return ;
+ status_ = PREBROKEN;
+ return ;
}
status_ = PREBREAKING;
for (int i=0; i < dependency_size(); i++)
- dependency (i)->breakable_col_processing();
+ dependency (i)->breakable_col_processing();
- Link_array<Score_elem> extra (get_extra_dependencies());
+ Link_array<Score_elem> extra (get_extra_dependencies());
for (int i=0; i < extra.size(); i++)
- extra[i]->breakable_col_processing();
+ extra[i]->breakable_col_processing();
do_breakable_col_processing();
Score_elem::break_processing()
{
if (status_ >= BROKEN)
- return;
+ return;
if (status_ == BREAKING)
{
- status_ = BROKEN;
- return;
+ status_ = BROKEN;
+ return;
}
status_ = BREAKING;
for (int i=0; i < dependency_size(); i++)
- dependency (i)->break_processing();
+ dependency (i)->break_processing();
Link_array<Score_elem> extra (get_extra_dependencies());
for (int i=0; i < extra.size(); i++)
- extra[i]->break_processing();
+ extra[i]->break_processing();
Score_elem::post_processing()
{
if (status_ >= POSTCALCED)
- return;
+ return;
assert (status_ != POSTCALCING);// cyclic dependency
status_=POSTCALCING;
for (int i=0; i < dependency_size(); i++)
- dependency (i)->post_processing();
+ dependency (i)->post_processing();
Link_array<Score_elem> extra (get_extra_dependencies());
for (int i=0; i < extra.size(); i++)
- extra[i]->post_processing();
+ extra[i]->post_processing();
do_post_processing();
}
Score_elem::Status
-Score_elem::status()const
+Score_elem::status() const
{
return status_;
}
void
Score_elem::molecule_processing()
{
- if (status_ >= OUTPUT)
- return;
- status_ = OUTPUT; // do it only once.
+ if (status_ >= BREWED)
+ return;
+ status_ = BREWED; // do it only once.
for (int i=0; i < dependency_size(); i++)
- dependency (i)->molecule_processing();
+ dependency (i)->molecule_processing();
Link_array<Score_elem> extra (get_extra_dependencies());
for (int i=0; i < extra.size(); i++)
- extra[i]->molecule_processing();
+ extra[i]->molecule_processing();
if (transparent_b_)
- return ;
+ return ;
output= brew_molecule_p();
}
+String
+Score_elem::TeX_output_str() const
+{
+ String s;
+ if (status_ >= TEXOUTPUT)
+ return "";
+
+ ((Score_elem*)this)->status_ = TEXOUTPUT;
+
+ for (int i=0; i < dependency_size(); i++)
+ s += dependency (i)->TeX_output_str();
+
+ Link_array<Score_elem> extra (get_extra_dependencies());
+ for (int i=0; i < extra.size(); i++)
+ s += extra[i]->TeX_output_str ();
+
+ if (!transparent_b_)
+ s+= do_TeX_output_str();
+
+ return s;
+}
+
/*
VIRTUAL STUBS
void
Score_elem::do_unlink()
-{}
+{
+}
+
+void
+Score_elem::do_junk_links()
+{
+}
IMPLEMENT_IS_TYPE_B(Score_elem);
Molecule*
-Score_elem::brew_molecule_p()const
+Score_elem::brew_molecule_p() const
{
Atom a (paper()->lookup_l ()->fill (Box (Interval (0,0), Interval (0,0))));
return new Molecule (a);
Line_of_score *
-Score_elem::line_l()const
+Score_elem::line_l() const
{
return 0;
}
old->do_substitute_dependent (this, 0);
}
-void
-Score_elem::junk_dependencies()
-{
- while ( dependency_size())
- {
- remove_edge_out (dependency (0));
- }
-}
-
void
Score_elem::handle_broken_dependencies()
{
Line_of_score *line = line_l();
if (!line)
- return;
+ return;
Link_array<Score_elem> remove_us_arr;
for (int i=0; i < dependency_size(); i++)
{
- Score_elem * elt = dependency (i);
- if (elt->line_l() != line)
- {
- if (elt->spanner())
- {
- Spanner * sp = elt->spanner();
- Spanner * broken = sp->find_broken_piece (line);
- substitute_dependency (sp, broken);
-
- add_dependency (broken);
- }
- else if (elt->item() && elt->item ()->pcol_l_->breakpoint_b ()
- && elt->item()->break_status_i () == 0)
- {
- Item * my_item = elt->item()->find_prebroken_piece (line);
- substitute_dependency (elt, my_item);
- if (my_item)
- add_dependency (my_item);
- }
- remove_us_arr.push (elt);
- }
+ Score_elem * elt = dependency (i);
+ if (elt->line_l() != line)
+ {
+ if (elt->spanner())
+ {
+ Spanner * sp = elt->spanner();
+ Spanner * broken = sp->find_broken_piece (line);
+ substitute_dependency (sp, broken);
+
+ add_dependency (broken);
+ }
+ else if (elt->item())
+ {
+ Item * my_item = elt->item()->find_prebroken_piece (line);
+
+ substitute_dependency (elt, my_item);
+ if (my_item)
+ add_dependency (my_item);
+ }
+ remove_us_arr.push (elt);
+ }
}
remove_us_arr.default_sort();
remove_us_arr.uniq();
for (int i=0; i <remove_us_arr.size(); i++)
- remove_dependency (remove_us_arr[i]);
+ remove_dependency (remove_us_arr[i]);
status_ = BROKEN;
}
for (int i=0; i < dependency_size(); i++)
{
- Score_elem * elt = dependency (i);
- Item *it_l = elt->item();
- if (it_l && it_l->breakable_b_)
- if (item())
- {
- Score_elem *new_l = it_l->find_prebroken_piece (item()->pcol_l_);
- if (new_l != elt)
- {
- new_arr.push (new_l);
- old_arr.push (elt);
- }
- }else
+ Score_elem * elt = dependency (i);
+ Item *it_l = elt->item();
+ if (it_l && it_l->breakable_b_)
+ if (item())
+ {
+ Score_elem *new_l = it_l->find_prebroken_piece (item()->break_status_i_);
+ if (new_l != elt)
{
- new_arr.push (it_l->broken_to_a_[0]);
- old_arr.push (0);
- old_arr.push (0);
- new_arr.push (it_l->broken_to_a_[1]);
+ new_arr.push (new_l);
+ old_arr.push (elt);
}
+ }
+ else
+ {
+ new_arr.push (it_l->broken_to_drul_[LEFT]);
+ old_arr.push (0);
+ old_arr.push (0);
+ new_arr.push (it_l->broken_to_drul_[RIGHT]);
+ }
}
for (int i=0; i < old_arr.size(); i++)
- if (old_arr[i])
- substitute_dependency (old_arr[i], new_arr[i]);
+ if (old_arr[i])
+ substitute_dependency (old_arr[i], new_arr[i]);
status_ = PREBROKEN;
Score_elem::unlink_all()
{
for (int i=0; i < dependency_size(); i++)
- dependency (i)->unlink_all();
+ dependency (i)->unlink_all();
Link_array<Score_elem> extra (get_extra_dependencies());
for (int i=0; i < extra.size(); i++)
- extra[i]->unlink_all();
+ extra[i]->unlink_all();
junk_links();
- axis_group_l_a_[0] = axis_group_l_a_[1] =0;
+ axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0;
+ do_unlink();
}
void
Score_elem::unlink()
{
do_unlink();
- while ( dependency_size())
+ while (dependency_size())
{
- do_substitute_dependency (dependency (0),0);
- remove_edge_out_idx (0);
+ do_substitute_dependency (dependency (0),0);
+ remove_edge_out_idx (0);
}
- while ( dependent_size())
+ while (dependent_size())
{
- dependent (0)->remove_dependency (this);
+ dependent (0)->remove_dependency (this);
}
for (int j=0; j < 2; j++)
- if ( axis_group_l_a_[j])
- axis_group_l_a_[j]->remove_element (this);
+ if (axis_group_l_a_[j])
+ axis_group_l_a_[j]->remove_element (this);
}
void
-Score_elem::OK()const
+Score_elem::OK() const
{
#ifndef NDEBUG
for (int i=0; i < dependency_size(); i++)
{
- dependency (i)->OK();
+ dependency (i)->OK();
}
#endif
}
Link_array<Score_elem>
-Score_elem::get_extra_dependencies()const
+Score_elem::get_extra_dependencies() const
{
Link_array<Score_elem> empty;
return empty;
}
+
+bool
+Score_elem::linked_b() const
+{
+ return get_extra_dependencies().size() ||
+ dependency_size();
+}
#include "command-request.hh"
-void
-Score_engraver::set_score (Score *s)
-{
- Global_translator::set_score (s);
- scoreline_l_ = s->pscore_p_->super_elem_l_->line_of_score_l_;
-}
-
Score_engraver::Score_engraver()
{
disallow_break_b_ = false;
command_column_l_ =0;
musical_column_l_ =0;
breaks_i_ =0;
+ pscore_p_ = 0;
}
-
void
Score_engraver::prepare (Moment w)
{
set_columns (new Score_column (w), new Score_column (w));
-
disallow_break_b_ = false;
post_move_processing();
}
void
Score_engraver::finish()
{
- if ( (breaks_i_%8))
- *mlog << "[" << breaks_i_ << "]" << flush;
+ if ((breaks_i_%8))
+ *mlog << "[" << breaks_i_ << "]" << flush;
check_removal();
removal_processing();
void
Score_engraver::do_creation_processing()
{
- scoreline_l_->left_col_l_ = get_staff_info().command_pcol_l ();
- scoreline_l_->left_col_l_ ->set_breakable();
+ scoreline_l_ = pscore_p_->super_elem_l_->line_of_score_l_;
+ scoreline_l_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
+ command_column_l_->breakable_b_ = true;
Engraver_group_engraver::do_creation_processing();
}
Score_engraver::do_removal_processing()
{
Engraver_group_engraver::do_removal_processing();
- scoreline_l_->right_col_l_ = get_staff_info().command_pcol_l ();
- scoreline_l_->right_col_l_ ->set_breakable();
- typeset_all();
+ scoreline_l_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
+ command_column_l_->breakable_b_ = true;
+
+ typeset_all ();
set_columns (0,0);
}
void
Score_engraver::process()
{
- process_requests();
- do_announces();
- pre_move_processing();
- check_removal();
+ process_requests();
+ do_announces();
+ pre_move_processing();
+ check_removal();
}
void
{
announce_info_arr_.push (info);
info.origin_grav_l_arr_.push (this);
-
}
+
void
Score_engraver::do_announces()
{
/* All elements are propagated to the top upon announcement. If
- something was created during one run of
- Engraver_group_engraver::do_announces, then
- announce_info_arr_.size() will be nonzero again
+ something was created during one run of
+ Engraver_group_engraver::do_announces, then
+ announce_info_arr_.size() will be nonzero again
- */
+ */
while (announce_info_arr_.size())
{
- for (int i=0; i <announce_info_arr_.size(); i++)
- /*
- TODO
+ for (int i=0; i < announce_info_arr_.size(); i++)
+ /*
+ TODO
- More subtle spacing
- */
- if (announce_info_arr_[i].req_l_)
+ More subtle spacing
+ */
+ if (announce_info_arr_[i].req_l_)
+ {
+ Musical_req *m = announce_info_arr_[i].req_l_->musical();
+ if (m && m->rhythmic())
{
- Musical_req *m = announce_info_arr_[i].req_l_->musical();
- if (m && m->rhythmic())
- {
- musical_column_l_->add_duration (m->duration());
- }
+ musical_column_l_->add_duration (m->duration());
}
- Engraver_group_engraver::do_announces();
+ }
+ Engraver_group_engraver::do_announces();
}
}
void
Score_engraver::typeset_element (Score_elem *elem_p)
{
- if ( elem_p->item() && elem_p->item ()->breakable_b_)
- {
- nobreak_item_p_arr_.push (elem_p->item());
- }
- else
- musical_item_p_arr_.push (elem_p);
+ elem_p_arr_.push(elem_p);
}
void
Score_engraver::typeset_all()
{
- PCol * c= get_staff_info().command_pcol_l ();
- Paper_score *ps_l = score_l_->pscore_p_;
-
- for (int i =0; i < nobreak_item_p_arr_.size(); i++)
- {
- ps_l->typeset_item (nobreak_item_p_arr_[i], c);
-
- // should get rid of this.. .
- scoreline_l_->add_dependency (nobreak_item_p_arr_[i]);
- }
- nobreak_item_p_arr_.clear();
-
- for (int i=0; i < musical_item_p_arr_.size(); i++)
+ for (int i =0; i < elem_p_arr_.size(); i++)
{
- PCol* m = get_staff_info().musical_pcol_l ();
- Score_elem *elem_p = musical_item_p_arr_[i];
-
- scoreline_l_->add (elem_p);
- if (elem_p->spanner())
- {
- ps_l->typeset_unbroken_spanner (elem_p->spanner());
- }
- else if (elem_p->item())
- {
- ps_l->typeset_item (elem_p->item(), m);
+ Score_elem * elem_p = elem_p_arr_[i];
+ if (elem_p->spanner())
+ pscore_p_->typeset_unbroken_spanner (elem_p->spanner());
+ else
+ {
+ Item *item_p = elem_p->item();
+ pscore_p_->typeset_element (item_p);
+ if (!item_p->axis_group_l_a_[X_AXIS]) {
+ if (item_p->breakable_b_)
+ command_column_l_->add_element(item_p);
+ else
+ musical_column_l_->add_element(item_p);
}
- else
- assert (false);
+ }
+ scoreline_l_->add (elem_p);
}
- musical_item_p_arr_.clear();
+ elem_p_arr_.clear();
}
-
void
Score_engraver::do_pre_move_processing()
{
- if ( !disallow_break_b_)
+ if (!disallow_break_b_)
{
- get_staff_info().command_pcol_l ()->set_breakable ();
- breaks_i_ ++;
- if ( ! (breaks_i_%8))
- *mlog << "[" << breaks_i_ << "]" << flush;
+ get_staff_info().command_pcol_l ()-> breakable_b_ = true;
+ breaks_i_ ++;
+ if (! (breaks_i_%8))
+ *mlog << "[" << breaks_i_ << "]" << flush;
}
// this generates all items.
Engraver_group_engraver::do_pre_move_processing();
void
Score_engraver::set_columns (Score_column *new_command_l,
- Score_column *new_musical_l)
+ Score_column *new_musical_l)
{
- if ( command_column_l_ && command_column_l_->used_b())
- score_l_->pscore_p_->add (command_column_l_);
+ if (command_column_l_ && command_column_l_->linked_b())
+ {
+ pscore_p_->add_column (command_column_l_);
+ scoreline_l_->add (command_column_l_);
+ }
else
{
- delete command_column_l_ ;
- command_column_l_ =0;
+ delete command_column_l_ ;
+ command_column_l_ =0;
}
if (new_command_l)
{
- command_column_l_ = new_command_l;
- command_column_l_->musical_b_ = false;
+ command_column_l_ = new_command_l;
+ command_column_l_->musical_b_ = false;
+ }
+ if (musical_column_l_ && musical_column_l_->linked_b())
+ {
+ pscore_p_->add_column (musical_column_l_);
+ scoreline_l_->add (musical_column_l_);
}
- if ( musical_column_l_ && musical_column_l_->used_b())
- score_l_->pscore_p_->add (musical_column_l_);
else
{
- delete musical_column_l_;
- musical_column_l_ = 0;
+ delete musical_column_l_;
+ musical_column_l_ = 0;
}
if (new_musical_l)
{
- musical_column_l_ = new_musical_l;
- musical_column_l_->musical_b_ = true;
+ musical_column_l_ = new_musical_l;
+ musical_column_l_->musical_b_ = true;
}
}
Staff_info
-Score_engraver::get_staff_info()const
+Score_engraver::get_staff_info() const
{
- Staff_info inf;
+ Staff_info inf = Engraver_group_engraver::get_staff_info();
inf.command_l_ = command_column_l_;
inf.musical_l_ = musical_column_l_;
+
return inf;
}
Paper_def*
-Score_engraver::paper()const
+Score_engraver::paper() const
{
- return score_l_->paper_p_;
+ return pscore_p_->paper_l_;
}
+Music_output*
+Score_engraver::get_output_p ()
+{
+ Music_output * o = pscore_p_;
+ pscore_p_=0;
+ return o;
+}
bool
Score_engraver::do_try_request (Request*r)
{
bool gotcha = Engraver_group_engraver::do_try_request (r);
- if ( !gotcha && r->command() && r->command ()->disallowbreak ())
- disallow_break_b_ = true;
+ if (!gotcha && r->command() && r->command ()->disallowbreak ())
+ disallow_break_b_ = true;
return gotcha;
}
IMPLEMENT_IS_TYPE_B1(Score_engraver,Engraver_group_engraver);
ADD_THIS_ENGRAVER(Score_engraver);
+
}
-void
-Score_performer::finish()
-{
- Performer_group_performer::do_removal_processing();
-}
-
void
Score_performer::play (Audio_element * p)
}
else if (p->is_type_b (Audio_staff::static_name()))
{
- score_l_->audio_score_p_->add_staff ((Audio_staff*)p);
+ performance_p_->add_staff ((Audio_staff*)p);
}
- score_l_->audio_score_p_->add (p);
+ performance_p_->add (p);
}
{
now_mom_ = m;
audio_column_l_ = new Audio_column (m);
- score_l_->audio_score_p_->add (audio_column_l_);
+ performance_p_->add (audio_column_l_);
}
}
+
void
-Score_performer::set_score (Score* score_l)
+Score_performer::start()
{
- Global_translator::set_score (score_l);
}
-void
-Score_performer::start()
+int
+Score_performer::get_tempo_i() const
{
+ return performance_p_->midi_l_->get_tempo_i (Moment (1, 4));
}
+void
+Score_performer::finish()
+{
+ Performer_group_performer::do_removal_processing();
+}
-int
-Score_performer::get_tempo_i()const
+Music_output *
+Score_performer::get_output_p ()
{
- return score_l_->midi_p_->get_tempo_i (Moment (1, 4));
+ Music_output * o = performance_p_;
+ performance_p_ =0;
+ return o;
}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-#include "tex-stream.hh"
#include "score.hh"
-#include "score-column.hh"
-#include "p-score.hh"
#include "debug.hh"
-#include "paper-def.hh"
+#include "music-output-def.hh"
+#include "music-output.hh"
#include "main.hh"
#include "source.hh"
#include "source-file.hh"
-#include "midi-def.hh"
-#include "midi-stream.hh"
-#include "audio-score.hh"
-#include "p-col.hh"
#include "music-iterator.hh"
#include "music.hh"
#include "global-translator.hh"
{
header_p_ = 0;
music_p_ = 0;
- pscore_p_ = 0;
- audio_score_p_ = 0;
- paper_p_ = 0;
- midi_p_ = 0;
errorlevel_i_ = 0;
}
Score::Score (Score const &s)
{
- assert (!pscore_p_);
music_p_ = s.music_p_->clone();
- midi_p_ = new Midi_def (*s.midi_p_);
- paper_p_ = new Paper_def (*s.paper_p_);
+ for (int i=0; i < s.def_p_arr_.size (); i++)
+ def_p_arr_.push(s.def_p_arr_[i]->clone());
header_p_ = new Header (*s.header_p_);
}
Score::~Score()
{
delete header_p_;
+ for (int i=0; i < def_p_arr_.size (); i++)
+ delete def_p_arr_[i];
delete music_p_;
- delete pscore_p_;
- delete audio_score_p_;
- delete paper_p_;
- delete midi_p_;
}
void
-Score::run_translator (Global_translator * trans_l)
+Score::run_translator (Music_output_def *odef_l)
{
- trans_l->set_score (this);
+ Global_translator * trans_p = odef_l->get_global_translator_p();
+ if (!trans_p)
+ return ;
+
+ *mlog << "\nInterpreting music ...";
+ trans_p->last_mom_ = music_p_->time_int().max ();
+
Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_,
- trans_l);
+ trans_p);
iter->construct_children();
- if ( ! iter->ok())
+ if (! iter->ok())
{
- delete iter;
- warning ("Need music in a score");
- errorlevel_i_ =1;
- return ;
+ delete iter;
+ warning ("Need music in a score");
+ errorlevel_i_ =1;
+ return ;
}
- trans_l->start();
+ trans_p->start();
- while ( iter->ok() || trans_l->moments_left_i ())
+ while (iter->ok() || trans_p->moments_left_i ())
{
- Moment w = infinity_mom;
- if (iter->ok())
- {
- w = iter->next_moment();
- DOUT << w;
- iter->print();
- }
- trans_l->modify_next (w);
- trans_l->prepare (w);
- trans_l->print();
-
- iter->process_and_next (w);
- trans_l->process();
+ Moment w = infinity_mom;
+ if (iter->ok())
+ {
+ w = iter->next_moment();
+ DOUT << "proccing: " << w <<"\n";
+ iter->print();
+ }
+ trans_p->modify_next (w);
+ trans_p->prepare (w);
+ trans_p->print();
+
+ iter->process_and_next (w);
+ trans_p->process();
}
delete iter;
- trans_l->finish();
-}
+ trans_p->finish();
-void
-Score::process()
-{
- print();
- paper();
- midi();
-}
-
-void
-Score::midi()
-{
- if ( !midi_p_)
- return;
-
- *mlog << "\nCreating MIDI elements ..." << flush;
- audio_score_p_ = new Audio_score (this);
-
- Global_translator* score_trans= midi_p_->get_global_translator_p();
- run_translator (score_trans);
- delete score_trans;
-
- if (errorlevel_i_)
- {
- // should we? hampers debugging.
- warning ("Errors found, /*not processing score*/");
- }
- *mlog << endl;
-
- midi_output();
-}
-
-void
-Score::paper()
-{
- if (!paper_p_)
- return;
-
- *mlog << "\nCreating elements ..." << flush;
- pscore_p_ = new Paper_score (paper_p_);
-
- Global_translator * score_trans= paper_p_->get_global_translator_p();
- run_translator (score_trans);
- delete score_trans;
if (errorlevel_i_)
{
- // should we? hampers debugging.
- warning ("Errors found, /*not processing score*/");
+ // should we? hampers debugging.
+ warning ("Errors found, /*not processing score*/");
}
+
+ Music_output * output = trans_p->get_output_p();
+ delete trans_p;
+
+ output->header_l_ = header_p_;
+ output->default_out_str_ = default_out_fn;
+ output->origin_str_ = location_str();
*mlog << endl;
- pscore_p_->process();
-
- // output
- paper_output();
+ output->process();
+ delete output ;
}
void
-Score::midi_output()
+Score::process()
{
- if ( midi_p_->outfile_str_ == "")
- midi_p_->outfile_str_ = default_out_fn + ".midi";
-
- Midi_stream midi_stream (midi_p_->outfile_str_);
- *mlog << "MIDI output to " << midi_p_->outfile_str_ << " ..." << endl;
+ if (!music_p_)
+ return;
- audio_score_p_->output (midi_stream);
- *mlog << endl;
+ print();
+ for (int i=0; i < def_p_arr_.size (); i++)
+ run_translator (def_p_arr_[i]);
}
-void
-Score::paper_output()
-{
- if (paper_p_->outfile_str_=="")
- paper_p_->outfile_str_ = default_out_fn + ".tex";
- if ( errorlevel_i_)
- {
- *mlog << "lilypond: warning: no output to: " << paper_p_->outfile_str_
- << " (errorlevel=" << errorlevel_i_ << ")" << endl;
- return;
- }
- *mlog << "TeX output to " << paper_p_->outfile_str_ << " ...\n";
-
- Tex_stream the_output (paper_p_->outfile_str_);
-
- the_output << "% outputting Score, defined at: " <<
- location_str() << "\n";
- if (header_p_) {
- the_output << header_p_->TeX_string();
- }
- pscore_p_->output (the_output);
-}
void
Score::print() const
{
#ifndef NPRINT
DOUT << "score {\n";
- music_p_->print();
- if (midi_p_)
- midi_p_->print();
-
+ for (int i=0; i < def_p_arr_.size (); i++)
+ def_p_arr_[i]->print();
DOUT << "}\n";
#endif
}
void
-Score::set (Paper_def *pap_p)
+Score::add (Music_output_def *pap_p)
{
- delete paper_p_;
- paper_p_ = pap_p;
+ def_p_arr_.push(pap_p);
}
-void
-Score::set (Midi_def* midi_p)
-{
- delete midi_p_;
- midi_p_ = midi_p;
-}
+
take out hard coded TeX stuff.
*/
String
-Line_of_score::TeX_string() const
+Line_of_score::TeX_output_str () const
{
- String s ("\\hbox{%<- line of score\n");
- if (error_mark_b_)
- s+= "\\scorelineerrormark";
-
-
- Real lastpos = cols[0]->hpos_f_;
- for (int i=0; i < cols.size(); i++)
- {
- PCol* col_l= cols[i];
- // all items in the current line & staff.
- String chunk_str;
-
-
- Link_array<Score_elem> elems;
-
- if (col_l->error_mark_b_)
- {
- chunk_str += String ("\\columnerrormark");
- }
-
- // now output the items.
- for (iter_top (col_l->its,j); j.ok(); j++)
- {
- elems.push (j);
- }
-
- // spanners.
- for (iter_top (col_l->starters,j); j.ok(); j++)
- {
- if (j->name() != name ())
- elems.push (j);
- }
-
- for (int j =0; j< elems.size(); j++)
- {
- Offset o = elems[j]->absolute_offset();
- o[X_AXIS] += cols[i]->hpos_f_;
- s += elems[j]->TeX_string_without_offset (o);
- }
- }
- s += "}";
- return s;
+ String s ("\\hbox{%<- line of score\n");
+ if (error_mark_b_)
+ s+= "\\scorelineerrormark";
+
+ s+= Score_elem::TeX_output_str();
+ s += "}";
+ return s;
}
}
-
-
-
IMPLEMENT_IS_TYPE_B1(Line_of_score,Spanner);
void
Line_of_score::add (Score_elem*e)
{
// avoid excess dependencies.
- if (!( e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
- add_dependency (e);
+ if (!(e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
+ add_dependency (e);
}
bool
-Line_of_score::contains_b (PCol const* c)const
+Line_of_score::contains_b (Paper_column const* c) const
{
- return cols.find_l ((PCol*)c);
+ return cols.find_l ((Paper_column*)c);
}
void
{
for (int j=0; j < breaking.size(); j++)
{
- const Array<PCol*> &curline (breaking[j].cols);
- const Array<PCol*> &errors (breaking[j].error_col_l_arr_);
- const Array<Real> &config (breaking[j].config);
+ const Array<Paper_column*> &curline (breaking[j].cols);
+ const Array<Paper_column*> &errors (breaking[j].error_col_l_arr_);
+ const Array<Real> &config (breaking[j].config);
- for (int i=0; i < errors.size(); i++)
- errors[i]->error_mark_b_ = true;
+ for (int i=0; i < errors.size(); i++)
+ errors[i]->error_mark_b_ = true;
- Line_of_score *line_l=0;
- Line_of_score *line_p =0;
-
- if (breaking.size() >1)
- {
- line_p = (Line_of_score*)clone()->spanner ();
- line_p->copy_dependencies (*this);
- line_l = line_p;
- }
- else
- line_l = this;
+ Line_of_score *line_l=0;
+ Line_of_score *line_p =0;
- ((Array<PCol*> &)line_l->cols) = curline;
- line_l->left_col_l_ = curline[0];
- line_l->right_col_l_= curline.top();
+ if (breaking.size() >1)
+ {
+ line_p = (Line_of_score*)clone()->spanner ();
+ line_l = line_p;
+ }
+ else
+ line_l = this;
- if (line_p)
- {
- pscore_l_->typeset_broken_spanner (line_p);
- broken_into_l_arr_.push (line_p);
- }
+ ((Array<Paper_column*> &)line_l->cols) = curline;
+ line_l->set_bounds(LEFT,curline[0]);
+
+ line_l->set_bounds(RIGHT,curline.top());
- for (int i=0; i < curline.size(); i++)
- {
- curline[i]->hpos_f_ = config[i];
- curline[i]->line_l_ = (Line_of_score*)line_l;
- }
+ if (line_p)
+ {
+ pscore_l_->typeset_broken_spanner (line_p);
+ broken_into_l_arr_.push (line_p);
+ }
+
+ for (int i=0; i < curline.size(); i++)
+ {
+ curline[i]->translate(config[i],X_AXIS);
+ curline[i]->line_l_ = (Line_of_score*)line_l;
+ }
}
}
+
void
Line_of_score::break_into_pieces (bool)
{
+
}
Link_array<Line_of_score>
-Line_of_score::get_lines()const
+Line_of_score::get_lines() const
{
Link_array<Line_of_score> ret;
if (broken_into_l_arr_.size())
- for (int i=0; i < broken_into_l_arr_.size(); i++)
- {
- ret.push ((Line_of_score*)broken_into_l_arr_[i]);
- }
+ for (int i=0; i < broken_into_l_arr_.size(); i++)
+ {
+ ret.push ((Line_of_score*)broken_into_l_arr_[i]);
+ }
else
- ret.push ((Line_of_score*)this); // ugh
+ ret.push ((Line_of_score*)this); // ugh
return ret;
}
void
-Line_of_score::do_print()const
+Line_of_score::do_print() const
{
Spanner::do_print();
}
Interval
-Line_of_score::do_width()const
+Line_of_score::do_width() const
{
return Spanner::do_width();
}
+
+void
+Line_of_score::do_breakable_col_processing()
+{
+ for (int i=0; i < cols.size (); i++)
+ cols[i]->breakable_col_processing();
+ Spanner::do_breakable_col_processing();
+}
{
Score *&is_p = score_array_global[i];
- if (only_midi)
- {
- delete is_p->paper_p_;
- is_p->paper_p_ = 0;
- }
if (is_p->errorlevel_i_)
{
void
-Script_column::do_print()const
+Script_column::do_print() const
{
#ifndef NPRINT
DOUT << "scripts: " << script_l_arr_.size() << '\n';
idx (bool inside, int dir)
{
int j = (dir+1);
- if ( !inside)
- j ++;
+ if (!inside)
+ j ++;
return j;
}
Script_column::do_pre_processing()
{
if (!script_l_arr_.size())
- return;
+ return;
/* up+inside, up+outside, down+inside, down+outside */
Array<Script*> placed_l_arr_a[4];
for (int i=0; i < script_l_arr_.size(); i++)
{
- Script*s_l = script_l_arr_[i];
- placed_l_arr_a[idx (s_l->inside_staff_b_ , s_l->dir_i_) ].push (s_l);
+ Script*s_l = script_l_arr_[i];
+ placed_l_arr_a[idx (s_l->inside_staff_b_ , s_l->dir_) ].push (s_l);
}
for (int j =0; j <4; j++)
{
- placed_l_arr_a[j].sort (Script::compare);
+ placed_l_arr_a[j].sort (Script::compare);
}
for (int j =0; j < 4; j++)
{
- if (placed_l_arr_a[j].size())
- for (int i=0; i < support_l_arr_.size(); i++)
- placed_l_arr_a[j][0]->add_support (support_l_arr_[i]);
+ if (placed_l_arr_a[j].size())
+ for (int i=0; i < support_l_arr_.size(); i++)
+ placed_l_arr_a[j][0]->add_support (support_l_arr_[i]);
}
Item * support_l=0;
int j = 0;
for (; j < 2; j++)
{
- for (int i=0; i < placed_l_arr_a[j].size(); i++)
- {
- if (support_l)
- placed_l_arr_a[j][i]->add_support (support_l);
- support_l = placed_l_arr_a[j][i];
- }
+ for (int i=0; i < placed_l_arr_a[j].size(); i++)
+ {
+ if (support_l)
+ placed_l_arr_a[j][i]->add_support (support_l);
+ support_l = placed_l_arr_a[j][i];
+ }
}
support_l = 0;
for (; j < 4; j++)
{
- for (int i=0; i < placed_l_arr_a[j].size(); i++)
- {
- if (support_l)
- placed_l_arr_a[j][i]->add_support (support_l);
- support_l = placed_l_arr_a[j][i];
- }
+ for (int i=0; i < placed_l_arr_a[j].size(); i++)
+ {
+ if (support_l)
+ placed_l_arr_a[j][i]->add_support (support_l);
+ support_l = placed_l_arr_a[j][i];
+ }
}
}
{
if (o->item())
{
- script_l_arr_.substitute ((Script*)o->item(),(Script*) (n?n->item ():0));
- support_l_arr_.substitute (o->item(), (n?n->item ():0));
+ script_l_arr_.substitute ((Script*)o->item(),(Script*) (n?n->item ():0));
+ support_l_arr_.substitute (o->item(), (n?n->item ():0));
}
}
{
inside_staff_b_ = false;
symidx_str_ = "unknown" ;
- rel_stem_dir_i_ =0;
- staff_dir_i_ = -1;
+ rel_stem_dir_ =CENTER;
+ staff_dir_ = DOWN;
invertsym_b_ = 0;
priority_i_ =0;
}
{
inside_staff_b_ = follow;
symidx_str_ = idx ;
- rel_stem_dir_i_ =stem;
- staff_dir_i_ = staff;
+ rel_stem_dir_ =Direction(stem);
+ staff_dir_ = Direction(staff);
invertsym_b_ = invert;
priority_i_ =priority_i;
}
{
#ifndef NPRINT
DOUT << "Script_def{ idx: " << symidx_str_
- << " direction, stem: " << rel_stem_dir_i_ << " staff : " << staff_dir_i_ << "}\n";
+ << " direction, stem: " << rel_stem_dir_ << " staff : " << staff_dir_ << "}\n";
#endif
}
bool
-Script_def::do_equal_b (General_script_def const *g)const
+Script_def::do_equal_b (General_script_def const *g) const
{
Script_def const * c = (Script_def const*) g;
return (symidx_str_ == c->symidx_str_ &&
- rel_stem_dir_i_ == c->rel_stem_dir_i_&&
- staff_dir_i_ == c->staff_dir_i_&&
- invertsym_b_ == c->invertsym_b_);
+ rel_stem_dir_ == c->rel_stem_dir_&&
+ staff_dir_ == c->staff_dir_&&
+ invertsym_b_ == c->invertsym_b_);
}
-int
-Script_def::staff_dir_i() const
+Direction
+Script_def::staff_dir() const
{
- return staff_dir_i_;
+ return staff_dir_;
}
-int
-Script_def::rel_stem_dir_i() const
+Direction
+Script_def::rel_stem_dir() const
{
- return rel_stem_dir_i_;
+ return rel_stem_dir_;
}
bool
}
Atom
-Script_def::get_atom (Paper_def *p , int d)const
+Script_def::get_atom (Paper_def *p , Direction d) const
{
String preidx_str ="";
if (invertsym_b_&& d < 0)
- preidx_str = "-";
+ preidx_str = "-";
return p->lookup_l()->script (preidx_str + symidx_str_);
}
IMPLEMENT_IS_TYPE_B1(Script_def,General_script_def);
int
-Script_def::priority_i()const
+Script_def::priority_i() const
{
return priority_i_;
}
Script_engraver::do_try_request (Request *r_l)
{
if (!r_l->musical() || ! r_l->musical ()->musicalscript ())
- return false ;
+ return false ;
for (int i=0; i < script_req_l_arr_.size(); i++)
{
- if ( r_l->equal_b (script_req_l_arr_[i]))
- return true;
+ if (r_l->equal_b (script_req_l_arr_[i]))
+ return true;
}
script_req_l_arr_.push (r_l->script());
{
for (int i=0; i < script_req_l_arr_.size(); i++)
{
- Script_req* l=script_req_l_arr_[i];
- Script *p =new Script;
- p->dir_i_ = l->dir_i_;
- p->specs_l_ = l->scriptdef_p_;
- script_p_arr_.push (p);
- announce_element (Score_elem_info (p, l));
+ Script_req* l=script_req_l_arr_[i];
+ Script *p =new Script;
+ p->dir_ = l->dir_;
+ p->specs_l_ = l->scriptdef_p_;
+ script_p_arr_.push (p);
+ announce_element (Score_elem_info (p, l));
}
}
Staff_symbol* s_l = get_staff_info().staff_sym_l_;
for (int i=0; i < script_p_arr_.size(); i++)
{
- Script*script_p = script_p_arr_[i];
- script_p->set_staffsym (s_l);
- typeset_element (script_p);
+ Script*script_p = script_p_arr_[i];
+ script_p->set_staffsym (s_l);
+ typeset_element (script_p);
}
script_p_arr_.clear();
}
Staff_side::do_substitute_dependency (o,n);
if (o == stem_l_)
{
- stem_l_ = n ? (Stem*)n->item() : 0;
+ stem_l_ = n ? (Stem*)n->item() : 0;
}
}
specs_l_ = 0;
inside_staff_b_ = false;
stem_l_ = 0;
- dir_i_ = 0;
+ dir_ = CENTER;
}
void
Script::set_default_dir()
{
- int s_i=specs_l_->rel_stem_dir_i();
+ int s_i=specs_l_->rel_stem_dir();
if (s_i)
{
- if (stem_l_)
- dir_i_ = stem_l_->dir_i_ * s_i;
- else
- {
- specs_l_->warning ("Script needs stem direction");
- dir_i_ = -1;
- }
+ if (stem_l_)
+ dir_ = stem_l_->dir_ * s_i;
+ else
+ {
+ specs_l_->warning ("Script needs stem direction");
+ dir_ = DOWN;
+ }
}
else
{
- dir_i_ =specs_l_->staff_dir_i();
+ dir_ =specs_l_->staff_dir();
}
- assert (dir_i_);
+ assert (dir_);
}
Interval
Script::do_width() const
{
- return specs_l_->get_atom (paper(), dir_i_).extent ().x ();
+ return specs_l_->get_atom (paper(), dir_).extent ().x ();
}
void
{
if (breakable_b_ && break_status_i() != 1)
{
- transparent_b_ = empty_b_ = true;
+ transparent_b_ = empty_b_ = true;
}
- if (!dir_i_)
- set_default_dir();
+ if (!dir_)
+ set_default_dir();
inside_staff_b_ = specs_l_->inside_b();
}
Interval
-Script::symbol_height()const
+Script::symbol_height() const
{
- return specs_l_->get_atom (paper(), dir_i_).extent ().y ();
+ return specs_l_->get_atom (paper(), dir_).extent ().y ();
}
Molecule*
{
Real dy = paper()->internote_f ();
- Molecule*out = new Molecule (specs_l_->get_atom (paper(), dir_i_));
+ Molecule*out = new Molecule (specs_l_->get_atom (paper(), dir_));
out->translate (dy * pos_i_, Y_AXIS);
return out;
}
{
Musical_req *mus_l = req_l->musical();
if (!mus_l || !mus_l->slur())
- return false;
+ return false;
new_slur_req_l_arr_.push (mus_l->slur());
return true;
{
if (info.elem_l_->name() == Note_column::static_name ())
{
- Note_column *col_l =(Note_column*) info.elem_l_->item() ;// ugh
- for (int i = 0; i < slur_l_stack_.size(); i++)
- slur_l_stack_[i]->add (col_l);
- for (int i = 0; i < end_slur_l_arr_.size(); i++)
- end_slur_l_arr_[i]->add (col_l);
+ Note_column *col_l =(Note_column*) info.elem_l_->item() ;// ugh
+ for (int i = 0; i < slur_l_stack_.size(); i++)
+ slur_l_stack_[i]->add (col_l);
+ for (int i = 0; i < end_slur_l_arr_.size(); i++)
+ end_slur_l_arr_[i]->add (col_l);
}
}
Slur_engraver::set_feature (Feature f)
{
if (f.type_ == "vdir")
- dir_i_ = f.value_ ;
+ dir_ = (Direction)int(f.value_);
}
/*
*/
Slur_engraver::Slur_engraver()
{
- dir_i_ =0;
+ dir_ =CENTER;
}
void
Slur_engraver::do_process_requests()
Array<Slur*> start_slur_l_arr_;
for (int i=0; i< new_slur_req_l_arr_.size(); i++)
{
- Slur_req* slur_req_l = new_slur_req_l_arr_[i];
- // end slur: move the slur to other array
- if (slur_req_l->spantype == Span_req::STOP)
- {
- if (slur_l_stack_.empty())
+ Slur_req* slur_req_l = new_slur_req_l_arr_[i];
+ // end slur: move the slur to other array
+ if (slur_req_l->spantype == Span_req::STOP)
+ {
+ if (slur_l_stack_.empty())
- slur_req_l->warning ("can't find slur to end");
- else
- {
- end_slur_l_arr_.push (slur_l_stack_.pop());
- requests_arr_.pop();
- }
- }
- else if (slur_req_l->spantype == Span_req::START)
- {
- // push a new slur onto stack.
- //(use temp. array to wait for all slur STOPs)
- Slur * s_p =new Slur;
- requests_arr_.push (slur_req_l);
- start_slur_l_arr_.push (s_p);
- announce_element (Score_elem_info (s_p, slur_req_l));
- }
+ slur_req_l->warning ("can't find slur to end");
+ else
+ {
+ end_slur_l_arr_.push (slur_l_stack_.pop());
+ requests_arr_.pop();
+ }
+ }
+ else if (slur_req_l->spantype == Span_req::START)
+ {
+ // push a new slur onto stack.
+ //(use temp. array to wait for all slur STOPs)
+ Slur * s_p =new Slur;
+ requests_arr_.push (slur_req_l);
+ start_slur_l_arr_.push (s_p);
+ announce_element (Score_elem_info (s_p, slur_req_l));
+ }
}
for (int i=0; i < start_slur_l_arr_.size(); i++)
- slur_l_stack_.push (start_slur_l_arr_[i]);
+ slur_l_stack_.push (start_slur_l_arr_[i]);
}
void
{
for (int i = 0; i < end_slur_l_arr_.size(); i++)
{
- if (dir_i_)
- end_slur_l_arr_[i]->dir_i_ = dir_i_;
- typeset_element (end_slur_l_arr_[i]);
+ if (dir_)
+ end_slur_l_arr_[i]->dir_ = dir_;
+ typeset_element (end_slur_l_arr_[i]);
}
end_slur_l_arr_.clear();
}
{
for (int i=0; i < requests_arr_.size(); i++)
{
- requests_arr_[i]->warning ("unterminated slur");
+ requests_arr_[i]->warning ("unterminated slur");
}
}
*/
/*
-
TODO:
think about crossing stems.
Begin and end should be treated as a Script.
-
*/
#include "slur.hh"
#include "scalar.hh"
void
Slur::set_default_dir()
{
- dir_i_ = -1;
+ dir_ = DOWN;
for (int i=0; i < encompass_arr_.size(); i ++)
{
- if (encompass_arr_[i]->dir_i_ < 0)
- {
- dir_i_ =1;
- break;
- }
+ if (encompass_arr_[i]->dir_ < 0)
+ {
+ dir_ =UP;
+ break;
+ }
}
}
void
Slur::do_pre_processing()
{
- right_col_l_ = encompass_arr_.top()->pcol_l_;
- left_col_l_ = encompass_arr_[0]->pcol_l_;
+ set_bounds(LEFT, encompass_arr_[0]);
+ set_bounds(RIGHT, encompass_arr_.top());
}
int i;
while ((i = encompass_arr_.find_i ((Note_column*)o->item())) >=0)
{
- if (n)
- encompass_arr_[i] = (Note_column*)n->item();
- else
- encompass_arr_.del (i);
+ if (n)
+ encompass_arr_[i] = (Note_column*)n->item();
+ else
+ encompass_arr_.del (i);
}
}
static int
Note_column_compare (Note_column *const&n1 , Note_column* const&n2)
{
- return n1->pcol_l_->rank_i() - n2->pcol_l_->rank_i ();
+ return Item::left_right_compare(n1, n2);
}
void
Slur::do_post_processing()
{
encompass_arr_.sort (Note_column_compare);
- if (!dir_i_)
- set_default_dir();
+ if (!dir_)
+ set_default_dir();
Real inter_f = paper()->internote_f ();
- if (encompass_arr_[0]->stem_l_)
- left_pos_i_ = rint (encompass_arr_[0]->stem_l_->height()[dir_i_]/inter_f);
- else
- left_pos_i_ = rint ( encompass_arr_[0]->head_positions_interval()[dir_i_]);
-
- if (encompass_arr_.top()->stem_l_)
- right_pos_i_ = rint (encompass_arr_.top()->stem_l_->height ()[dir_i_]/inter_f);
- else
- right_pos_i_ = rint (encompass_arr_.top()->head_positions_interval ()[dir_i_]);
+ Drul_array<Note_column*> extrema;
+ extrema[LEFT] = encompass_arr_[0];
+ extrema[RIGHT] = encompass_arr_.top();
- left_pos_i_ += dir_i_;
- right_pos_i_ += dir_i_;
+ Direction d=LEFT;
+ do
+ {
+ if (extrema[d]->stem_l_ && !extrema[d]->stem_l_->transparent_b_)
+ pos_i_drul_[d] = (int)rint (extrema[d]->stem_l_->height()[dir_]/inter_f);
+ else
+ pos_i_drul_[d] = (int)rint (extrema[d]->head_positions_interval()[dir_]);
+ pos_i_drul_[d] += dir_;
+ }
+ while ((d *= -1) != LEFT);
}
IMPLEMENT_IS_TYPE_B1(Slur,Spanner);
}
Span_bar*
-Span_bar_engraver::get_span_bar_p()const
+Span_bar_engraver::get_span_bar_p() const
{
return new Span_bar;
}
Span_bar_engraver::acknowledge_element (Score_elem_info i)
{
int depth = i.origin_grav_l_arr_.size();
- if ( depth > 1
- && i.elem_l_->is_type_b (Bar::static_name()) )
- {
- bar_l_arr_.push ((Bar*)i.elem_l_->item());
+ if (depth > 1
+ && i.elem_l_->is_type_b (Bar::static_name()))
+ {
+ bar_l_arr_.push ((Bar*)i.elem_l_->item());
- if (bar_l_arr_.size() >= 2 && !spanbar_p_)
- {
- spanbar_p_ = get_span_bar_p();
- announce_element (Score_elem_info (spanbar_p_,0));
- }
+ if (bar_l_arr_.size() >= 2 && !spanbar_p_)
+ {
+ spanbar_p_ = get_span_bar_p();
+ announce_element (Score_elem_info (spanbar_p_,0));
+ }
}
else if (i.elem_l_->is_type_b (Vertical_align_spanner::static_name())
- && i.origin_grav_l_arr_.size() <= 2)
- {
- valign_l_ = (Vertical_align_spanner*)i.elem_l_->spanner();
+ && i.origin_grav_l_arr_.size() <= 2)
+ {
+ valign_l_ = (Vertical_align_spanner*)i.elem_l_->spanner();
}
}
{
if (spanbar_p_)
{
- for (int i=0; i < bar_l_arr_.size() ; i++)
- spanbar_p_->add (bar_l_arr_[i]);
- spanbar_p_->set (valign_l_);
- typeset_element (spanbar_p_);
- spanbar_p_ =0;
+ for (int i=0; i < bar_l_arr_.size() ; i++)
+ spanbar_p_->add (bar_l_arr_[i]);
+ spanbar_p_->set (valign_l_);
+ typeset_element (spanbar_p_);
+ spanbar_p_ =0;
}
bar_l_arr_.set_size (0);
void
Span_bar::do_pre_processing()
{
- if ( spanning_l_arr_.size() < 1)
+ if (spanning_l_arr_.size() < 1)
{
transparent_b_ = true;
empty_b_ =true;
transparent_b_=true;
empty_b_ = true;
}
- else if ( type_str_ == "|:")
+ else if (type_str_ == "|:")
{
type_str_ = ".|";
}
- else if ( type_str_ == ":|")
+ else if (type_str_ == ":|")
{
type_str_ = "|.";
}
Molecule*
-Span_bar::brew_molecule_p()const
+Span_bar::brew_molecule_p() const
{
Interval y_int;
for (int i=0; i < spanning_l_arr_.size(); i++)
Symbol s = get_bar_sym (y_int.length());
Molecule*output = new Molecule (Atom (s));
- output->translate ( y_int[-1], Y_AXIS);
+ output->translate (y_int[-1], Y_AXIS);
return output;
}
{
Span_bar::do_pre_processing();
- if ( break_status_i() != 1)
+ if (break_status_i() != 1)
{
empty_b_ = transparent_b_ = true;
}
Symbol
-Piano_brace::get_bar_sym (Real dy)const
+Piano_brace::get_bar_sym (Real dy) const
{
return paper()->lookup_l ()->vbrace (dy);
}
Interval
-Piano_brace::do_width()const
+Piano_brace::do_width() const
{
return Interval (0,0);
}
+++ /dev/null
-/*
- spanner-elem-group.cc -- implement Spanner_elem_group
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "p-col.hh"
-#include "spanner-elem-group.hh"
-
-
-
-IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group_element);
-
-Interval
-Spanner_elem_group::do_width() const
-{
- return Spanner::do_width();
-}
-
-void
-Spanner_elem_group::do_print() const
-{
-#ifndef NPRINT
- Spanner::do_print();
- Horizontal_vertical_group_element::do_print();
-#endif
-}
-
IMPLEMENT_IS_TYPE_B1(Spanner,Score_elem);
void
-Spanner::do_print()const
+Spanner::do_print() const
{
#ifndef NPRINT
DOUT << "Between col ";
- if ( left_col_l_)
- DOUT << left_col_l_->rank_i();
- else
- DOUT << "nop";
- DOUT << ", ";
- if ( right_col_l_)
- DOUT << right_col_l_->rank_i();
- else
- DOUT << "nop";
if (broken_into_l_arr_.size())
- DOUT << "with broken pieces\n";
+ DOUT << "with broken pieces\n";
#endif
}
void
-Spanner::break_into_pieces (bool copy_deps_b)
+Spanner::break_into_pieces ()
{
- if ( broken_into_l_arr_.size())
- return;
+ if (broken_into_l_arr_.size())
+ return;
- PCol * left = left_col_l_;
- PCol * right = right_col_l_;
- if (left->daddy_l_) left = left->daddy_l_;
- if (right->daddy_l_) right = right->daddy_l_;
+ Item * left = spanned_drul_[LEFT];
+ Item * right = spanned_drul_[RIGHT];
- Link_array<PCol> break_cols = pscore_l_->broken_col_range (left,right);
+ Link_array<Item> break_cols = pscore_l_->broken_col_range (left,right);
Link_array<Spanner> broken_into_l_arr;
break_cols.insert (left,0);
for (int i=1; i < break_cols.size(); i++)
{
- Spanner* span_p = clone()->spanner ();
- if (copy_deps_b)
- span_p->copy_dependencies (*this);
- left = break_cols[i-1];
- right = break_cols[i];
- if (!right->line_l_)
- right = right->prebreak_p_;
- if (!left->line_l_)
- left = left->postbreak_p_;
-
- assert (left&&right && left->line_l_ == right->line_l_);
-
- span_p->left_col_l_ = left;
- span_p->right_col_l_ = right;
+ Spanner* span_p = clone()->spanner ();
+ left = break_cols[i-1];
+ right = break_cols[i];
+ if (!right->line_l())
+ right = right->find_prebroken_piece(-1);
+ if (!left->line_l())
+ left = left->find_prebroken_piece(1);
+
+ assert (left&&right && left->line_l() == right->line_l());
+
+ span_p->set_bounds(LEFT,left);
+ span_p->set_bounds(RIGHT,right);
- pscore_l_->typeset_broken_spanner (span_p);
- broken_into_l_arr.push (span_p);
+ pscore_l_->typeset_broken_spanner (span_p);
+ broken_into_l_arr.push (span_p);
}
broken_into_l_arr_ = broken_into_l_arr;
void
Spanner::set_my_columns()
{
- if (!left_col_l_->line_l_)
- left_col_l_ = left_col_l_->postbreak_p_;
- if (!right_col_l_->line_l_)
- right_col_l_ = right_col_l_->prebreak_p_;
+ Direction i = (Direction)1;
+ do
+ {
+ if (!spanned_drul_[i]->line_l())
+ set_bounds(i,spanned_drul_[i]->find_prebroken_piece(-i));
+ }
+ while ((i*=-1) != 1);
}
+
void
-Spanner::do_break_processing()
+Spanner::set_bounds(Direction d, Item*i)
{
- set_my_columns();
+ if (spanned_drul_[d])
+ spanned_drul_[d]->attached_span_l_arr_.substitute(this,0);
- if (!line_l())
+ spanned_drul_[d] =i;
+ if (i)
+ i->attached_span_l_arr_.push(this);
+}
+
+void
+Spanner::do_break_processing()
+{
+ if (!line_l())
{
- break_into_pieces (true);
- for (int i=0; i < broken_into_l_arr_.size(); i++)
- broken_into_l_arr_[i]->handle_broken_dependencies();
+ break_into_pieces ();
+ for (int i=0; i < broken_into_l_arr_.size(); i++)
+ broken_into_l_arr_[i]->handle_broken_dependencies();
}
else
{
- handle_broken_dependencies();
+ handle_broken_dependencies();
}
}
Spanner::Spanner()
{
- left_col_l_ = right_col_l_ = 0;
+ spanned_drul_[LEFT]=0;
+ spanned_drul_[RIGHT]=0;
}
+String
+Spanner::do_TeX_output_str () const
+{
+ Offset left_off (spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), 0);
+ return make_TeX_string (absolute_offset() + left_off);
+}
Interval
-Spanner::do_width()const
+Spanner::do_width() const
{
- Real r = right_col_l_->hpos_f_;
- Real l = left_col_l_->hpos_f_;
- assert (*left_col_l_ < *right_col_l_);
+ Real l = spanned_drul_[LEFT]->absolute_coordinate (X_AXIS);
+ Real r = spanned_drul_[RIGHT]->absolute_coordinate (X_AXIS);
assert (r>=l);
return Interval (0, r-l);
}
Line_of_score *
-Spanner::line_l()const
+Spanner::line_l() const
{
- if ( left_col_l_->line_l_ != right_col_l_->line_l_)
- return 0;
- return left_col_l_->line_l_;
+ if (!spanned_drul_[LEFT] || !spanned_drul_[RIGHT])
+ return 0;
+ if (spanned_drul_[LEFT]->line_l() != spanned_drul_[RIGHT]->line_l())
+ return 0;
+ return spanned_drul_[LEFT]->line_l();
}
Spanner*
-Spanner::find_broken_piece (Line_of_score*l)const
+Spanner::find_broken_piece (Line_of_score*l) const
{
for (int i=0; i < broken_into_l_arr_.size(); i++)
- if (broken_into_l_arr_[i]->line_l() == l)
- return broken_into_l_arr_[i];
+ if (broken_into_l_arr_[i]->line_l() == l)
+ return broken_into_l_arr_[i];
return 0;
}
bool
-Spanner::broken_b()const
+Spanner::broken_b() const
{
return broken_into_l_arr_.size();
}
+
+void
+Spanner::do_unlink()
+{
+ if (spanned_drul_[LEFT])
+ {
+ spanned_drul_[LEFT]->attached_span_l_arr_.substitute (this,0);
+ spanned_drul_[LEFT] =0;
+ }
+ if (spanned_drul_[RIGHT])
+ {
+ spanned_drul_[RIGHT]->attached_span_l_arr_.substitute (this,0);
+ spanned_drul_[RIGHT] = 0;
+ }
+}
+
+void
+Spanner::do_junk_links()
+{
+ spanned_drul_[LEFT] = spanned_drul_[RIGHT] =0;
+}
Vector
-Spring_spacer::default_solution()const
+Spring_spacer::default_solution() const
{
- return try_initial_solution() ;
+ return try_initial_solution() ;
}
Score_column*
template class P<Real>; // ugh.
bool
-Spring_spacer::contains (PCol const *w)
+Spring_spacer::contains (Paper_column const *w)
{
for (int i=0; i< cols.size(); i++)
- if (cols[i].pcol_l_ == w)
- return true;
+ if (cols[i].pcol_l_ == w)
+ return true;
return false;
}
{
#ifndef NDEBUG
for (int i = 1; i < cols.size(); i++)
- assert (cols[i].rank_i_ > cols[i-1].rank_i_);
+ assert (cols[i].rank_i_ > cols[i-1].rank_i_);
for (int i = 1; i < loose_col_arr_.size(); i++)
- assert (loose_col_arr_[i].rank_i_ > loose_col_arr_[i-1].rank_i_);
+ assert (loose_col_arr_[i].rank_i_ > loose_col_arr_[i-1].rank_i_);
#endif
}
Array<int> fixed;
for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
{
- connected.connect (i->left_i_,i->right_i_);
+ connected.connect (i->left_i_,i->right_i_);
}
for (int i = 0; i < cols.size(); i++)
- if (cols[i].fixed())
- fixed.push (i);
+ if (cols[i].fixed())
+ fixed.push (i);
for (int i=1; i < fixed.size(); i++)
- connected.connect (fixed[i-1], fixed[i]);
+ connected.connect (fixed[i-1], fixed[i]);
for (int i = cols.size(); i--;)
{
- if (! connected.equiv (fixed[0], i))
- {
- warning ("unconnected column: " + String (i));
- loosen_column (i);
- }
+ if (! connected.equiv (fixed[0], i))
+ {
+ warning ("unconnected column: " + String (i));
+ loosen_column (i);
+ }
}
OK();
}
regular distances from enclosing calced columns
*/
void
-Spring_spacer::position_loose_cols (Vector &sol_vec)const
+Spring_spacer::position_loose_cols (Vector &sol_vec) const
{
if (!loose_col_arr_.size())
- return ;
+ return ;
assert (sol_vec.dim());
Array<bool> fix_b_arr;
fix_b_arr.set_size (cols.size() + loose_col_arr_.size ());
Real utter_left_f =infinity_f;
for (int i=0; i < loose_col_arr_.size(); i++)
{
- fix_b_arr[loose_col_arr_[i].rank_i_] = false;
+ fix_b_arr[loose_col_arr_[i].rank_i_] = false;
}
for (int i=0; i < cols.size(); i++)
{
- int r= cols[i].rank_i_;
- fix_b_arr[r] = true;
- utter_right_f = utter_right_f >? sol_vec (i);
- utter_left_f = utter_left_f <? sol_vec (i);
+ int r= cols[i].rank_i_;
+ fix_b_arr[r] = true;
+ utter_right_f = utter_right_f >? sol_vec (i);
+ utter_left_f = utter_left_f <? sol_vec (i);
}
Vector v (fix_b_arr.size());
int j =0;
int k =0;
for (int i=0; i < v.dim(); i++)
{
- if (fix_b_arr[i])
- {
- assert (cols[j].rank_i_ == i);
- v (i) = sol_vec (j++);
- }
- else
- {
- Real left_pos_f =
- (j>0) ?sol_vec (j-1) : utter_left_f;
- Real right_pos_f =
- (j < sol_vec.dim()) ? sol_vec (j) : utter_right_f;
- int left_rank = (j>0) ? cols[j-1].rank_i_ : 0;
- int right_rank = (j<sol_vec.dim()) ? cols[j].rank_i_ : sol_vec.dim ();
-
- int d_r = right_rank - left_rank;
- Colinfo loose=loose_col_arr_[k++];
- int r = loose.rank_i_ ;
- assert (r > left_rank && r < right_rank);
-
- v (i) = (r - left_rank)*left_pos_f/ d_r +
- (right_rank - r) *right_pos_f /d_r;
- }
+ if (fix_b_arr[i])
+ {
+ assert (cols[j].rank_i_ == i);
+ v (i) = sol_vec (j++);
+ }
+ else
+ {
+ Real left_pos_f =
+ (j>0) ?sol_vec (j-1) : utter_left_f;
+ Real right_pos_f =
+ (j < sol_vec.dim()) ? sol_vec (j) : utter_right_f;
+ int left_rank = (j>0) ? cols[j-1].rank_i_ : 0;
+ int right_rank = (j<sol_vec.dim()) ? cols[j].rank_i_ : sol_vec.dim ();
+
+ int d_r = right_rank - left_rank;
+ Colinfo loose=loose_col_arr_[k++];
+ int r = loose.rank_i_ ;
+ assert (r > left_rank && r < right_rank);
+
+ v (i) = (r - left_rank)*left_pos_f/ d_r +
+ (right_rank - r) *right_pos_f /d_r;
+ }
}
sol_vec = v;
}
for (int i=0; i < dim; i++)
{
- if (cols[i].fixed()&&
- abs (cols[i].fixed_position() - v (i)) > COLFUDGE)
- return false;
+ if (cols[i].fixed()&&
+ abs (cols[i].fixed_position() - v (i)) > COLFUDGE)
+ return false;
- if (!i)
- continue;
+ if (!i)
+ continue;
- Real mindist=cols[i-1].minright()
- +cols[i].minleft();
+ Real mindist=cols[i-1].minright()
+ +cols[i].minleft();
- // ugh... compares
- Real dif =v (i) - v (i-1)- mindist;
- bool b = (dif > - COLFUDGE);
+ // ugh... compares
+ Real dif =v (i) - v (i-1)- mindist;
+ bool b = (dif > - COLFUDGE);
- if (!b)
- return false;
+ if (!b)
+ return false;
}
return true;
Vector initsol (dim);
for (int i=0; i < dim; i++)
{
- if (cols[i].fixed())
- {
- initsol (i)=cols[i].fixed_position();
-
- if (i > 0)
- {
- Real r =initsol (i-1) + cols[i-1].minright();
- if (initsol (i) < r)
- {
- warning ("overriding fixed position");
- initsol (i) =r;
- }
- }
+ if (cols[i].fixed())
+ {
+ initsol (i)=cols[i].fixed_position();
+
+ if (i > 0)
+ {
+ Real r =initsol (i-1) + cols[i-1].minright();
+ if (initsol (i) < r)
+ {
+ warning ("overriding fixed position");
+ initsol (i) =r;
+ }
+ }
- }
- else
- {
- Real mindist=cols[i-1].minright()
- +cols[i].minleft();
- if (mindist < 0.0)
- warning ("Excentric column");
- initsol (i)=initsol (i-1)+mindist;
+ }
+ else
+ {
+ Real mindist=cols[i-1].minright()
+ +cols[i].minleft();
+ if (mindist < 0.0)
+ warning ("Excentric column");
+ initsol (i)=initsol (i-1)+mindist;
}
}
for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
{
- int l = i->left_i_;
- int r = i->right_i_;
+ int l = i->left_i_;
+ int r = i->right_i_;
- quad (r,r) += i->hooke_f_;
- quad (r,l) -= i->hooke_f_;
- quad (l,r) -= i->hooke_f_;
- quad (l,l) += i->hooke_f_;
+ quad (r,r) += i->hooke_f_;
+ quad (r,l) -= i->hooke_f_;
+ quad (l,r) -= i->hooke_f_;
+ quad (l,l) += i->hooke_f_;
- lin (r) -= i->space_f_*i->hooke_f_;
- lin (l) += i->space_f_*i->hooke_f_;
+ lin (r) -= i->space_f_*i->hooke_f_;
+ lin (l) += i->space_f_*i->hooke_f_;
- c += sqr (i->space_f_);
+ c += sqr (i->space_f_);
}
}
void
-Spring_spacer::set_fixed_cols (Mixed_qp &qp)const
+Spring_spacer::set_fixed_cols (Mixed_qp &qp) const
{
for (int j=0; j < cols.size(); j++)
- if (cols[j].fixed())
- qp.add_fixed_var (j,cols[j].fixed_position());
+ if (cols[j].fixed())
+ qp.add_fixed_var (j,cols[j].fixed_position());
}
int dim=cols.size();
for (int j=0; j < dim; j++)
{
- Colinfo c=cols[j];
- if (j > 0)
- {
- Vector c1(dim);
+ Colinfo c=cols[j];
+ if (j > 0)
+ {
+ Vector c1(dim);
- c1(j)=1.0 ;
- c1(j-1)=-1.0 ;
- lp.add_inequality_cons (c1, cols[j-1].minright() +
- cols[j].minleft());
- }
+ c1(j)=1.0 ;
+ c1(j-1)=-1.0 ;
+ lp.add_inequality_cons (c1, cols[j-1].minright() +
+ cols[j].minleft());
+ }
}
}
void
-Spring_spacer::lower_bound_solution (Col_hpositions*positions)const
+Spring_spacer::lower_bound_solution (Col_hpositions*positions) const
{
Mixed_qp lp (cols.size());
make_matrices (lp.quad,lp.lin, lp.const_term);
positions->satisfies_constraints_b_ = check_constraints (solution_vec);
if (!positions->satisfies_constraints_b_)
{
- WARN << "solution doesn't satisfy constraints.\n" ;
+ WARN << "solution doesn't satisfy constraints.\n" ;
}
position_loose_cols (solution_vec);
positions->energy_f_ = lp.eval (solution_vec);
add one column to the problem.
*/
void
-Spring_spacer::add_column (PCol *col, bool fixed, Real fixpos)
+Spring_spacer::add_column (Paper_column *col, bool fixed, Real fixpos)
{
Colinfo c (col,(fixed)? &fixpos : 0);
if (cols.size())
- c.rank_i_ = cols.top().rank_i_+1;
+ c.rank_i_ = cols.top().rank_i_+1;
else
- c.rank_i_ = 0;
+ c.rank_i_ = 0;
cols.push (c);
}
Line_of_cols
-Spring_spacer::error_pcol_l_arr()const
+Spring_spacer::error_pcol_l_arr() const
{
- Array<PCol*> retval;
+ Array<Paper_column*> retval;
for (int i=0; i< cols.size(); i++)
- if (cols[i].ugh_b_)
- retval.push (cols[i].pcol_l_);
+ if (cols[i].ugh_b_)
+ retval.push (cols[i].pcol_l_);
for (int i=0; i < loose_col_arr_.size(); i++)
{
- retval.push (loose_col_arr_[i].pcol_l_);
+ retval.push (loose_col_arr_[i].pcol_l_);
}
return retval;
}
Colinfo c=cols.get (i);
for (PCursor<Idealspacing*> j (ideal_p_list_.top()); j.ok (); j++)
{
- if (j->left_i_ == i|| j->right_i_ == i)
- j.del();
- else
- j++;
+ if (j->left_i_ == i|| j->right_i_ == i)
+ j.del();
+ else
+ j++;
}
c.ugh_b_ = true;
int j=0;
for (; j < loose_col_arr_.size(); j++)
{
- if (loose_col_arr_[j].rank_i_ > c.rank_i_)
- break;
+ if (loose_col_arr_[j].rank_i_ > c.rank_i_)
+ break;
}
loose_col_arr_.insert (c,j);
}
#ifndef NPRINT
for (int i=0; i < cols.size(); i++)
{
- DOUT << "col " << i<<' ';
- cols[i].print();
+ DOUT << "col " << i<<' ';
+ cols[i].print();
}
for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
{
- i->print();
+ i->print();
}
#endif
}
void
Spring_spacer::connect (int i, int j, Real d, Real h)
{
- assert( d >= 0 && d <= 100 CM);
- assert( h >=0);
+ assert(d >= 0 && d <= 100 CM);
+ assert(h >=0);
Idealspacing * s = new Idealspacing;
s->left_i_ = i;
Moment now = scol_l (i)->when();
Moment shortest_playing = infinity_mom;
- if (scol_l(i)->breakable_b())
+ if (scol_l (i)->breakable_b_)
{
for (int ji=i; ji >= start_context_i; ji--)
context_shortest_arr[ji] = context_shortest;
start_context_i = i;
context_shortest = infinity_mom;
}
- if (scol_l(i)->durations.size())
+ if (scol_l (i)->durations.size())
{
context_shortest = context_shortest <? scol_l(i)->durations[0];
}
// ji was j, but triggered ICE
- for (int ji=i+1; ji --; )
+ for (int ji=i+1; ji --;)
{
if (scol_l(ji)->durations.size() &&
now - scol_l(ji)->when() >= shortest_playing)
for (int i=0; i < cols.size(); i++)
{
- if ( !scol_l (i)->musical_b())
+ if (!scol_l (i)->musical_b())
{
Real symbol_distance =cols[i].minright() + 2 PT;
Real durational_distance = 0;
{
Moment shortest_playing_len = shortest_playing_arr[i];
Moment context_shortest = context_shortest_arr[i];
- if ( ! shortest_playing_len)
+ if (! shortest_playing_len)
{
warning ("Can't find a ruling note at "
+String (scol_l (i)->when()));
shortest_playing_len = 1;
}
- if ( ! context_shortest )
+ if (! context_shortest)
{
warning("No minimum in measure at "
+ String (scol_l (i)->when()));
return command_l_;
}
-PCol*
+Paper_column*
Staff_info::command_pcol_l()
{
return command_l();
}
-PCol*
+Paper_column*
Staff_info::musical_pcol_l()
{
return musical_l();
if (instrument_str().length_i())
{
// staff name
- play (new Audio_text ( Audio_text::TRACK_NAME, instrument_str ()));
+ play (new Audio_text (Audio_text::TRACK_NAME, instrument_str ()));
// instrument description
play (new Audio_text (Audio_text::INSTRUMENT_NAME, instrument_str ()));
}
pos_i_ =0;
sym_int_ = Interval (0,0);
staff_size_i_ = 0;
- staff_sym_l_=0;
- dir_i_ =0;
- inside_staff_b_ =false;
+ staff_sym_l_ = 0;
+ dir_ = CENTER;
+ inside_staff_b_ = false;
}
void
Staff_side::read_staff_sym()
{
if (! staff_sym_l_)
- return ;
+ return ;
staff_size_i_ = staff_sym_l_->steps_i();
}
Interval r;
for (int i=0; i < support_l_arr_.size(); i++)
- r.unite (support_l_arr_[i]->height());
+ r.unite (support_l_arr_[i]->height());
if (r.empty_b())
{
- r = Interval (0,0);
+ r = Interval (0,0);
}
return r;
}
}
int
-Staff_side::get_position_i()const
+Staff_side::get_position_i() const
{
- if (!dir_i_)
+ if (!dir_)
{
- warning ("Staff_side::get_position_i(): "
- "somebody forgot to set my vertical direction, returning -20");
- return -20;
+ warning ("Staff_side::get_position_i(): "
+ "somebody forgot to set my vertical direction, returning -20");
+ return -20;
}
Real inter_f = paper()-> internote_f ();
if (!inside_staff_b_)
{
- y = (dir_i_ > 0 && staff_sym_l_) ? staff_sym_l_->steps_i() + 2: -2;
- y *=inter_f;
- Interval v= support_height();
-
- if (dir_i_ > 0)
- {
- y = y >? (v.max() + 2*inter_f);
- }
- else if (dir_i_ < 0)
- {
- y = y <? (v.min() - 2*inter_f);
- }
+ y = (dir_ > 0 && staff_sym_l_) ? staff_sym_l_->steps_i() + 2: -2;
+ y *=inter_f;
+ Interval v= support_height();
+
+ if (dir_ > 0)
+ {
+ y = y >? (v.max() + 2*inter_f);
+ }
+ else if (dir_ < 0)
+ {
+ y = y <? (v.min() - 2*inter_f);
+ }
}
else
{
- Interval v= support_height();
- y = v[dir_i_] + 2*dir_i_*inter_f; // ugh
+ Interval v= support_height();
+ y = v[dir_] + 2*dir_*inter_f; // ugh
}
return int (rint (Real (y)/inter_f)); // should ret a float?
}
{
sym_int_ = symbol_height();
pos_i_ = get_position_i();
- if (dir_i_)
- pos_i_ += int (rint (- sym_int_[-dir_i_] / paper()->internote_f ()));
+ if (dir_)
+ pos_i_ += int (rint (- sym_int_[-dir_] / paper()->internote_f ()));
}
void
{
support_l_arr_.unordered_substitute (o,n);
if (staff_sym_l_ == o)
- staff_sym_l_ = n ? (Staff_symbol*) n->spanner():0;
+ staff_sym_l_ = n ? (Staff_symbol*) n->spanner():0;
}
#include "p-col.hh"
const NO_LINES = 5;
+
void
Staff_sym_engraver::fill_staff_info (Staff_info&i)
{
Staff_sym_engraver::do_creation_processing()
{
span_p_ = new Staff_symbol (NO_LINES);
- span_p_->left_col_l_ = get_staff_info().command_pcol_l (); // ugh
+ span_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
announce_element (Score_elem_info (span_p_, 0));
}
void
Staff_sym_engraver::do_removal_processing()
{
- span_p_->right_col_l_ = get_staff_info().command_pcol_l ();
+ span_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
typeset_element (span_p_);
span_p_ =0;
}
IMPLEMENT_IS_TYPE_B1(Staff_symbol,Spanner);
void
-Staff_symbol::do_print()const
+Staff_symbol::do_print() const
{
#ifndef NPRINT
Spanner::do_print();
return new Molecule (a);
}
-void
-Staff_symbol::set_extent (PCol*p1, PCol*p2)
-{
- assert (p1&&p2);
- left_col_l_ = p1;
- right_col_l_ = p2;
-}
-
Real
-Staff_symbol::inter_note_f()const
+Staff_symbol::inter_note_f() const
{
return paper()->internote_f ();
}
+++ /dev/null
-/*
- stem-beam-reg.cc -- part of GNU LilyPond
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "musical-request.hh"
-#include "stem-beam-grav.hh"
-#include "beam.hh"
-#include "stem.hh"
-#include "grouping.hh"
-#include "text-spanner.hh"
-#include "debug.hh"
-#include "grouping.hh"
-#include "note-head.hh"
-#include "time-description.hh"
-#include "duration-convert.hh"
-
-Stem_beam_engraver::Stem_beam_engraver()
-{
- do_post_move_processing();
-
- current_grouping = 0;
- beam_p_ = 0;
- default_dir_i_ =0;
- start_req_l_ = 0;
-}
-
-bool
-Stem_beam_engraver::do_try_request (Request*req_l)
-{
-
- Musical_req* mus_l = req_l->musical();
- /* Debiele puntkomma's. Laat je er eentje per ongeluk achter een
- if (..) staan, lijkt het net op een luis in gcc.
-
- (ofwel Python rules)
- */
- if (!mus_l)
- return false;
-
-
- if ( mus_l->beam())
- {
- if (bool (beam_p_) == bool (mus_l->beam()->spantype == Span_req::START))
- return false;
-
- if (beam_req_l_ && beam_req_l_ ->equal_b (mus_l))
- return false;
-
- beam_req_l_ = mus_l->beam();
- return true;
- }
-
- if ( mus_l->stem())
- {
- if (current_grouping && !current_grouping->child_fit_b (
- get_staff_info().time_C_->whole_in_measure_))
- return false;
-
- if (stem_req_l_ && !stem_req_l_->equal_b (mus_l) )
- return false;
-
- stem_req_l_ = mus_l->stem();
- return true;
- }
- return false;
-}
-
-void
-Stem_beam_engraver::do_process_requests()
-{
- if (beam_req_l_)
- {
- if (beam_req_l_->spantype == Span_req::STOP)
- {
- end_beam_b_ = true;
- start_req_l_ = 0;
- }
- else
- {
- beam_p_ = new Beam;
- start_req_l_ = beam_req_l_;
- beam_p_->left_col_l_ = get_staff_info().musical_pcol_l ();
- current_grouping = new Rhythmic_grouping;
- if (beam_req_l_->nplet)
- {
- Text_spanner* t = new Text_spanner();
- Text_def *defp = new Text_def;
- t->set_support (beam_p_);
- defp->align_i_ = 0;
- defp->text_str_ = beam_req_l_->nplet;
- defp->style_str_="italic";
- t->spec_p_ = defp;
- announce_element (Score_elem_info (t,0));
- typeset_element (t);
- }
- announce_element ( Score_elem_info (beam_p_, 0));
-
- }
- }
-
- if (stem_req_l_)
- {
- stem_p_ = new Stem (8);
- if (current_grouping)
- current_grouping->add_child (
- get_staff_info().time_C_->whole_in_measure_,
- stem_req_l_->duration());
-
- stem_p_->flag_i_ = Duration_convert::type2_i
- (stem_req_l_->duration_.durlog_i_); // should change rep. of flags too.
-
- if (beam_p_)
- {
- if (stem_req_l_->duration_.durlog_i_<= 2)
- stem_req_l_->warning ("stem doesn't fit in Beam");
- else
- beam_p_->add (stem_p_);
- stem_p_->print_flag_b_ = false;
- }
- else
- {
- stem_p_->print_flag_b_ = true;
- }
-
- announce_element (Score_elem_info (stem_p_, stem_req_l_));
- }
-}
-
-void
-Stem_beam_engraver::acknowledge_element (Score_elem_info info)
-{
- if (!stem_p_)
- return;
-
- if (info.elem_l_->name() == Note_head::static_name () &&
- stem_req_l_->duration()
- == info.req_l_->musical()->rhythmic ()->duration ())
- {
- Note_head * n_l= (Note_head*)info.elem_l_->item();
- stem_p_->add (n_l);
- }
-}
-void
-Stem_beam_engraver::do_pre_move_processing()
-{
- if (stem_p_)
- {
- if (default_dir_i_)
- stem_p_->dir_i_ = default_dir_i_;
-
- typeset_element (stem_p_);
- stem_p_ = 0;
- }
- if (beam_p_ && end_beam_b_)
- {
- Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_;
- rg_C->extend (current_grouping->interval());
- beam_p_->set_grouping (*rg_C, *current_grouping);
- beam_p_->right_col_l_ = get_staff_info().musical_pcol_l ();
- typeset_element (beam_p_);
- delete current_grouping;
- current_grouping = 0;
- beam_p_ = 0;
- }
- end_beam_b_ = false;
-}
-void
-Stem_beam_engraver::do_post_move_processing()
-{
- stem_p_ = 0;
- beam_req_l_ = 0;
- stem_req_l_ = 0;
- end_beam_b_ = false;
-}
-
-Stem_beam_engraver::~Stem_beam_engraver()
-{
- if (beam_p_)
- start_req_l_->warning ("unterminated beam");
-}
-
-void
-Stem_beam_engraver::set_feature (Feature i)
-{
- if (i.type_ == "vdir")
- default_dir_i_ = i.value_;
-}
-
-
-IMPLEMENT_IS_TYPE_B1(Stem_beam_engraver,Engraver);
-ADD_THIS_ENGRAVER(Stem_beam_engraver);
--- /dev/null
+/*
+ stem-grav.cc -- implement Stem_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "stem-grav.hh"
+#include "note-head.hh"
+#include "stem.hh"
+#include "musical-request.hh"
+#include "duration-convert.hh"
+
+Stem_engraver::Stem_engraver()
+{
+ stem_p_ =0;
+ dir_ =CENTER;
+}
+
+void
+Stem_engraver::acknowledge_element(Score_elem_info i)
+{
+ if (i.elem_l_->is_type_b (Note_head::static_name()))
+ {
+ Note_head *h = (Note_head*) i.elem_l_->item();
+ if (!stem_p_)
+ {
+ Rhythmic_req * r = i.req_l_->musical()->rhythmic();
+ stem_p_ = new Stem;
+ stem_p_->flag_i_ = Duration_convert::type2_i(r->duration_.durlog_i_);
+ announce_element (Score_elem_info (stem_p_, r));
+ }
+ stem_p_->add (h);
+ }
+}
+
+void
+Stem_engraver::do_pre_move_processing()
+{
+ if (stem_p_)
+ {
+ if (dir_)
+ stem_p_->dir_ = dir_;
+
+ typeset_element(stem_p_);
+ stem_p_ =0;
+ }
+}
+
+void
+Stem_engraver::set_feature (Feature i)
+{
+ if (i.type_ == "vdir")
+ dir_ = (Direction) int(i.value_);
+}
+
+IMPLEMENT_IS_TYPE_B1(Stem_engraver, Engraver);
+ADD_THIS_ENGRAVER(Stem_engraver);
const int STEMLEN=7;
int
-Stem::min_head_i()const
+Stem::min_head_i() const
{
int m = 1000;
for (int i =0; i < head_l_arr_.size(); i++)
- m = m <? head_l_arr_[i]->position_i_;
+ m = m <? head_l_arr_[i]->position_i_;
return m;
}
{
int m = -1000;
for (int i =0; i < head_l_arr_.size(); i++)
- m = m >? head_l_arr_[i]->position_i_;
+ m = m >? head_l_arr_[i]->position_i_;
return m;
}
-
-Stem::Stem (int c)
+/*
+ TODO: staff-size
+ */
+Stem::Stem ()
{
beams_left_i_ = 0;
beams_right_i_ = 0;
stem_bottom_f_ = stem_top_f_ = 0;
flag_i_ = 4;
- dir_i_ =0;
- staff_size_i_ = c;
+ dir_ =CENTER;
+ staff_size_i_ = 8;
print_flag_b_=true;
stem_xoffset_f_ =0;
}
Real
-Stem::stem_length_f()const
+Stem::stem_length_f() const
{
return stem_top_f_-stem_bottom_f_ ;
}
Real
-Stem::stem_start_f()const
+Stem::stem_start_f() const
{
- return (dir_i_ < 0)? stem_top_f_ : stem_bottom_f_;
+ return (dir_ < 0)? stem_top_f_ : stem_bottom_f_;
}
Real
Stem::stem_end_f() const
{
- return (dir_i_ < 0)? stem_bottom_f_ : stem_top_f_;
+ return (dir_ < 0)? stem_bottom_f_ : stem_top_f_;
}
Stem::set_stemend (Real se)
{
// todo: margins
- if (! ((dir_i_ > 0 && se >= max_head_i()) ||
- (se <= min_head_i() && dir_i_ <0)) )
- warning ("Weird stem size; check for narrow beams");
+ if (! ((dir_ > 0 && se >= max_head_i()) ||
+ (se <= min_head_i() && dir_ <0)))
+ warning ("Weird stem size; check for narrow beams");
- stem_top_f_ = (dir_i_ < 0) ? max_head_i() : se;
- stem_bottom_f_ = (dir_i_ < 0) ? se : min_head_i();
+ stem_top_f_ = (dir_ < 0) ? max_head_i() : se;
+ stem_bottom_f_ = (dir_ < 0) ? se : min_head_i();
}
void
n->add_dependency (this);
if (n->rest_b_)
{
- rest_l_arr_.push (n);
+ rest_l_arr_.push (n);
}
else if (n->balltype_i_ == 0)
{
- whole_l_arr_.push (n);
- return;
+ whole_l_arr_.push (n);
+ return;
}
else
{
- head_l_arr_.push (n);
+ head_l_arr_.push (n);
}
}
bool
-Stem::invisible_b()const
+Stem::invisible_b() const
{
return !head_l_arr_.size();
}
-// if dir_i_ is set we return fake values.
+// if dir_ is set we return fake values.
int
Stem::get_center_distance_from_top()
{
- if (dir_i_)
- return (dir_i_ > 0) ? 0 : 1;
+ if (dir_)
+ return (dir_ > 0) ? 0 : 1;
int staff_center = staff_size_i_ / 2;
int max = max_head_i() - staff_center;
return max >? 0;
}
-// if dir_i_ is set we return fake values.
+// if dir_ is set we return fake values.
int
Stem::get_center_distance_from_bottom()
{
- if (dir_i_)
- return (dir_i_ > 0) ? 1 : 0;
+ if (dir_)
+ return (dir_ > 0) ? 1 : 0;
int staff_center = staff_size_i_ / 2;
int min = staff_center - min_head_i();
return min >? 0;
}
-int
+Direction
Stem::get_default_dir()
{
- if (dir_i_)
- return dir_i_;
+ if (dir_)
+ return dir_;
return (get_center_distance_from_top() >=
- get_center_distance_from_bottom()) ? -1 : 1;
+ get_center_distance_from_bottom()) ? -1 : 1;
}
void
Stem::set_default_dir()
{
- dir_i_ = get_default_dir();
+ dir_ = get_default_dir();
}
void
Stem::set_default_stemlen()
{
- if (!dir_i_)
- set_default_dir();
+ if (!dir_)
+ set_default_dir();
// ugh... how about non 5-line staffs?
- if ((max_head_i() < -2 && dir_i_ == 1)
- ||(min_head_i() > staff_size_i_ && dir_i_ == -1))
- {
- set_stemend (staff_size_i_ /2 -1);
+ if ((max_head_i() < -2 && dir_ == 1)
+ ||(min_head_i() > staff_size_i_ && dir_ == -1))
+ {
+ set_stemend (staff_size_i_ /2 -1);
}
else
{
- set_stemend ((dir_i_ > 0) ? max_head_i() + STEMLEN :
- min_head_i() - STEMLEN);
+ set_stemend ((dir_ > 0) ? max_head_i() + STEMLEN :
+ min_head_i() - STEMLEN);
}
}
Stem::set_default_extents()
{
if (!stem_length_f())
- set_default_stemlen();
+ set_default_stemlen();
- set_stemend ((dir_i_< 0) ?
- max_head_i()-stem_length_f (): min_head_i () +stem_length_f ());
- if (dir_i_ > 0){
- stem_xoffset_f_ = paper()->note_width ()-paper ()->rule_thickness ();
- }
+ set_stemend ((dir_< 0) ?
+ max_head_i()-stem_length_f (): min_head_i () +stem_length_f ());
+ if (dir_ > 0){
+ stem_xoffset_f_ = paper()->note_width ()-paper ()->rule_thickness ();
+ }
else
- stem_xoffset_f_ = 0;
+ stem_xoffset_f_ = 0;
}
/*
Stem::set_noteheads()
{
if (!head_l_arr_.size())
- return;
+ return;
head_l_arr_.sort (Note_head::compare);
- if (dir_i_ < 0)
- head_l_arr_.reverse();
+ if (dir_ < 0)
+ head_l_arr_.reverse();
head_l_arr_[0]->extremal_i_ = -1;
head_l_arr_.top()->extremal_i_ = 1;
int lastpos = head_l_arr_[0]->position_i_;
for (int i=1; i < head_l_arr_.size(); i ++)
{
- int dy =abs (lastpos- head_l_arr_[i]->position_i_);
+ int dy =abs (lastpos- head_l_arr_[i]->position_i_);
- if (dy <= 1)
- {
- if (parity)
- head_l_arr_[i]->x_dir_i_ = (stem_xoffset_f_>0) ? 1:-1;
- parity = !parity;
- }
- else
- parity = 0;
- lastpos = head_l_arr_[i]->position_i_;
+ if (dy <= 1)
+ {
+ if (parity)
+ head_l_arr_[i]->x_dir_ = (stem_xoffset_f_>0) ? UP:DOWN;
+ parity = !parity;
+ }
+ else
+ parity = 0;
+ lastpos = head_l_arr_[i]->position_i_;
}
}
Stem::do_pre_processing()
{
if (stem_bottom_f_== stem_top_f_)
- set_default_extents();
+ set_default_extents();
set_noteheads();
- flag_i_ = dir_i_*abs (flag_i_);
+ flag_i_ = dir_*abs (flag_i_);
transparent_b_ = invisible_b();
empty_b_ = invisible_b();
}
Interval
-Stem::do_width()const
+Stem::do_width() const
{
if (!print_flag_b_ || abs (flag_i_) <= 4)
- return Interval (0,0); // TODO!
+ return Interval (0,0); // TODO!
Paper_def*p= paper();
Interval r (p->lookup_l()->flag (flag_i_).dim.x ());
r+= stem_xoffset_f_;
}
Molecule*
-Stem::brew_molecule_p()const
+Stem::brew_molecule_p() const
{
Molecule *out =0;
if (print_flag_b_&&abs (flag_i_) > 4)
{
- Symbol fl = p->lookup_l()->flag (flag_i_);
- Molecule m (fl);
- if (flag_i_ < -4){
- out->add_bottom (m);
- }
- else if (flag_i_ > 4)
- {
- out->add_top (m);
- }
- else
- assert (false);
+ Symbol fl = p->lookup_l()->flag (flag_i_);
+ Molecule m (fl);
+ if (flag_i_ < -4){
+ out->add_bottom (m);
+ }
+ else if (flag_i_ > 4)
+ {
+ out->add_top (m);
+ }
+ else
+ assert (false);
}
out->translate (stem_xoffset_f_, X_AXIS);
}
Real
-Stem::hpos_f()const
+Stem::hpos_f() const
{
return Item::hpos_f() + stem_xoffset_f_;
}
#include "string.hh"
String
-Super_elem::TeX_string()const
+Super_elem::TeX_output_str() const
{
String s;
for (int i=0; i < lines_arr_.size(); i++)
{
- s += lines_arr_[i]->TeX_string();
- if (i + 1<lines_arr_.size())
- s += "\\interscoreline"; // TODO
+ s += lines_arr_[i]->TeX_output_str();
+ if (i + 1<lines_arr_.size())
+ s += "\\interscoreline"; // TODO
}
return s;
}
{
lines_arr_ = line_of_score_l_->get_lines();
for (int i =0; i < lines_arr_.size(); i++)
- add_dependency (lines_arr_[i]);
+ add_dependency (lines_arr_[i]);
}
Super_elem::do_substitute_dependency (Score_elem*o,Score_elem* n)
{
if (line_of_score_l_ == o->spanner())
- line_of_score_l_ = n?(Line_of_score*)n->spanner():0;
+ line_of_score_l_ = n? (Line_of_score*) n->spanner() : 0;
}
Super_elem::Super_elem()
add_dependency (line_of_score_l_);
}
-
-
-
IMPLEMENT_IS_TYPE_B1(Super_elem,Score_elem);
String
-Symbol::str()const
+Symbol::str() const
{
return "symbol (\'"+tex+"\', (" + dim.x().str () + ", " + dim.y ().str () + "))";
}
{
for (Assoc_iter<String, Symtable*> i (s); i.ok(); i++)
{
- add (i.key(), new Symtable (*i.val ()));
+ add (i.key(), new Symtable (*i.val ()));
}
}
{
for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
{
- delete i.val();
+ delete i.val();
}
}
Symtable::lookup (String s) const
{
if (elt_b (s))
- return (*this)[s];
+ return (*this)[s];
else
{
- warning ("Symtable `" + id_str+ "\': unknown symbol `" +s+"'\n");
- Symbol sy;
- return sy;
+ warning ("Symtable `" + id_str+ "\': unknown symbol `" +s+"'\n");
+ Symbol sy;
+ return sy;
}
}
{
for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
{
- DOUT << "table \'" << i.key() << "\' {\n";
- i.val()->print ();
- DOUT << "}\n";
+ DOUT << "table \'" << i.key() << "\' {\n";
+ i.val()->print ();
+ DOUT << "}\n";
}
}
void
{
for (Assoc_iter<String, Symbol> i (*this); i.ok(); i++)
{
- DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n";
+ DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n";
}
}
#include "plist.tcc"
-#define IPLC_INSTANTIATE(a) IPL_INSTANTIATE(a); template PL_INSTANTIATE(const a)
+#define IPLC_INSTANTIATE(a) POINTERLIST_INSTANTIATE(a)
template IPLC_INSTANTIATE(Score_elem);
template IPLC_INSTANTIATE(Spanner);
template IPLC_INSTANTIATE(Idealspacing);
-template IPLC_INSTANTIATE(PCol);
#include "plist.tcc"
#include "pcursor.tcc"
- template IPL_INSTANTIATE(Line_spacer);
+template POINTERLIST_INSTANTIATE(Line_spacer);
#include "plist.tcc"
#include "pcursor.tcc"
-template IPL_INSTANTIATE(Atom);
-template IPL_INSTANTIATE(Input_translator);
+template POINTERLIST_INSTANTIATE(Atom);
+template POINTERLIST_INSTANTIATE(Input_translator);
#include "engraver.hh"
#include "performer.hh"
-template IPL_INSTANTIATE(Engraver);
-template IPL_INSTANTIATE(Performer);
+template POINTERLIST_INSTANTIATE(Engraver);
+template POINTERLIST_INSTANTIATE(Performer);
#include "music-list.hh"
#include "music-iterator.hh"
-template IPL_INSTANTIATE(Music);
-template IPL_INSTANTIATE(Music_iterator);
+template POINTERLIST_INSTANTIATE(Music);
+template POINTERLIST_INSTANTIATE(Music_iterator);
#include "plist.tcc"
-template IPL_INSTANTIATE(Audio_element);
-template IPL_INSTANTIATE(Audio_column);
-
+template POINTERLIST_INSTANTIATE(Audio_element);
+template POINTERLIST_INSTANTIATE(Audio_column);
/*
+ tex-beam.cc -- implement Lookup::{beam_element, beam, rule_symbol}
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+/*
Code to generate beams for TeX
-
*/
#include <math.h>
{
if (abs (s) > 0.5)
{
- WARN << "beam steeper than 0.5 (" << s << ")\n";
- s = sign (s) * 0.5;
+ WARN << "beam steeper than 0.5 (" << s << ")\n";
+ s = sign (s) * 0.5;
}
int i = int (rint (s * 20.0));
s = i/20.0;
if (s>0)
- return 6*i +122;
+ return 6*i +122;
else
- return -6 * i+ 186;
+ return -6 * i+ 186;
}
Symbol
{
int sidx = slope_index (slope);
if (!slope)
- return rule_symbol (2 PT, width);
+ return rule_symbol (2 PT, width);
if (width < 2 PT)
{
- WARN<<"Beam too narrow. (" << print_dimen (width) <<")\n";
- width = 2 PT;
+ WARN<<"Beam too narrow. (" << print_dimen (width) <<")\n";
+ width = 2 PT;
}
Real elemwidth = 64 PT;
int widx = 5;
while (elemwidth > width)
{
- widx --;
- elemwidth /= 2.0;
+ widx --;
+ elemwidth /= 2.0;
}
Real overlap = elemwidth/4;
Real last_x = width - elemwidth;
m.add (a);
while (x < last_x)
{
- a=elem;
- a.translate (Offset (x-overlap, (x-overlap)*slope));
- m.add (a);
- x += elemwidth - overlap;
+ a=elem;
+ a.translate (Offset (x-overlap, (x-overlap)*slope));
+ m.add (a);
+ x += elemwidth - overlap;
}
a=elem;
a.translate (Offset (last_x, (last_x) * slope));
char c='#';
switch (y_sign)
{
- case -1:
- c = 'd';
- break;
- case 0:
- c = 'h';
- break;
- case 1:
- c = 'u';
- break;
- default:
- assert (false);
+ case -1:
+ c = 'd';
+ break;
+ case 0:
+ c = 'h';
+ break;
+ case 1:
+ c = 'u';
+ break;
+ default:
+ assert (false);
}
return c;
}
Lookup::half_slur_middlepart (Real &dx, int dir) const
{
if (dx >= 400 PT) {// todo
- WARN<<"halfslur too large" <<print_dimen (dx)<< "shrinking (ugh)\n";
- dx = 400 PT;
- }
+ WARN<<"halfslur too large" <<print_dimen (dx)<< "shrinking (ugh)\n";
+ dx = 400 PT;
+ }
int widx = int (floor (dx / 4.0));
dx = widx * 4.0;
if (widx) widx --;
else
{
- WARN << "slur too narrow\n";
+ WARN << "slur too narrow\n";
}
Symbol s;
int idx = widx;
if (dir < 0)
- idx += 128;
+ idx += 128;
assert (idx < 256);
- f+=String ("{") + String (idx ) + "}";
+ f+=String ("{") + String (idx) + "}";
s.tex = f;
Atom a (s);
a.translate (dx/2, X_AXIS);
{
Real orig_dx = dx;
if (!xpart)
- return half_slur_middlepart (dx, dir);
+ return half_slur_middlepart (dx, dir);
int widx;
if (dx >= 96 PT)
{
- WARN << "Slur half too wide." << print_dimen (orig_dx) << " shrinking (ugh)\n";
- dx = 96 PT;
+ WARN << "Slur half too wide." << print_dimen (orig_dx) << " shrinking (ugh)\n";
+ dx = 96 PT;
}
widx = int (rint (dx/12.0));
dx = widx*12.0;
if (widx)
- widx --;
+ widx --;
else
{
- WARN << "slur too narrow " << print_dimen (orig_dx)<<"\n";
+ WARN << "slur too narrow " << print_dimen (orig_dx)<<"\n";
}
Symbol s;
int hidx = dy;
if (hidx <0)
- hidx = -hidx;
+ hidx = -hidx;
hidx --;
int idx =-1;
idx = widx * 16 + hidx;
if (xpart < 0)
- idx += 128;
+ idx += 128;
assert (idx < 256);
- f+=String ("{") + String (idx ) + "}";
+ f+=String ("{") + String (idx) + "}";
s.tex = f;
if (y_sign)
{
- large |= dx>= 4*16 PT;
+ large |= dx>= 4*16 PT;
}
else
- large |= dx>= 4*54 PT;
+ large |= dx>= 4*54 PT;
if (large)
{
- return big_slur (dy, dx, dir);
+ return big_slur (dy, dx, dir);
}
Real orig_dx = dx;
int widx = int (floor (dx/4.0)); // slurs better too small..
dx = 4.0 * widx;
if (widx)
- widx --;
+ widx --;
else
{
- WARN << "slur too narrow: " << print_dimen (orig_dx) << "\n";
+ WARN << "slur too narrow: " << print_dimen (orig_dx) << "\n";
}
int hidx = dy;
if (hidx <0)
- hidx = -hidx;
+ hidx = -hidx;
hidx --;
if (hidx > 8)
{
- WARN<<"slur to steep: " << dy << " shrinking (ugh)\n";
+ WARN<<"slur to steep: " << dy << " shrinking (ugh)\n";
}
Symbol s;
int idx=-1;
if (y_sign) {
- idx = hidx * 16 + widx;
- if (dir < 0)
- idx += 128;
- }
+ idx = hidx * 16 + widx;
+ if (dir < 0)
+ idx += 128;
+ }
else
{
- if (dx >= 4*54 PT)
- {
- WARN << "slur too wide: " << print_dimen (dx) <<
- " shrinking (ugh)\n";
- dx = 4*54 PT;
- }
- idx = widx;
- if (dir < 0)
- idx += 54;
+ if (dx >= 4*54 PT)
+ {
+ WARN << "slur too wide: " << print_dimen (dx) <<
+ " shrinking (ugh)\n";
+ dx = 4*54 PT;
+ }
+ idx = widx;
+ if (dir < 0)
+ idx += 54;
}
assert (idx < 256);
- f+=String ("{") + String (idx ) + "}";
+ f+=String ("{") + String (idx) + "}";
s.tex = f;
Atom a (s);
String retval (source);
for (int i = 0 ; i < args.size(); i++)
substitute_arg (retval, args[i]);
- /*
- while (retval.index_i ('%') >= 0)
- substitute_arg (retval, "");
- */
return retval;
}
Interval
Text_def::width (Paper_def * p) const
{
- Atom a = get_atom (p,0);
+ Atom a = get_atom (p,CENTER);
Real guess_width_f = text_str_.length_i() * a.sym_.dim.x ().length (); // ugh
Interval i (0, guess_width_f);
}
Atom
-Text_def::get_atom (Paper_def *p, int) const
+Text_def::get_atom (Paper_def *p, Direction) const
{
return p->lookup_l()->text (style_str_, text_str_, -align_i_);
}
+++ /dev/null
-/*
- text-reg.cc -- implement Text_engraver
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-
- Obsolete.
-*/
-#include "note-column.hh"
-#include "musical-request.hh"
-#include "text-grav.hh"
-#include "text-item.hh"
-
-Text_engraver::Text_engraver()
-{
- text_p_ = 0;
- dir_i_ =0;
- do_post_move_processing();
-}
-
-bool
-Text_engraver::do_try_request (Request*req_l)
-{
- Musical_req *m = req_l->musical();
- if (!m || ! m->text())
- return false;
- if (text_req_l_ && text_req_l_->equal_b (m))
- return false;
-
- text_req_l_ = m->text();
- return true;
-}
-void
-Text_engraver::acknowledge_element (Score_elem_info i)
-{
- if (text_p_ && i.elem_l_->name() == Note_column::static_name ())
- {
- text_p_->add_support (i.elem_l_);
- }
-}
-void
-Text_engraver::do_process_requests()
-{
- if (text_req_l_)
- {
- text_p_ = new Text_item (text_req_l_->tdef_p_, text_req_l_->dir_i_); // ugh
- announce_element (Score_elem_info (text_p_, text_req_l_));
- }
-}
-void
-Text_engraver::do_pre_move_processing()
-{
- if (text_p_)
- {
- if (dir_i_ && !text_p_->dir_i_)
- text_p_->dir_i_ = dir_i_;
- Staff_symbol* s_l = get_staff_info().staff_sym_l_;
- text_p_->set_staffsym (s_l);
- typeset_element (text_p_);
-
- text_p_ = 0;
- }
-}
-void
-Text_engraver::set_feature (Feature i)
-{
- if (i.type_ == "vdir")
- dir_i_ = i.value_;
-}
-void
-Text_engraver::do_post_move_processing()
-{
- text_req_l_ = 0;
-}
-
-IMPLEMENT_IS_TYPE_B1(Text_engraver,Engraver);
-ADD_THIS_ENGRAVER(Text_engraver);
#include "molecule.hh"
#include "lookup.hh"
-Text_item::Text_item (General_script_def*tdef_l, int d)
+Text_item::Text_item (General_script_def*tdef_l, Direction d)
{
- dir_i_ = d;
+ dir_ = d;
fat_b_ = false;
tdef_p_ = tdef_l->clone();
}
void
Text_item::do_pre_processing()
{
- if (!dir_i_)
- dir_i_ = -1;
+ if (!dir_)
+ dir_ = DOWN;
}
Interval
-Text_item::symbol_height()const
+Text_item::symbol_height() const
{
- return tdef_p_->get_atom (paper(), dir_i_).sym_.dim.y ();
+ return tdef_p_->get_atom (paper(), dir_).sym_.dim.y ();
}
Molecule*
Text_item::brew_molecule_p() const
{
- Atom a (tdef_p_->get_atom (paper(), dir_i_));
+ Atom a (tdef_p_->get_atom (paper(), dir_));
-/*
- if ( fat_b_)
- a.sym.dim.x = tdef_p_->width (paper());
- */
+ /*
+ if (fat_b_)
+ a.sym.dim.x = tdef_p_->width (paper());
+ */
Molecule* mol_p = new Molecule (a);
- if (dir_i_<0) // should do something better anyway.
- mol_p->translate (-mol_p->extent().y ().left , Y_AXIS);
+ if (dir_<0) // should do something better anyway.
+ mol_p->translate (-mol_p->extent().y ().left , Y_AXIS);
mol_p->translate (pos_i_ * paper()->internote_f (), Y_AXIS);
return mol_p;
Text_spanner::do_post_processing()
{
text_off_ = support_span_l_->center() +
- Offset (0,support_span_l_->dir_i_ * paper()->internote_f () * 4); // todo
+ Offset (0,support_span_l_->dir_ * paper()->internote_f () * 4); // todo
}
Molecule*
Text_spanner::brew_molecule_p() const
{
- Atom tsym (spec_p_->get_atom (paper(),0));
+ Atom tsym (spec_p_->get_atom (paper(),CENTER));
tsym.translate (text_off_);
Molecule*output = new Molecule;
void
Text_spanner::do_pre_processing()
{
- right_col_l_ = support_span_l_->right_col_l_;
- left_col_l_ = support_span_l_->left_col_l_;
- assert (left_col_l_ && right_col_l_);
+ spanned_drul_ = support_span_l_->spanned_drul_;
}
Interval
-Text_spanner::height()const
+Text_spanner::height() const
{
return brew_molecule_p()->extent ().y ();
}
end_mom_ = -1;
melodic_req_l_ = 0;
end_melodic_req_l_ =0;
- dir_i_ = 0;
+ dir_ = CENTER;
}
void
Tie_engraver::sync_features()
{
- dir_i_ = get_feature ("vdir");
+ dir_ = Direction (int (get_feature ("vdir")));
}
{
if (tie_p_)
{
- tie_p_->set_head (-1, (Note_head*)i.elem_l_->item());
+ tie_p_->set_head (LEFT, (Note_head*)i.elem_l_->item());
melodic_req_l_ = i.req_l_->musical()->melodic ();
}
if (end_tie_p_)
{
- end_tie_p_->set_head (1, (Note_head*)i.elem_l_->item());
- if (!Melodic_req::compare ( *end_melodic_req_l_, *melodic_req_l_))
+ end_tie_p_->set_head (RIGHT, (Note_head*)i.elem_l_->item());
+ if (!Melodic_req::compare (*end_melodic_req_l_, *melodic_req_l_))
end_tie_p_->same_pitch_b_ = true;
announce_element (Score_elem_info (end_tie_p_,end_req_l_));
}
{
if (end_tie_p_)
{
- if (dir_i_)
- end_tie_p_->dir_i_ = dir_i_;
+ if (dir_)
+ end_tie_p_->dir_ = dir_;
typeset_element (end_tie_p_);
end_tie_p_ =0;
Tie_engraver::set_feature (Feature f)
{
if (f.type_ == "vdir")
- dir_i_ = f.value_;
+ dir_ = Direction (int (f.value_));
}
void
-Tie::set_head (int x_pos, Note_head * head_l)
+Tie::set_head (Direction d, Note_head * head_l)
{
- if (x_pos >0)
- {
- assert (!right_head_l_);
- right_head_l_ = head_l;
- }
- else
- {
- assert (!left_head_l_);
- left_head_l_ = head_l;
- }
+ assert (!head_l_drul_[d]);
+ head_l_drul_[d] = head_l;
+
add_dependency (head_l);
}
Tie::Tie()
{
- right_head_l_ =0;
- left_head_l_ =0;
+ head_l_drul_[RIGHT] =0;
+ head_l_drul_[LEFT] =0;
same_pitch_b_ =false;
}
void
Tie::set_default_dir()
{
- int m= (left_head_l_->position_i_ + right_head_l_->position_i_) /2 ;
- dir_i_ = (m < 5)? -1:1; // ugh
+ int m= (head_l_drul_[LEFT]->position_i_ + head_l_drul_[RIGHT]->position_i_) /2 ;
+ dir_ = (m < 5)? DOWN : UP; // UGH
}
void
Tie::do_add_processing()
{
- assert (left_head_l_ && right_head_l_);
- left_col_l_ = left_head_l_ -> pcol_l_;
- right_col_l_ = right_head_l_ -> pcol_l_;
+ assert (head_l_drul_[LEFT] && head_l_drul_[RIGHT]);
+ set_bounds(LEFT,head_l_drul_[LEFT]);
+ set_bounds(RIGHT,head_l_drul_[RIGHT]);
}
-/**
- This is already getting hairy. Should use Note_head *heads[2]
- */
void
Tie::do_post_processing()
{
- assert (left_head_l_ || right_head_l_);
- left_pos_i_ = (left_head_l_)?
- left_head_l_->position_i_ : right_head_l_->position_i_;
- right_pos_i_ = (right_head_l_) ?
- right_head_l_->position_i_ : left_head_l_->position_i_;
-
- if ( right_head_l_ && right_head_l_->extremal_i_)
+ assert (head_l_drul_[LEFT] || head_l_drul_[RIGHT]);
+
+ Direction d = LEFT;
+ do
{
- right_pos_i_ += 2*dir_i_;
- right_dx_f_ -= 0.25;
+ pos_i_drul_[d] = (head_l_drul_[d])?
+ head_l_drul_[d]->position_i_ : head_l_drul_[(Direction)-d]->position_i_;
}
- else
- right_dx_f_ -= 0.5;
+ while ((d *= -1) != LEFT);
- if (left_head_l_ && left_head_l_->extremal_i_)
+ do
{
- left_pos_i_ += 2*dir_i_;
- left_dx_f_ += 0.25;
+ if (head_l_drul_[d] && head_l_drul_[d]->extremal_i_)
+ {
+ pos_i_drul_[d] += 2*dir_;
+ dx_f_drul_[d] += d * 0.25;
+ }
+ else
+ dx_f_drul_[d] += d*0.5;
}
- else
- left_dx_f_ += 0.5;
-
- if (!right_head_l_)
- right_pos_i_ = left_pos_i_;
- if (! left_head_l_)
- left_pos_i_ = right_pos_i_;
+ while ((d *= -1) != LEFT);
+
+ do
+ {
+ if (!head_l_drul_[d])
+ pos_i_drul_[d] = pos_i_drul_[(Direction)-d];
+ }
+ while ((d *= -1) != LEFT);
}
Tie::do_substitute_dependency (Score_elem*o, Score_elem*n)
{
Note_head *new_l =n?(Note_head*)n->item():0;
- if (o->item() == left_head_l_)
- left_head_l_ = new_l;
- else if (o->item() == right_head_l_)
- right_head_l_ = new_l;
+ if (o->item() == head_l_drul_[LEFT])
+ head_l_drul_[LEFT] = new_l;
+ else if (o->item() == head_l_drul_[RIGHT])
+ head_l_drul_[RIGHT] = new_l;
}
#include "debug.hh"
String
-Time_description::str()const
+Time_description::str() const
{
String s ("Time_description { ");
if (cadenza_b_)
whole_in_measure_ =0;
one_beat_ = Moment (1,4);
when_ = 0;
- bars_i_ = 0;
+ bars_i_ = 1; // musician start counting at 1
cadenza_b_ = false;
}
when_ += dt;
whole_in_measure_ += dt;
- while ( !cadenza_b_ && whole_in_measure_ >= whole_per_measure_)
+ while (!cadenza_b_ && whole_in_measure_ >= whole_per_measure_)
{
whole_in_measure_ -= whole_per_measure_;
bars_i_ ++;
error messages if not possible, "" if possible
*/
String
-Time_description::try_set_partial_str (Moment p)const
+Time_description::try_set_partial_str (Moment p) const
{
if (p<Rational (0))
return ("Partial must be non-negative");
}
Moment
-Time_description::barleft()const
+Time_description::barleft() const
{
assert (!cadenza_b_);
return whole_per_measure_-whole_in_measure_;
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-#if 0
-
+#include "score-grav.hh"
#include "timing-grav.hh"
#include "command-request.hh"
inf.rhythmic_C_ = &default_grouping_;
}
+bool
+Timing_engraver::do_try_request(Request*r)
+{
+ Command_req * c = r->command();
+ if (!(c && c->timing()))
+ return false;
+ for (int i=0; i < timing_req_l_arr_.size (); i++)
+ {
+ if (timing_req_l_arr_[i]->equal_b(r))
+ return true;
+ if (timing_req_l_arr_[i]->name() == r->name())
+ {
+ r->warning ("conflicting timing request");
+ return false;
+ }
+ }
+
+ timing_req_l_arr_.push(c->timing());
+ return true;
+}
+
+Meter_change_req*
+Timing_engraver::meter_req_l() const
+{
+ Meter_change_req *m_l=0;
+ for (int i=0; !m_l && i < timing_req_l_arr_.size (); i++)
+ {
+ m_l=timing_req_l_arr_[i]->meterchange();
+ }
+ return m_l;
+}
+
+void
+Timing_engraver::do_process_requests()
+{
+ for (int i=0; i < timing_req_l_arr_.size (); i++)
+ {
+ Timing_req * tr_l = timing_req_l_arr_[i];
+ Meter_change_req *m_l = tr_l->meterchange();
+ if (m_l)
+ {
+ int b_i= m_l->beats_i_;
+ int o_i = m_l->one_beat_i_;
+ if (! time_.allow_meter_change_b())
+ tr_l->warning ("Meter change not allowed here");
+ else
+ {
+ time_.set_meter (b_i, o_i);
+ default_grouping_ =
+ Rhythmic_grouping (MInterval (0,Moment (b_i, o_i)), b_i);
+ }
+ }
+ else if (tr_l->partial())
+ {
+ Moment m = tr_l->partial()->duration_;
+ String error = time_.try_set_partial_str (m);
+ if (error != "")
+ {
+ tr_l->warning (error);
+ }
+ else
+ time_.setpartial (m);
+ }
+ else if (tr_l->barcheck())
+ {
+ if (time_.whole_in_measure_)
+ {
+ tr_l ->warning ("Barcheck failed");
+
+ time_.whole_in_measure_ = 0; // resync
+ time_.error_b_ = true;
+ }
+
+ }
+ else if (tr_l->cadenza())
+ {
+ time_.set_cadenza (tr_l->cadenza()->on_b_);
+
+ }
+ else if (tr_l->measuregrouping())
+ {
+ default_grouping_ =
+ parse_grouping (tr_l->measuregrouping()->beat_i_arr_,
+ tr_l->measuregrouping()->elt_length_arr_);
+
+ }
+ }
+}
+
+
+void
+Timing_engraver::do_pre_move_processing()
+{
+ timing_req_l_arr_.set_size (0);
+ Engraver_group_engraver * grav_l = daddy_grav_l_;
+ while (grav_l->daddy_grav_l_)
+ {
+ grav_l = grav_l->daddy_grav_l_;
+ }
+
+ assert (grav_l->name() == Score_engraver::static_name ());
+ if (!time_.cadenza_b_)
+ ((Score_engraver*)grav_l)->add_moment_to_process (time_.next_bar_moment());
+}
+
+IMPLEMENT_IS_TYPE_B1(Timing_engraver, Engraver);
+ADD_THIS_ENGRAVER(Timing_engraver);
+
+void
+Timing_engraver::do_creation_processing()
+{
+ time_.when_ = get_staff_info().when ();
+}
+
+void
+Timing_engraver::do_post_move_processing()
+{
+ time_.add (get_staff_info().when () - time_.when_);
+}
-#endif
void
-Translator::print()const
+Translator::print() const
{
}
}
Real where_f=0;
- for ( int i=0 ; i < elem_l_arr_.size(); i++)
+ for (int i=0 ; i < elem_l_arr_.size(); i++)
{
elem_l_arr_[i]->translate (- dims[i][1] - where_f, Y_AXIS);
where_f += dims[i].length();
}
bool
-Vertical_align_element::contains_b (Score_elem const *e)const
+Vertical_align_element::contains_b (Score_elem const *e) const
{
return elem_l_arr_.find_l (e);
}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-
+#include "p-col.hh"
#include "vertical-align-grav.hh"
#include "vertical-align-spanner.hh"
Vertical_align_engraver::do_creation_processing()
{
valign_p_ =new Vertical_align_spanner;
- valign_p_->left_col_l_ = get_staff_info().command_pcol_l () ;
+ valign_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
announce_element (Score_elem_info (valign_p_ , 0));
}
void
Vertical_align_engraver::do_removal_processing()
{
- valign_p_->right_col_l_ = get_staff_info().command_pcol_l ();
+ valign_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
typeset_element (valign_p_);
valign_p_ =0;
}
void
Vertical_align_engraver::acknowledge_element (Score_elem_info i)
{
- if ( i.origin_grav_l_arr_.size() == 2 &&
- i.elem_l_->is_type_b (Vertical_group_element::static_name()) &&
- !i.elem_l_->axis_group_l_a_[Y_AXIS] )
- {
- assert (!valign_p_->contains_b (i.elem_l_));
+ if (i.origin_grav_l_arr_.size() == 2 &&
+ i.elem_l_->is_type_b (Vertical_group_element::static_name()) &&
+ !i.elem_l_->axis_group_l_a_[Y_AXIS])
+ {
+ assert (!valign_p_->contains_b (i.elem_l_));
- valign_p_->add ( i.elem_l_);
+ valign_p_->add (i.elem_l_);
}
}
Voice_group_engravers::Voice_group_engravers()
{
- dir_i_ =0;
+ dir_ =CENTER;
}
bool
Command_req* c_l = r_l->command();
if (c_l&& c_l->groupfeature())
{
- Feature f;
- f.type_ = c_l->groupfeature()->type_str_;
- f.value_ = c_l->groupfeature()->value_str_;
- set_feature (f);
- return true;
+ Feature f;
+ f.type_ = c_l->groupfeature()->type_str_;
+ f.value_ = c_l->groupfeature()->value_str_;
+ set_feature (f);
+ return true;
}
return Engraver_group_engraver::do_try_request (r_l);
}
Voice_group_engravers::get_feature (String f)
{
if (f == "vdir")
- return dir_i_;
+ return dir_;
Engraver_group_engraver::get_feature (f);
}
--- /dev/null
+/*
+ voice-iter.cc -- implement Voice_iterator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "translator.hh"
+#include "debug.hh"
+#include "voice-iterator.hh"
+#include "music-list.hh"
+
+
+void
+Voice_iterator::do_print() const
+{
+ if (iter_p_)
+ iter_p_->print();
+}
+
+Voice_iterator::Voice_iterator (Voice const*v)
+ : PCursor<Music*> (v->music_p_list_)
+{
+ here_mom_ = v->offset_mom_;
+ voice_C_ = v;
+ iter_p_ =0;
+}
+
+void
+Voice_iterator::construct_children()
+{
+ while (PCursor<Music*>::ok())
+ {
+ start_next_element();
+ if (!iter_p_->ok())
+ {
+ leave_element();
+ }
+ else
+ {
+ set_voice_translator();
+ break;
+ }
+ }
+}
+
+void
+Voice_iterator::leave_element()
+{
+ delete iter_p_;
+ iter_p_ =0;
+ MInterval elt_time = ptr()->time_int ();
+ if (!elt_time.empty_b())
+ here_mom_ += elt_time.length();
+ PCursor<Music*>::next();
+}
+
+void
+Voice_iterator::start_next_element()
+{
+ assert (!iter_p_);
+ iter_p_ = get_iterator_p (ptr());
+}
+
+void
+Voice_iterator::set_voice_translator()
+{
+ if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ())
+ set_translator (iter_p_->report_to_l());
+}
+
+Voice_iterator::~Voice_iterator()
+{
+ assert (! iter_p_);
+}
+
+
+IMPLEMENT_IS_TYPE_B1(Voice_iterator,Music_iterator);
+
+void
+Voice_iterator::process_and_next (Moment until)
+{
+ while (1)
+ {
+ Moment local_until = until - here_mom_;
+ while (iter_p_->ok())
+ {
+ Moment here = iter_p_->next_moment();
+ if (here != local_until)
+ goto loopexit;
+
+ iter_p_->process_and_next (local_until);
+ }
+
+ if (!iter_p_->ok())
+ {
+ leave_element();
+
+ if (PCursor<Music*>::ok())
+ {
+ start_next_element();
+ set_voice_translator();
+ }
+ else
+ {
+ goto loopexit;
+ }
+ }
+ }
+
+loopexit:
+
+ Music_iterator::process_and_next (until);
+}
+
+Moment
+Voice_iterator::next_moment() const
+{
+ return iter_p_->next_moment() + here_mom_;
+}
+
+bool
+Voice_iterator::ok() const
+{
+ return iter_p_;
+}
+
+
*/
Array<Col_hpositions>
-Word_wrap::do_solve()const
+Word_wrap::do_solve() const
{
problem_OK();
- PCursor<PCol*> curcol (pscore_l_->col_p_list_.top());
+ PCursor<Paper_column*> curcol (pscore_l_->col_p_list_.top());
Array<Col_hpositions> breaking;
Line_of_cols breakpoints (find_breaks());
assert (breakpoints.size()>=2);
int break_idx_i=0;
- while ( break_idx_i < breakpoints.size() -1)
+ while (break_idx_i < breakpoints.size() -1)
{
- Col_hpositions minimum;
- Col_hpositions current;
+ Col_hpositions minimum;
+ Col_hpositions current;
// do another line
- PCol *post = breakpoints[break_idx_i]->postbreak_p_;
- current.add (post);
- curcol++; // skip the breakable.
- break_idx_i++;
+ Paper_column *post = breakpoints[break_idx_i]->postbreak_l();
+ current.add (post);
+ curcol++; // skip the breakable.
+ break_idx_i++;
- while (break_idx_i < breakpoints.size())
- {
+ while (break_idx_i < breakpoints.size())
+ {
- // add another measure.
- while (breakpoints[break_idx_i] != curcol.ptr())
- {
- current.add (curcol);
- curcol++;
- }
- current.add (breakpoints[break_idx_i]->prebreak_p_);
-
- current.spacer_l_ = generate_spacing_problem (current.cols);
-
- // try to solve
- if (!feasible (current.cols))
- {
- if (!minimum.cols.size())
- {
- warning ("Ugh, this measure is too long, breakpoint: "
- + String (break_idx_i) +
- " (generating stupido solution)");
- current.stupid_solution();
- current.energy_f_ = - 1; // make sure we break out.
- }
- else
- current.energy_f_ = infinity_f; // make sure we go back
- }
- else
- {
+ // add another measure.
+ while (breakpoints[break_idx_i] != curcol.ptr())
+ {
+ current.add (curcol);
+ curcol++;
+ }
+ current.add (breakpoints[break_idx_i]->prebreak_l());
+
+ current.spacer_l_ = generate_spacing_problem (current.cols);
+
+ // try to solve
+ if (!feasible (current.cols))
+ {
+ if (!minimum.cols.size())
+ {
+ warning ("Ugh, this measure is too long, breakpoint: "
+ + String (break_idx_i) +
+ " (generating stupido solution)");
+ current.stupid_solution();
+ current.energy_f_ = - 1; // make sure we break out.
+ }
+ else
+ current.energy_f_ = infinity_f; // make sure we go back
+ }
+ else
+ {
- current.solve_line();
- current.print();
- }
-
- delete current.spacer_l_;
- current.spacer_l_ =0;
-
- // update minimum, or backup.
- if (current.energy_f_ < minimum.energy_f_ || current.energy_f_ < 0)
- {
- minimum = current;
- }
- else { // we're one col too far.
- break_idx_i--;
- while (curcol.ptr() != breakpoints[break_idx_i])
- curcol --;
- break; // do the next line.
- }
-
-
- // add nobreak version of breakable column
- current.cols.top()=breakpoints[break_idx_i];
- curcol ++;
- break_idx_i++;
+ current.solve_line();
+ current.print();
+ }
+
+ delete current.spacer_l_;
+ current.spacer_l_ =0;
+
+ // update minimum, or backup.
+ if (current.energy_f_ < minimum.energy_f_ || current.energy_f_ < 0)
+ {
+ minimum = current;
+ }
+ else { // we're one col too far.
+ break_idx_i--;
+ while (curcol.ptr() != breakpoints[break_idx_i])
+ curcol --;
+ break; // do the next line.
}
- *mlog << "[" <<break_idx_i<<"]"<<flush;
- breaking.push (minimum);
+
+ // add nobreak version of breakable column
+ current.cols.top()=breakpoints[break_idx_i];
+ curcol ++;
+ break_idx_i++;
+ }
+
+ *mlog << "[" <<break_idx_i<<"]"<<flush;
+ breaking.push (minimum);
}
print_stats();
return breaking;
Begin3
Title: LilyPond
-Version: 0.1.10
-Entered-date: 20AUG97
+Version: 0.1.11
+Entered-date: 30AUG97
Description: GNU LilyPond is a program which converts music
definition files into visual or auditive output: it can
typeset formatted sheet music to a TeX file and and
jan@digicash.com (Jan Nieuwenhuizen)
Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
Primary-site: sunsite.unc.edu /pub/Linux/apps
- 340k lilypond-0.1.10.tar.gz
+ 340k lilypond-0.1.11.tar.gz
Original-site: pcnov095.win.tue.nl /pub/lilypond/
- 340k lilypond-0.1.10.tar.gz
+ 340k lilypond-0.1.11.tar.gz
Copying-policy: GPL
End
Name: lilypond
-Version: 0.1.10
+Version: 0.1.11
Release: 1
Copyright: GPL
Group: Applications/Publishing
-Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.10.tar.gz
+Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.11.tar.gz
Summary: A preprocessor to make TeX typeset music.
URL: http://www.stack.nl/~hanwen/lilypond
Packager: Han-Wen Nienhuys <hanwen@stack.nl>
make prefix="$RPM_BUILD_ROOT/usr" install
%files
%doc Documentation/out/AUTHORS.text Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/convert-mudela.text Documentation/out/faq.text Documentation/out/gnu-music.text Documentation/out/index.text Documentation/out/internals.text Documentation/out/language.text Documentation/out/lilypond.text Documentation/out/links.text Documentation/out/literature.text Documentation/out/mi2mu.text Documentation/out/mudela-book.text Documentation/out/mutopia.text Documentation/out/other-packages.text BUGS TODO NEWS DEDICATION ANNOUNCE README
-%doc input/beams.ly input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/gallina.ly input/gallina.tex input/header.ly input/keys.ly input/kortjakje.ly input/multi.ly input/pedal.ly input/rhythm.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen-16.ly input/standchen-20.ly input/standchen-20.tex input/standchen-part.ly input/toccata-fuga-E.ly input/twinkle-pop.ly input/twinkle.ly input/wohltemperirt.ly Documentation/mudela-course.doc Documentation/mudela-man.doc
+%doc input/beams.ly input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/fugue1.ly input/gallina.ly input/gallina.tex input/header.ly input/keys.ly input/kortjakje.ly input/multi.ly input/pedal.ly input/prelude1.ly input/rhythm.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen-16.ly input/standchen-16.tex input/standchen-20.ly input/standchen-20.tex input/standchen-part.ly input/toccata-fuga-E.ly input/twinkle-pop.ly input/twinkle.ly input/wohltemperirt.ly Documentation/mudela-course.doc Documentation/mudela-man.doc
%doc Documentation/out/lelie_logo.gif
/usr/bin/convert-mudela
/usr/bin/mudela-book
tracks_i_ = tracks_i;
tempo_i_ = tempo_i;
column_l_array_.push (new Mudela_column (this, Moment (0)));
-// mudela_key_l_ = &key_c;
+ // mudela_key_l_ = &key_c;
mudela_key_l_ = 0;
mudela_meter_l_ = &meter_4;
mudela_tempo_l_ = &tempo_60;
// should do binary search
for (int i = 0; i < column_l_array_.size (); i++ )
if ( column_l_array_[i]->at_mom () == mom )
- return column_l_array_[i];
+ return column_l_array_[i];
return 0;
#else
int upper_i = max (0, column_l_array_.size () - 1);
// ugh, ugly midi type 1 fix
if ( (mudela_staff_p_list_.size() == 1) && !mudela_staff_p_list_.top()->number_i_)
- mudela_staff_p_list_.top()->number_i_ = 1;
+ mudela_staff_p_list_.top()->number_i_ = 1;
int track_i = 0;
Mudela_stream mudela_stream (filename_str);
for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
{
- LOGOUT(NORMAL_ver) << "track " << track_i++ << ": " << flush;
- i->output (mudela_stream);
- mudela_stream << "\n";
- LOGOUT(NORMAL_ver) << endl;
+ LOGOUT(NORMAL_ver) << "track " << track_i++ << ": " << flush;
+ i->output (mudela_stream);
+ mudela_stream << "\n";
+ LOGOUT(NORMAL_ver) << endl;
}
mudela_stream << "\\score{\n";
if (mudela_staff_p_list_.size() > 1)
- mudela_stream << "<\n\\multi 3;\n";
+ mudela_stream << "<\n\\multi 3;\n";
for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
{
- if ( (mudela_staff_p_list_.size() != 1)
+ if ( (mudela_staff_p_list_.size() != 1)
&& (i == mudela_staff_p_list_.top()))
- continue;
- mudela_stream << "\\melodic{ ";
- mudela_stream << "\\$" << i->id_str();
- mudela_stream << " }\n";
+ continue;
+ mudela_stream << "\\melodic{ ";
+ mudela_stream << "\\$" << i->id_str();
+ mudela_stream << " }\n";
}
if (mudela_staff_p_list_.size() > 1)
- mudela_stream << ">\n";
+ mudela_stream << ">\n";
mudela_stream << "\\paper{}\n";
mudela_stream << "\\midi{\n";
- // let's not use silly 0 track
- mudela_staff_p_list_.bottom()->mudela_tempo_p_->output (mudela_stream);
+ // let's not use silly 0 track
+ mudela_staff_p_list_.bottom()->mudela_tempo_p_->output (mudela_stream);
mudela_stream << "}\n";
mudela_stream << "}\n";
LOGOUT(NORMAL_ver) << "\nProcessing..." << endl;
LOGOUT(DEBUG_ver) << "columns\n";
-// for (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++)
-// LOGOUT(DEBUG_ver) << "At: " << i->at_mom() << "\n";
+ // for (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++)
+ // LOGOUT(DEBUG_ver) << "At: " << i->at_mom() << "\n";
settle_columns();
filter_tempo();
int track_i = 0;
for (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)
{
- LOGOUT(NORMAL_ver) << "track " << track_i++ << ": " << flush;
- i->process();
- LOGOUT(NORMAL_ver) << endl;
+ LOGOUT(NORMAL_ver) << "track " << track_i++ << ": " << flush;
+ i->process();
+ LOGOUT(NORMAL_ver) << endl;
}
}
// ugh
if (Duration_convert::no_quantify_b_s)
{
- LOGOUT(NORMAL_ver) << "\nNOT Quantifying columns..." << endl;
- return;
+ LOGOUT(NORMAL_ver) << "\nNOT Quantifying columns..." << endl;
+ return;
}
LOGOUT(NORMAL_ver) << "\nQuantifying columns..." << endl;
for (int i = 0; i < column_l_array_.size(); i++)
{
column_l_array_ [i]->at_mom_ =
- s * Moment((int) ((column_l_array_ [i]->at_mom()) / s));
+ s * Moment( (int) ( (column_l_array_ [i]->at_mom()) / s));
int bar_i = (int) (column_l_array_ [i]->at_mom () / bar_mom) + 1;
if (bar_i > current_bar_i)
void
Mudela_score::quantify_durations()
{
-// LOGOUT(NORMAL_ver) << "\nQuantifying durations..." << endl;
+ // LOGOUT(NORMAL_ver) << "\nQuantifying durations..." << endl;
}
void
Mudela_score::settle_columns()
{
-// LOGOUT(NORMAL_ver) << "\nNOT Settling columns..." << endl;
-// return;
+ // LOGOUT(NORMAL_ver) << "\nNOT Settling columns..." << endl;
+ // return;
LOGOUT(NORMAL_ver) << "\nSettling columns..." << endl;
#if 0
assert (!column_l_array_.size());
int n = mudela_column_p_list_.size();
-// huh?
-// column_l_array_.set_size (n);
+ // huh?
+ // column_l_array_.set_size (n);
for (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++)
- column_l_array_.push (*i);
+ column_l_array_.push (*i);
#endif
int n = column_l_array_.size();
Duration smallest_dur;
smallest_dur.durlog_i_ = 6;
Moment const noise_mom = Duration_convert::dur2_mom (smallest_dur)
- / Moment (2);
+ / Moment (2);
for (int i = 0; i < n; i++)
{
- if (!start_i)
- {
- start_i = end_i = i;
- start_mom = column_l_array_ [i]->at_mom();
- continue;
- }
-
- // find all columns within noise's distance
- while ( (i < n)
- && (column_l_array_ [i]->at_mom() - start_mom < noise_mom))
- end_i = ++i;
-
- // bluntly set all to time of first in group
- for (int j = start_i; j < end_i; j++)
- column_l_array_ [j]->at_mom_ = start_mom;
-
- start_i = end_i = 0;
+ if (!start_i)
+ {
+ start_i = end_i = i;
+ start_mom = column_l_array_ [i]->at_mom();
+ continue;
+ }
+
+ // find all columns within noise's distance
+ while ( (i < n)
+ && (column_l_array_ [i]->at_mom() - start_mom < noise_mom))
+ end_i = ++i;
+
+ // bluntly set all to time of first in group
+ for (int j = start_i; j < end_i; j++)
+ column_l_array_ [j]->at_mom_ = start_mom;
+
+ start_i = end_i = 0;
}
}
#include "plist.hh"
#include "plist.tcc"
-template IPL_INSTANTIATE(Mudela_item);
-template IPL_INSTANTIATE(Mudela_staff);
-template PL_INSTANTIATE(Mudela_voice);
-template IPL_INSTANTIATE(Mudela_voice);
-template IPL_INSTANTIATE(Mudela_column);
+template POINTERLIST_INSTANTIATE(Mudela_item);
+template POINTERLIST_INSTANTIATE(Mudela_staff);
+template POINTERLIST_INSTANTIATE(Mudela_voice);
+template POINTERLIST_INSTANTIATE(Mudela_voice);
+template POINTERLIST_INSTANTIATE(Mudela_column);