+[Draft version]
+[Draft version]
CALL FOR HACKERS: LilyPond, the Music Typesetter
>
The DOC++ documentation of the C++ sources.
</a
->
\ No newline at end of file
+>
+
+=item *
+<a href=ftp://pcnov095.win.tue.nl/pub/lilypond
+>
+Get it!
+</a
+>
+
+=head1 AUTHOR
+
+Han-Wen Nienhuys <hanwen@stack.nl>, for this page
before 0.1
- * remove spurious/outdated comments in .ly
+ * remove spurious/outdated comments in .ly, debug .ly
* pushgroup, popgroup.
* caching of Register_group_register hierarchies.
+ * midi esp.: use I32 iso int where 32 bits are needed (or assumed...)
+
This is an assorted collection of stuff that will be done, might be
done, or is an idea that I want to think about
* do platform stuff: configure, header(s), targets, build (out?)
+ * make install.
+
BUGS
+ * barf if no score_wde_music
+
* plet bugs: scales.ly
* key at clef change.
* use (char *) iso. String for communication between lexer and
parser.
- * configure idealspacing: arithmetic spacing
-
- * fix linking: `Warning: size of symbol'
+ * configure idealspacing: arithmetic
* collision Request_register.
+ * make install (gnu dir names)
+
* LilyPond .rpm and .deb
DOC
IDEAS
+ * integrate Register/Midi stuff
+
* create libmudela, or liblily_frontend
* Horizontal_align_item, Vertical_align_item.
my $username=$pw[6];
my $what="implement ";
$what = "declare " if ($hh_q);
+my ($PROJECT, $cwd);
+$PROJECT = "the LilyPond music typesetter";
+chop($cwd = `pwd`);
+
+$PROJECT= "the Flower Library" if ($cwd =~ /flower/);
my $headstr ="/*
$fn -- $what
- source file of the LilyPond music typesetter
+ source file of $PROJECT
(c) 1997 $username <$MAILADRESS>
*/\n";
echo cant find $newarc
exit
fi
- tar zfxv $newarc
+ tar zfx $newarc
fi
if [ ! -x $nm$old ]
then
if [ ! -f $oldarc ]
then
- echo cant find oldarc
+ echo cant find $oldarc
exit
fi
- tar zfxv $oldarc
+ tar zfx $oldarc
fi
#(cd $nm$old; touch depend; make clean)
}
}
+sub all_refs
+{
+ print "resetting refs.\n";
+
+ foreach $a (<*.html>)
+ {
+ rename $a, "$a~";
+ open HTMLIN, "$a~";
+ open HTMLOUT, ">$a";
+ set_hrefs;
+ }
+}
+
local $base="lilypond/";
local @examples=("wohltemperirt");
system 'pod2html';
-print "resetting refs.\n";
-
-foreach $a (<*.html>)
-{
- rename $a, "$a~";
- open HTMLIN, "$a~";
- open HTMLOUT, ">$a";
- set_hrefs;
-}
+print "generating examples";
foreach $a (@examples) {
$texfile="test";
+
+
#include <fstream.h>
#include "assoc.hh"
#include "dstream.hh"
local_silence = (*silent)[idx];
if (classname != idx && !local_silence) {
classname=idx;
-// *os << "[" << classname << ":]"; // messy.
+ if (!(*silent)["Dstream"])
+ *os << "[" << classname << ":]"; // messy.
}
return *this;
}
#ifndef FPROTO_HH
#define FPROTO_HH
+// what the F*** is "int" ?
+// depreciate int, long, etc., use i32, i64, remember: linux-16/linux-64 ?
+/// (i32)
+typedef int i32;
+/// (i64)
+typedef long long I64;
+
#include "flower-config.hh"
template<class T> struct Array;
template<class T> struct PCursor;
template<class T> struct Link;
template<class T> struct Handle;
-template<class T>struct Interval_t;
+template<class T> struct Interval_t;
+template<class T,class Q> struct PQueue;
+
#include "real.hh"
typedef Interval_t<Real> Interval;
--- /dev/null
+
+ppp = dynamic {7 }
+pp = dynamic { 6 }
+p = dynamic { 5 }
+mp = dynamic { 4 }
+mf = dynamic { 3 }
+f = dynamic { 2 }
+ff = dynamic { 1 }
+fff = dynamic { 0 }
+
-
+include "dynamic.ini"
include "dutch.ini" # do not include init/ path
include "script.ini"
include "table_sixteen.ini"
%
-% spacing info for LilyPond. Do not edit this.
+% spacing info for LilyPond. Do not edit this if you're not a guru.
% It has a lot of hard-wired stringconstants
%
table_sixteen=
symboltables {
-
+
texid "\musixsixteendefs"
% index TeXstring, xmin xmax ymin ymax
"scripts" = table {
"fermata" "\fermata" 0pt 0pt 0pt 6pt
"-fermata" "\ifermata" 0pt 0pt -6pt 0pt
- "portato" "\portato" 0pt 0pt 0pt 0pt
- "-portato" "\iportato" 0pt 0pt 0pt 0pt
- "tenuto" "\tenuto" 0pt 0pt 0pt 0pt
- "-tenuto" "\itenuto" 0pt 0pt 0pt 0pt
+ "portato" "\portato"
+ "-portato" "\iportato"
+ "tenuto" "\tenuto"
+ "-tenuto" "\itenuto"
"sforzato" "\sforzato" -0.8pt 4.8pt -1.92pt 1.92pt
"marcato" "\marcato" 0pt 4.8pt 0pt 4pt
- "-marcato" "\imarcato" 0pt 4.8pt -4pt 0pt
+ "-marcato" "\imarcato" 0pt 4.8pt -4pt 0pt
"staccato" "\staccato" 0pt 0pt 0pt 5pt
"staccatissimo" "\staccatissimo" 0pt 0pt 0pt 7.5pt
"-staccatissimo" "\istaccatissimo" 0pt 0pt -7.5pt 0pt
"style" = table {
"roman" "\settext{%}" 0pt 0pt 0pt 8pt
"italic" "\setitalic{%}" 0pt 0pt 0pt 8pt
+ "dynamic" "\setdynamic{%}" 0pt 0pt 0pt 8pt
}
+ "dynamics" = table {
+
+ "mf" "\dynmf"
+ "fff" "\dynfff"
+ "ff" "\dynff"
+ "f" "\dynf"
+ "mp" "\dynmp"
+ "p" "\dynp"
+ "pp" "\dynpp"
+ "ppp" "\dynppp"
+
+ }
"align" = table {
- "-1" "\leftalign{%}" 0pt 0pt 0pt 0pt
- "0" "\centeralign{%}" 0pt 0pt 0pt 0pt
- "1" "\rightalign{%}" 0pt 0pt 0pt 0pt
+ "-1" "\leftalign{%}"
+ "0" "\centeralign{%}"
+ "1" "\rightalign{%}"
}
"clefs" = table {
}
"slur" = table {
- "whole" "\slurchar%{%}" 0pt 0pt 0pt 0pt
- "half" "\hslurchar%{%}" 0pt 0pt 0pt 0pt
+ "whole" "\slurchar%{%}"
+ "half" "\hslurchar%{%}"
}
"accidentals" = table {
"-2" "\flatflat" 0pt 10.2pt -2.5pt 7.5pt
}
"bars" = table {
- "empty" "\emptybar" 0pt 0pt 0pt 0pt
+ "empty" "\emptybar"
"|" "\maatstreep" 0pt 0.4pt -8pt 8pt
"||" "\finishbar" 0pt 2pt -8pt 8pt
":|" "\repeatbar" -4pt 0pt -8pt 8pt
"param" = table {
"meter" "\generalmeter{%}{%}" 0pt 10pt -5pt 5pt
"linestaf" "\linestafsym{%}{%}"
- "stem" "\stem{%}{%}"
+ "stem" "\stem{%}{%}"
"fill" "\hbox{}"
"crescendo" "\crescendosym{%}" 0pt 0pt -3pt 3pt
"decrescendo" "\decrescendosym{%}" 0pt 0pt -3pt 3pt
}
"flags" = table {
- "8" "\eigthflag" 0pt 4pt 0pt 0pt
+ "8" "\eigthflag" 0pt 4pt 0pt 0pt
"16" "\sixteenthflag" 0pt 4pt 0pt 0pt
"32" "\thirtysecondflag" 0pt 4pt 0pt 0pt
"-8" "\deigthflag" 0pt 4pt 0pt 0pt
}
"beamslopes" = table {
- "slope" "\beamslope{%}{%}"
- "horizontal" "\rulesym{%}{%}"
+ "slope" "\beamslope{%}{%}"
+ "horizontal" "\rulesym{%}{%}"
}
}
\duration { 8}
\textstyle "italic"
\clef \violin
- 'c4._"f" g8
+ 'c4.\mf g8
\textstyle "roman"
['e^"accel" ()'d 'c b]
}
paper {}
midi { tempo 4:80 }
-}
\ No newline at end of file
+}
#include "fproto.hh"
#include "real.hh"
-/// (i64)
-typedef long long Int64;
-
-struct Absdynamic_req;
+struct Absolute_dynamic_req;
struct Accidental;
struct Atom;
struct Bar;
struct Bar_req;
struct Beam;
struct Beam_req;
+struct Blank_req;
struct Box;
struct Bracket_req;
struct Cadenza_req;
struct Duration_iterator;
struct Durational_req;
struct Dynamic;
+struct Dynamic_req;
struct Group_change_req;
struct Group_feature_req;
struct Idealspacing;
struct Midi_voice;
struct Midi_walker;
struct Mixed_qp;
-class My_midi_lexer;
-class My_midi_parser;
-class Midi_event;
-class Midi_score;
-class Midi_track;
+struct My_midi_lexer;
+struct My_midi_parser;
+struct Midi_event;
+struct Midi_score;
+struct Midi_track;
struct Molecule;
struct Musical_req;
struct Music_general_chord;
struct Spacing_req ;
struct Span_req;
struct Spanner;
-struct Blank_req;
+struct Subtle_req;
struct Staff;
struct Staff_column;
struct Staff_elem;
Molecule*
Bar::brew_molecule_p()const
{
- Symbol s = paper()->lookup_p_->bar(type);
+ Symbol s = paper()->lookup_l()->bar(type);
Molecule*output = new Molecule(Atom(s));
return output;
}
// URG
Real sl = slope*paper()->internote();
- paper()->lookup_p_->beam(sl, 20 PT);
+ paper()->lookup_l()->beam(sl, 20 PT);
slope = sl /paper()->internote();
}
Real dy=paper()->internote()*2;
Real stemdx = paper()->rule_thickness();
Real sl = slope*paper()->internote();
- paper()->lookup_p_->beam(sl, 20 PT);
+ paper()->lookup_l()->beam(sl, 20 PT);
Molecule leftbeams;
Molecule rightbeams;
Symbol dummy;
Atom a(dummy);
if (lhalfs) // generates warnings if not
- a = paper()->lookup_p_->beam(sl, w);
+ a = paper()->lookup_l()->beam(sl, w);
a.translate(Offset (-w, -w * sl));
for (int j = 0; j < lhalfs; j++) {
Atom b(a);
int rwholebeams = here->beams_right <? next->beams_left;
Real w = next->hindex() - here->hindex();
- Atom a = paper()->lookup_p_->beam(sl, w + stemdx);
+ Atom a = paper()->lookup_l()->beam(sl, w + stemdx);
int j = 0;
for (; j < rwholebeams; j++) {
w /= 4;
if (rhalfs)
- a = paper()->lookup_p_->beam(sl, w);
+ a = paper()->lookup_l()->beam(sl, w);
for (; j < rwholebeams + rhalfs; j++) {
Atom b(a);
String t = type;
if (change)
t += "_change";
- Symbol s = paper()->lookup_p_->clef(t);
+ Symbol s = paper()->lookup_l()->clef(t);
Molecule*output = new Molecule(Atom(s));
output->translate(Offset(0, paper()->internote() * y_off));
return output;
--- /dev/null
+/*
+ dynamic-reg.cc -- implement Dynamic_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "dynamic-reg.hh"
+#include "musicalrequest.hh"
+#include "text-item.hh"
+#include "lookup.hh"
+#include "paper-def.hh"
+
+Dynamic_register::Dynamic_register()
+{
+ dir_i_ =0;
+ post_move_processing();
+ dynamic_p_ =0;
+}
+
+void
+Dynamic_register::post_move_processing()
+{
+ dynamic_req_l_ = 0;
+}
+
+bool
+Dynamic_register::try_request(Request * r)
+{
+ Musical_req * m = r->musical();
+ if (!m || !m->dynamic())
+ return false;
+ assert(!dynamic_req_l_);
+ dynamic_req_l_ = m->dynamic();
+ return true;
+}
+void
+Dynamic_register::process_requests()
+{
+ if(dynamic_req_l_){
+ if (dynamic_req_l_->absdynamic()) {
+ Text_def * td_p = new Text_def;
+ td_p->align_i_ = 0;
+ String loud =Dynamic_req::loudness_str(
+ dynamic_req_l_->absdynamic()->loudness_);
+
+ td_p->text_str_ = paper()->lookup_l()->dynamic(loud).tex;
+
+
+ td_p->style_str_ = "dynamic";
+
+ dynamic_p_ = new Text_item(td_p, 10 ); // TODO!
+ announce_element(Staff_elem_info(dynamic_p_, dynamic_req_l_));
+ }
+ }
+}
+
+void
+Dynamic_register::pre_move_processing()
+{
+ if (dynamic_p_) {
+ typeset_element(dynamic_p_);
+ dynamic_p_ = 0;
+ }
+}
+
+bool
+Dynamic_register::acceptable_request_b(Request*r)const
+{
+ Musical_req * m = r->musical();
+ return (m && m->dynamic());
+}
+
+void
+Dynamic_register::set_feature(Features i)
+{
+ dir_i_ = i.direction_i_;
+}
DEFAULT_PRINT(Staff_id, Input_staff, staff);
DEFAULT_PRINT(M_chord_id, Music_general_chord, mchord);
DEFAULT_PRINT(M_voice_id, Music_voice, mvoice);
-
+DEFAULT_PRINT(Request_id, Request, request);
void
Real_id::do_print() const
{
{
mtor << "unknown" << "\n";
}
+
--- /dev/null
+/*
+ dynamic-reg.hh -- declare Dynamic_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef DYNAMIC_REG_HH
+#define DYNAMIC_REG_HH
+
+#include "register.hh"
+
+struct Dynamic_register : Request_register {
+ int dir_i_;
+ Text_item * dynamic_p_;
+ Dynamic_req* dynamic_req_l_;
+ /* ************** */
+ Dynamic_register();
+ virtual bool try_request(Request *req_l);
+ virtual void process_requests();
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ virtual bool acceptable_request_b(Request*) const;
+ virtual void set_feature(Features);
+ NAME_MEMBERS(Dynamic_register);
+};
+
+#endif // DYNAMIC_REG_HH
#ifndef IDENTIFIER_HH
#define IDENTIFIER_HH
+
#include "identparent.hh"
#include "symtable.hh"
#include "input-staff.hh"
#include "notename.hh"
#include "lookup.hh"
#include "script-def.hh"
+#include "request.hh"
#define make_id_class(Idclass, Class, accessor) \
struct Idclass : Identifier {\
virtual const char *classname() { return #Class; }\
- Idclass(String s, Class*st):Identifier(s) { data = st; }\
+ Idclass(String s, Class*st, int code):Identifier(s,code) { data = st; }\
virtual Class* accessor(bool copy) {\
if (copy)\
return new Class(* (Class*) data);\
make_id_class(M_chord_id, Music_general_chord, mchord);
make_id_class(M_voice_id, Music_voice, mvoice);
make_id_class(Notetab_id, Notename_tab, notename_tab);
+make_id_class(Request_id, Request, request);
#endif // IDENTIFIER_HH
#define IDACCESSOR( Input_staff, staff)\
virtual Input_staff * staff(bool) { error(#Input_staff); return 0; }
+
struct Identifier {
void *data;
String name;
+ int token_code_i_;
- Identifier(String n) : name(n) { }
+ Identifier(String n, int code) : name(n) { token_code_i_ = code; }
virtual ~Identifier() {}
void print()const;
IDACCESSOR(Lookup,lookup)
IDACCESSOR(Real,real)
IDACCESSOR(Notename_tab, notename_tab)
+ IDACCESSOR(Request, request)
+
protected:
virtual void do_print()const=0;
private:
/* *************** */
void add(String, Symtable*);
void print()const;
- Real internote();
+ Real internote()const;
- Symbol linestaff(int n, Real w);
- Symbol fill(Box b);
- Symbol beam_element(int,int,Real=0);
+ 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);
+ Symbol beam(Real&,Real)const;
/**
pos == 3 : 3 lines above staff (extending below note)
pos == -3: below staff
*/
- Symbol streepjes(int pos);
-
- Symbol meter(Array<Scalar>);
- Symbol stem(Real y1_pos, Real y2_pos);
- Symbol rule_symbol(Real height, Real width);
- Symbol accidental(int);
- Symbol ball(int);
- Symbol flag(int);
- Symbol rest(int);
- Symbol clef(String);
- Symbol bar(String);
- Symbol dots(int);
- Symbol slur(int dy, Real &dx, int dir);
- Symbol half_slur(int dy, Real &dx, int dir, int xpart);
- Symbol half_slur_middlepart(Real &dx, int dir);
- Symbol big_slur(int dy, Real &dx, int dir);
- Symbol text(String style, String text, int align = 1);
- Symbol script(String idx);
- Symbol hairpin(Real & width, bool decresc);
-
+ Symbol streepjes(int pos)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)const;
+ Symbol clef(String)const;
+ Symbol bar(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();
*/
struct Musical_req : virtual Request {
virtual Skip_req* skip() { return 0; }
+ virtual Dynamic_req* dynamic() { return 0; }
+ virtual Absolute_dynamic_req * absdynamic() { return 0; }
+ virtual Subtle_req * subtle() { return 0; }
REQUESTMETHODS(Musical_req, musical);
};
};
-/**Put a script above or below this ``note''. eg upbow, downbow. Why a
-request? These symbols may conflict with slurs and brackets, so this
-also a request */
+/** Put a script above or below this ``note''. eg upbow, downbow. Why
+ a request? These symbols may conflict with slurs and brackets, so
+ this also a request */
struct Script_req : Musical_req {
int dir_i_;
Script_def *scriptdef_p_;
Script_req(Script_req const&);
};
+/** A helper in the hierarchy. Each dynamic is bound to one note ( a
+ crescendo spanning multiple notes is thought to be made of two
+ "dynamics": a start and a stop). Dynamic changes can occur in a
+ smaller time than the length of its note, therefore fore each
+ Dynamic request carries a time, measured from the start of its
+ note.
+ */
+struct Subtle_req : virtual Musical_req {
+ Moment subtime_;
+ REQUESTMETHODS(Subtle_req, subtle);
+};
+struct Dynamic_req : Subtle_req {
+ /// for absolute dynamics
+ enum Loudness {
+ FFF, FF, F, MF, MP, P, PP, PPP
+ };
+ static String loudness_str(Loudness);
+ REQUESTMETHODS(Dynamic_req, dynamic);
+};
+struct Absolute_dynamic_req : Dynamic_req {
+ Loudness loudness_;
+ Absolute_dynamic_req();
+ REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
+};
#endif // MUSICALREQUESTS_HH
constants. Most of them are related to the point-size of the fonts,
so therefore, the lookup table for symbols is also in here.
- see TODO
*/
-struct Paper_def {
+class Paper_def {
Lookup *lookup_p_;
+public:
String outfile;
Real linewidth;
Real standard_height()const;
Real note_width() const;
void print() const;
+ const Lookup* lookup_l(); // TODO naming
Real duration_to_dist(Moment);
};
int disallow_break_count_;
void reinit();
public:
+ bool break_allowed_b();
void allow_break(Staff_walker*w);
Score_walker(Score*);
~Score_walker();
Moment when() const;
void set_cols(Score_column *c1, Score_column *c2);
- void add(Voice_element*ve);
+ void add(Voice_element*ve, PQueue<Subtle_req *, Moment> &subtle_req_pq );
void OK() const;
~Staff_column();
void typeset_breakable_items(Array<Item *> &pre_p_arr,
Array<Item *> &nobreak_p_arr,
Array<Item *> &post_p_arr);
void typeset_musical_item(Item *i);
+ void setup_one_request(Request*);
protected:
- void setup_one_request(Request*);
};
#include "proto.hh"
#include "varray.hh"
+
/// data container.
struct Staff_elem_info {
Staff_elem * elem_p_;
const Voice * voice_l_;
Array<Request_register*> origin_reg_l_arr_;
-
/* *** */
Staff_elem_info(Staff_elem*, Request*);
Staff_elem_info();
Staff_walker *walk_l_;
const Time_description *time_c_l_;
const Rhythmic_grouping *rhythmic_c_l_;
+ bool break_allowed_b_;
};
#include "symbol.hh"
struct Symtable : public Assoc<String, Symbol> {
+ String id_str;
+
Symbol lookup(String)const;
void print()const;
};
~Symtables();
Symtables();
Symtables(Symtables const&);
- Assoc<String, Symtable*>::add;
+ void add(String, Symtable*);
void print()const;
};
char const* defined_ch_c_l_;
- /* ****************/
+ /* *************** */
virtual ~Text_def() {};
bool compare(const Text_def&);
Text_def();
#include "text-def.hh"
#include "item.hh"
-
-struct Text_item : Item {
+
+/**
+ print a fixed width text above or below the staff.
+ */
+class Text_item : public Item {
+ void init(Text_def* tdef_l,int staffsize_i);
+ Text_def* tdef_p_;
+public:
+ Text_def * tdef_l();
int pos_i_;
int staffsize_i_;
int dir_i_;
- Text_def* tdef_l_;
-
+
/* ***************/
+
NAME_MEMBERS(Text_item);
virtual void set_default_index();
Molecule* brew_molecule_p() const;
void do_pre_processing();
-
+ Text_item(Text_def*,int);
Text_item(Text_req*,int);
};
Real inter = paper()->internote();
for (int i =0; i < pitch.size(); i++) {
- Symbol s= paper()->lookup_p_->accidental(acc[i]);
+ Symbol s= paper()->lookup_l()->accidental(acc[i]);
Atom a(s);
a.translate(Offset(0,(c_position + pitch[i]) * inter));
Molecule m(a);
output->add_right(m);
}
- Molecule m(paper()->lookup_p_->fill(Box(
+ Molecule m(paper()->lookup_l()->fill(Box(
Interval(0, paper()->note_width()),
Interval(0,0))));
output->add_right(m);
#include "input-score.hh"
#include "parseconstruct.hh"
#include "main.hh"
+#include "identparent.hh"
%}
Identifier * id = lookup_identifier(c);
if (id) {
yylval.id = id;
- return IDENTIFIER;
+ return id->token_code_i_;
}
String *sp = new String( c);
yylval.string=sp;
octmol= new Molecule;
}
lastoct = accs[i].octave;
- Symbol s =paper()->lookup_p_->accidental(accs[i].acc);
+ Symbol s =paper()->lookup_l()->accidental(accs[i].acc);
Atom a(s);
Real dy = (accs[i].name + c0_position) * paper()->internote();
a.translate(Offset(0,dy));
}
Symbol
-Lookup::text(String style, String text, int dir)
+Lookup::text(String style, String text, int dir) const
{
Array<String> a;
Real
-Lookup::internote()
+Lookup::internote() const
{
return ball(4).dim.y.length()/2;
}
Symbol
-Lookup::ball(int j)
+Lookup::ball(int j) const
{
if (j > 4)
j = 4;
}
Symbol
-Lookup::rest(int j)
+Lookup::rest(int j) const
{
return (*symtables_)("rests")->lookup(String(j));
}
Symbol
-Lookup::fill(Box b)
+Lookup::fill(Box b) const
{
Symbol s( (*symtables_)("param")->lookup("fill"));
s.dim = b;
}
Symbol
-Lookup::accidental(int j)
+Lookup::accidental(int j) const
{
return (*symtables_)("accidentals")->lookup(String(j));
}
Symbol
-Lookup::bar(String s)
+Lookup::bar(String s) const
{
return (*symtables_)("bars")->lookup(s);
}
Symbol
-Lookup::script(String s)
+Lookup::script(String s) const
{
return (*symtables_)("scripts")->lookup(s);
}
Symbol
-Lookup::clef(String s)
+Lookup::dynamic(String s) const
+{
+ return (*symtables_)("dynamics")->lookup(s);
+}
+
+Symbol
+Lookup::clef(String s) const
{
return (*symtables_)("clefs")->lookup(s);
}
Symbol
-Lookup::dots(int j)
+Lookup::dots(int j) const
{
if (j>3)
error("max 3 dots"); // todo
}
Symbol
-Lookup::flag(int j)
+Lookup::flag(int j) const
{
return (*symtables_)("flags")->lookup(j);
}
Symbol
-Lookup::streepjes(int i)
+Lookup::streepjes(int i) const
{
assert(i);
}
Symbol
-Lookup::hairpin(Real &wid, bool decresc)
+Lookup::hairpin(Real &wid, bool decresc) const
{
int idx = int(rint(wid / 6 PT));
if(!idx) idx ++;
}
Symbol
-Lookup::linestaff(int lines, Real wid)
+Lookup::linestaff(int lines, Real wid) const
{
Symbol s;
s.dim.x = Interval(0,wid);
Symbol
-Lookup::meter(Array<Scalar> a)
+Lookup::meter(Array<Scalar> a) const
{
Symbol s;
s.dim.x = Interval( 0 PT, 10 PT);
Symbol
-Lookup::stem(Real y1,Real y2)
+Lookup::stem(Real y1,Real y2) const
{
if (y1 > y2) {
Real t = y1;
{
// test context-error
- if ( tdef_l_->text_str_.index_i( "Gates" ) >=0)// :-)
- warning( "foul word", tdef_l_->defined_ch_c_l_ );
+ if ( tdef_l()->text_str_.index_i( "Gates" ) >=0)// :-)
+ warning( "foul word", tdef_l()->defined_ch_c_l_ );
}
Molecule*
Meter::brew_molecule_p()const
{
- Symbol s = paper()->lookup_p_->meter(args);
+ Symbol s = paper()->lookup_l()->meter(args);
return new Molecule(Atom(s));
}
#include "assoc-iter.hh"
#include "lexer.hh"
#include "input-file.hh"
-#include "parser.hh"
+#include "out/parser.hh"
#include "keyword.hh"
#include "assoc.hh"
#include "lexer.hh"
"clef", CLEF,
"cm", CM_T,
"command", COMMAND,
- "commands", COMMANDS,
+ "commands", COMMANDS,
"duration", DURATIONCOMMAND,
+ "dynamic", DYNAMIC,
"geometric", GEOMETRIC,
"goto", GOTO,
"in", IN_T,
Paper_def *p = paper();
Real dy = p->internote();
- Symbol s = p->lookup_p_->ball(balltype);
+ Symbol s = p->lookup_l()->ball(balltype);
out = new Molecule(Atom(s));
if (dots) {
- Symbol d = p->lookup_p_->dots(dots);
+ Symbol d = p->lookup_l()->dots(dots);
Molecule dm;
dm.add(Atom(d));
if (!(position %2))
if (streepjes) {
int dir = sign(position);
int s =(position<-1) ? -((-position)/2): (position-staff_size)/2;
- Symbol str = p->lookup_p_->streepjes(s);
+ Symbol str = p->lookup_l()->streepjes(s);
Molecule sm;
sm.add(Atom(str));
if (position % 2)
mtor << "}\n";
#endif
}
+const Lookup*
+Paper_def::lookup_l()
+{
+ return lookup_p_;
+}
Text_def * textdef;
}
-%token VOICE STAFF SCORE TITLE BAR OUTPUT MULTIVOICE
+%token VOICE STAFF SCORE TITLE BAR OUTPUT MULTIVOICE DYNAMIC
%token CM_T IN_T PT_T MM_T PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND
%token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND
%token KEY CLEF TABLE VOICES STEM
%token GOTO
%token MIDI TEMPO
-%token <id> IDENTIFIER
+%token <id> IDENTIFIER REAL_IDENTIFIER REQUEST_IDENTIFIER
%token <string> PITCHMOD DURATION RESTNAME
%token <ii> NOTENAME
%token <real> REAL
%type <staff> staff_block staff_init staff_body
%type <i> int
%type <intvec> intastint_list
-%type <request> post_request pre_request command_req
+%type <request> post_request pre_request command_req
%type <string> pitchmod
%type <music> music
%type <chord> music_chord music_chord_body
%type <notename_tab> notename_tab notename_tab_body
%type <i> script_dir
%type <script> script_definition script_body mudela_script
-%type <request> script_req textscript_req
+%type <request> script_req textscript_req dynamic_req basic_request
%type <textdef> mudela_text
declaration:
declarable_identifier '=' staff_block {
- $$ = new Staff_id(*$1, $3);
+ $$ = new Staff_id(*$1, $3, IDENTIFIER);
delete $1;
}
| declarable_identifier '=' music_voice {
- $$ = new M_voice_id(*$1, $3);
+ $$ = new M_voice_id(*$1, $3, IDENTIFIER);
delete $1;
}
| declarable_identifier '=' script_definition {
- $$ = new Script_id(*$1, $3);
+ $$ = new Script_id(*$1, $3, IDENTIFIER);
delete $1;
}
| declarable_identifier '=' music_chord {
- $$ = new M_chord_id(*$1, $3);
+ $$ = new M_chord_id(*$1, $3, IDENTIFIER);
delete $1;
}
| declarable_identifier '=' symtables {
- $$ = new Lookup_id(*$1, $3);
+ $$ = new Lookup_id(*$1, $3, IDENTIFIER);
delete $1;
}
| declarable_identifier '=' notename_tab {
- $$ = new Notetab_id(*$1, $3);
+ $$ = new Notetab_id(*$1, $3, IDENTIFIER);
delete $1;
}
| declarable_identifier '=' real {
- $$ = new Real_id(*$1, new Real($3));
+ $$ = new Real_id(*$1, new Real($3), REAL_IDENTIFIER);
delete $1;
}
| declarable_identifier error '}' {
+ }
+ | declarable_identifier '=' basic_request {
+ $$ = new Request_id(*$1, $3, REQUEST_IDENTIFIER);
+ delete $1;
}
;
;
music_voice_body:
- /* */ {
+ IDENTIFIER {
+ $$ = $1->mvoice(true);
+ }
+ | /* */ {
$$ = new Music_voice;
}
- | music_voice_body IDENTIFIER {
- $$->concatenate($2->mvoice(true));
+ | music_voice_body '+' IDENTIFIER {
+ $$->concatenate($3->mvoice(true));
}
| music_voice_body full_element {
$$->add_elt($2);
;
music_chord_body:
- /* */ {
+ IDENTIFIER {
+ $$=$1->mchord(true);
+ }
+ | /* */ {
$$ = new Voice_group_chord;
}
| MULTIVOICE {
$$ = new Multi_voice_chord;
}
- | music_chord_body IDENTIFIER {
- $$->concatenate($2->mchord(true));
+ | music_chord_body '+' IDENTIFIER {
+ $$->concatenate($3->mchord(true));
}
| music_chord_body music {
$$->add($2);
}
;
+basic_request:
+ command_req
+ | pre_request
+ | post_request
+ ;
/*
VOICE ELEMENTS
}
| script_req
| textscript_req
+ | dynamic_req
+ | REQUEST_IDENTIFIER {
+ $$ = $1->request(false)->clone();
+ }
+ ;
+
+dynamic_req:
+ DYNAMIC '{' int '}' {
+ Absolute_dynamic_req *ad_p = new Absolute_dynamic_req;
+ ad_p ->loudness_ = $3;
+ $$ =ad_p;
+ }
;
close_plet_parens:
| REAL {
$$ = $1;
}
- | IDENTIFIER {
+ | REAL_IDENTIFIER {
$$ = * $1->real(0);
}
;
{
int l=1;
- ts << "\n "<< paper_l_->lookup_p_->texsetting << "%(Tex id)\n";
+ ts << "\n "<< paper_l_->lookup_l()->texsetting << "%(Tex id)\n";
for (iter_top(lines,lic); lic.ok(); lic++) {
ts << "% line of score no. " << l++ <<"\n";
ts << lic->TeXstring();
void
Spacing_req::do_print()const
{
+#ifndef NPRINT
mtor << "next " << next << "dist " << distance << "strength\n";
+#endif
}
void
else
return (Voice*)elt_l_->voice_l_;
}
+/* *************** */
+
+void
+Subtle_req::do_print() const
+{
+ mtor << " subtime " << subtime_;
+}
+
+void
+Dynamic_req::do_print() const
+{
+ Subtle_req::do_print();
+}
+
+void
+Absolute_dynamic_req::do_print() const
+{
+ Dynamic_req::do_print();
+ mtor << " loudness_" <<loudness_;
+}
+
+String
+Dynamic_req::loudness_str(Loudness l)
+{
+ switch (l) {
+ case FFF: return "fff";
+ case FF: return "ff";
+ case F: return "f";
+ case MF: return "mf";
+ case MP: return "mp";
+ case P: return "p";
+ case PP: return "pp";
+ case PPP: return "ppp";
+ }
+ assert(false);
+ return "";
+}
+
+Absolute_dynamic_req::Absolute_dynamic_req()
+{
+ loudness_ = MF;
+}
Paper_def *p =paper();
Symbol s;
- s = p->lookup_p_->rest(balltype);
+ s = p->lookup_l()->rest(balltype);
Molecule *m = new Molecule(Atom(s));
if (dots) {
- Symbol d =p->lookup_p_->dots(dots);
+ Symbol d =p->lookup_l()->dots(dots);
Molecule dm;
dm.add(Atom(d));
m->add_right(dm);
if (ok() && ptr()->when() == last)
PCursor<Score_column *>::operator++(0);
reinit();
- if (!ok())
- return;
+ bool last_b = (!ok()); // urgh
for (int i=0; i< walker_p_arr_.size(); i++) {
if (walker_p_arr_[i]->ok() &&
- walker_p_arr_[i]->when() < when()) {
+ (last_b || walker_p_arr_[i]->when() < when())) {
walker_p_arr_[i]->operator++(0);
}
}
}
+bool
+Score_walker::break_allowed_b()
+{
+ return !disallow_break_count_;
+}
+
Moment
Score_walker::when()
{
Script::symbol()const
{
String preidx_str = (symdir < 0) ?"-" :"";
- return paper()->lookup_p_->script(preidx_str + specs_l_->symidx);
+ return paper()->lookup_l()->script(preidx_str + specs_l_->symidx);
}
void
w+= (right_off.x - left_off.x) * nw_f ;
Real round_w = w; // slur lookup rounds the slurwidth .
- Symbol sl = paper()->lookup_p_->slur(dy , round_w, dir_i_);
+ Symbol sl = paper()->lookup_l()->slur(dy , round_w, dir_i_);
Real error = w-round_w;
#include "item.hh"
#include "pcol.hh"
#include "voice-element.hh"
+#include "pqueue.hh"
void
Staff_column::OK() const
}
void
-Staff_column::add(Voice_element*ve)
+Staff_column::add(Voice_element*ve,
+ PQueue<Subtle_req *, Moment> &subtle_req_pq )
{
for (iter_top(ve->reqs,j); j.ok(); j++) {
if (j->command()) {
if (j->rhythmic()) {
musical_column_l_->add_duration(j->rhythmic()->duration());
}
- if (!j->musical()->skip())
- setup_one_request(j);
+ if (j->musical()) {
+ Musical_req*m = j->musical();
+ if(m->skip())
+ continue;
+ Subtle_req * s = m->subtle() ;
+ if (s&& s->subtime_) {
+ subtle_req_pq.enter(s, s->subtime_ + when());
+ continue ;
+ }
+ }
+ setup_one_request(j);
}
}
}
+/*
+ staff.cc -- implement Staff
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+
+
#include "proto.hh"
#include "plist.hh"
#include "staff.hh"
#include "musicalrequest.hh"
#include "commandrequest.hh" // todo
#include "midi-stream.hh"
-
+#include "pqueue.hh"
void
Staff::add(PointerList<Voice*> const &l)
{
return i;
}
-/**
- put all stuff grouped vertically in the Staff_cols.
- Do the preprarations for walking the cols. not virtual
- */
+/** put all stuff grouped vertically in the Staff_cols. Do the
+ preprarations for walking the cols. not virtual */
void
Staff::setup_staffcols()
-{
+{
+ PQueue<Subtle_req *, Moment> subtle_req_pq;
+
for (iter_top(voice_list_,i); i.ok(); i++) {
PCursor<Staff_column*> last(cols_);
Moment now = i->start;
- for (iter_top(i->elts,j); j.ok(); j++) {
+ iter_top(i->elts,j);
+ while( j.ok()) {
- Staff_column *s_l= get_col(now, &last);
- assert(now == s_l->when());
- s_l->add(j);
- now += j->duration;
- }
+ Moment next = now;
+ if (subtle_req_pq.size())
+ next = next <? subtle_req_pq.front_idx();
+ Staff_column *s_l= get_col(next, &last);
+
+ while (subtle_req_pq.size()
+ && subtle_req_pq.front_idx() == s_l->when()) {
+ s_l->setup_one_request(subtle_req_pq.get()); // ugh!
+ }
+ if(next == now) {
+ s_l->add(j, subtle_req_pq);
+ now += j->duration;
+ j++;
+ }
+ }
+
+ }
+ PCursor<Staff_column*> last(cols_);
+
+ while (subtle_req_pq.size()) {
+ Moment front =subtle_req_pq.front_idx();
+ Staff_column *s_l = get_col(front, &last);
+ while(subtle_req_pq.size() && subtle_req_pq.front_idx() == front)
+ s_l->setup_one_request(subtle_req_pq.get()); // ugh!
}
+
OK();
}
Molecule*
Staff_symbol::brew_molecule_p() const
{
- Atom a = paper()->lookup_p_->linestaff(no_lines_i_, width().length());
+ Atom a = paper()->lookup_l()->linestaff(no_lines_i_, width().length());
return new Molecule(a);
}
if (!print_flag || abs(flag) <= 4)
return Interval(0,0); // TODO!
Paper_def*p= paper();
- Interval r(p->lookup_p_->flag(flag).dim.x);
+ Interval r(p->lookup_l()->flag(flag).dim.x);
r+= stem_xoffset;
return r;
}
Paper_def *p =paper();
Real dy = p->internote();
- Symbol ss =p->lookup_p_->stem(bot*dy,top*dy);
+ Symbol ss =p->lookup_l()->stem(bot*dy,top*dy);
out = new Molecule(Atom(ss));
if (print_flag&&abs(flag) > 4){
- Symbol fl = p->lookup_p_->flag(flag);
+ Symbol fl = p->lookup_l()->flag(flag);
Molecule m(fl);
if (flag < -4){
out->add_bottom(m);
if (elt_query(s))
return (*this)[s];
else {
- error( "Unknown symbol `" +s+"'\n");
+ error( "Symtable `" + id_str+ "\': unknown symbol `" +s+"'\n");
}
Symbol sy; // unreachable
return sy;
}
}
+void
+Symtables::add(String s, Symtable*p)
+{
+ p-> id_str = s;
+ Assoc<String, Symtable*>::add(s,p);
+}
#include "lookup.hh"
Symbol
-Lookup::beam_element(int sidx, int widx, Real slope)
+Lookup::beam_element(int sidx, int widx, Real slope) const
{
Symbol bs=(*symtables_)("beamslopes")->lookup("slope");
}
Symbol
-Lookup::rule_symbol(Real height, Real width)
+Lookup::rule_symbol(Real height, Real width) const
{
Symbol bs=(*symtables_)("beamslopes")->lookup("horizontal");
Array<String> args;
}
Symbol
-Lookup::beam(Real &slope, Real width)
+Lookup::beam(Real &slope, Real width) const
{
int sidx = slope_index(slope);
if (!slope)
}
Symbol
-Lookup::half_slur_middlepart(Real &dx, int dir)
+Lookup::half_slur_middlepart(Real &dx, int dir) const
{
if (dx >= 400 PT) {// todo
WARN<<"halfslur too large" <<print_dimen(dx)<< "shrinking (ugh)\n";
return s;
}
Symbol
-Lookup::half_slur(int dy, Real &dx, int dir, int xpart)
+Lookup::half_slur(int dy, Real &dx, int dir, int xpart) const
{
Real orig_dx = dx;
if (!xpart)
}
Symbol
-Lookup::slur (int dy , Real &dx, int dir)
+Lookup::slur (int dy , Real &dx, int dir) const
{
assert(dx >=0 && abs(dir) <= 1);
int y_sign = sign(dy);
}
Symbol
-Lookup::big_slur(int dy , Real &dx, int dir)
+Lookup::big_slur(int dy , Real &dx, int dir) const
{
assert(dx >= 24 PT);
Real slur_extra =abs(dy) /2.0 + 2;
Atom
Text_def::create_atom(Paper_def*p) const
{
- return p->lookup_p_->text(style_str_, text_str_, -align_i_);
+ return p->lookup_l()->text(style_str_, text_str_, -align_i_);
}
void
*/
- #include "musicalrequest.hh"
+#include "musicalrequest.hh"
#include "paper-def.hh"
#include "text-item.hh"
#include "stem.hh"
#include "molecule.hh"
#include "lookup.hh"
+Text_item::Text_item(Text_def *tdef_l, int staffsize_i)
+{
+ dir_i_ =-1;
+ init(tdef_l, staffsize_i);
+}
+Text_def*
+Text_item::tdef_l()
+{
+ return tdef_p_;
+}
-Text_item::Text_item(Text_req* treq_l, int staffsize_i)
+Text_item::~Text_item()
+{
+ delete tdef_p_;
+}
+
+void
+Text_item::init(Text_def *tdef_l, int staffsize_i)
{
staffsize_i_ = staffsize_i;
+ tdef_p_ = new Text_def (*tdef_l);
+}
+
+Text_item::Text_item(Text_req* treq_l, int staffsize_i)
+{
+ init(treq_l->tdef_p_, staffsize_i);
dir_i_ = treq_l->dir_i_;
if (!dir_i_)
dir_i_ = -1;
- tdef_l_ = treq_l->tdef_p_;
}
void
Molecule*
Text_item::brew_molecule_p() const
{
- Molecule* mol_p = new Molecule(tdef_l_->create_atom(paper()));
+ Molecule* mol_p = new Molecule(tdef_p_->create_atom(paper()));
mol_p->translate(Offset(0, pos_i_ * paper()->internote()));
if(dir_i_<0)
#include "complex-walker.hh"
#include "commandrequest.hh"
#include "debug.hh"
+#include "dynamic-reg.hh"
static int temp_id_count;
Voice_group_registers::Voice_group_registers(String id)
{
+ add(new Dynamic_register);
add(new Text_register);
add(new Stem_beam_register);
add(new Script_register);
#include "voice-group-regs.hh"
#include "voice-regs.hh"
#include "commandrequest.hh"
-
+#include "score-walker.hh"
Walker_registers::Walker_registers(Complex_walker *w)
{
Staff_info
Walker_registers::get_staff_info() return inf;
{
+ if (walk_l_->score_walk_l_) // we get called ctors
+ inf.break_allowed_b_ = walk_l_->score_walk_l_->break_allowed_b();
inf.c0_position_i_ = &walk_l_->c0_position_i_;
inf.walk_l_ = walk_l_;
inf.time_c_l_ = &walk_l_->time_;
inf.rhythmic_c_l_ = walk_l_->default_grouping;
}
+
Paper_def*
Walker_registers::paper()const
{
--- /dev/null
+# -*-Makefile-*-
+
+# @AUTOHEADER@
+
+#CXXFLAGS=@CXXFLAGS@
+#CXX=@CXX@
+bindir=@bindir@
+includedir=@includedir@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+DEFS=@DEFS@
+#SET_MAKE=@SET_MAKE@
+DEFINES=@DEFINES@
+COMPILEINFO=@COMPILEINFO@
+BISON=@BISON@
+FLEX=@FLEX@
# list of distribution files:
#
-DISTFILES = Makefile $(MAKEFILES)
+DISTFILES = configure.in ACVariables.make.in Makefile lilypond.spec $(MAKEFILES)
#
# generic variables:
--- /dev/null
+Description: LilyPond is a program which converts a music-script (mudela) into\
+TeX output, or MIDI to produce multi-staff scores. Feature include multiple\
+meters, clefs, keys, lyrics, versatile input-language, cadenzas\
+beams, slurs, triplets\
+multiple voices within one staff.
+Name: lilypond
+Version: 0.0.39.hwn2
+Release: 1
+Copyright: GPL
+Group: Applications/Publishing
+Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.0.39.hwn2.tar.gz
+Summary: A preprocessor to make TeX typeset music.
+
+%prep
+%setup
+%build
+PREFIX=/usr/lib ./configure
+make all OPTIFLAG="-O2"
+%install
+make install
+%files
+%doc Documentation/README.txt Documentation/CodingStyle.txt
+%doc Documentation/lilygut.txt Documentation/lilyinput.txt
+%doc Documentation/error.txt Documentation/faq.txt Documentation/index.txt
+%doc Documentation/language.txt Documentation/lelie_logo.png
+/usr/bin/lilypond
+/usr/bin/mi2mu
+/usr/lib/lilypond/init/bare.ini
+/usr/lib/lilypond/init/dutch.ini
+/usr/lib/lilypond/init/english.ini
+/usr/lib/lilypond/init/script.ini
+/usr/lib/lilypond/init/swedish.ini
+/usr/lib/lilypond/init/symbol.ini
+/usr/lib/lilypond/init/table_sixteen.ini
+/usr/lib/lilypond/init/table_twenty.ini
+/usr/lib/lilypond/titledefs.tex
+/usr/lib/lilypond/lilyponddefs.tex
+
+
+
\def\dynf{f\kern-.1ex}
\def\dynm{f\kern-.15ex}
\def\dynp{p\kern-.15ex}
-\def\ppp{\dynfont\dynp\dynp p}
-\def\pp{\dynfont\dynp p}
-\def\p{\dynfont p}
-\def\mp{\dynfont\dynm p}
-\def\mf{\dynfont\dynm f}
-\def\f{\dynfont f}
-\def\ff{\dynfont\dynf f}
-\def\fff{\dynfont\dynf\dynf f}
+
+\def\dynppp{\dynfont\dynp\dynp p}
+\def\dynpp{\dynfont\dynp p}
+\def\dynp{\dynfont p}
+\def\dynmp{\dynfont\dynm p}
+\def\dynmf{\dynfont\dynm f}
+\def\dynf{\dynfont f}
+\def\dynff{\dynfont\dynf f}
+\def\dynfff{\dynfont\dynf\dynf f}
\def\slurcharh#1{{\slurhfont\char#1}}
\def\slurcharu#1{{\slurufont\char#1}}
\def\decrescendosym#1{\count0=116\advance\count0 by #1}
\def\settext#1{\textfont #1}
\def\setitalic#1{\italicfont #1}
+\def\setdynamic#1{\dynfont #1}