*/
struct Input_music {
virtual Voice_list convert()const=0;
+ void check_plet(Voice_element* velt_l);
virtual Moment length()const=0;
virtual void translate_time(Moment dt)=0;
virtual ~Input_music(){}
virtual void print() const =0;
virtual void set_default_group(String)=0;
+ virtual bool find_plet_start_bo(char c, Moment& moment_r) = 0;
+ virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) = 0;
// virtual void transpose(...) const =0;
virtual Voice_list convert()const;
virtual void translate_time(Moment dt);
virtual void print() const;
+ virtual bool find_plet_start_bo(char c, Moment& moment_r);
+ virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
virtual Input_music *clone() const {
return new Simple_music(*this);
}
Complex_music(Complex_music const &);
virtual void print() const ;
void concatenate(Complex_music*);
+ virtual bool find_plet_start_bo(char c, Moment& moment_r);
+ virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
};
/// paper_, staffs_ and commands_ form the problem definition.
Paperdef *paper_p_;
+ Mididef* midi_p_;
IPointerList<Input_staff*> staffs_;
Input_music * score_wide_music_p_;
~Input_score();
/// construction
void set(Paperdef*);
+ void set(Mididef* midi_p);
void print() const;
Score*parse();
void set(Input_music*);
//
// lyricitem.hh -- part of LilyPond
//
-// copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
#ifndef LYRIC_ITEM_HH
#define LYRIC_ITEM_HH
};
-#endif // LYRICITEM_HH
+#endif // LYRIC_ITEM_HH //
/*
lyricstaff.hh -- part of LilyPond
- copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+ copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
*/
#ifndef LYRICSTAFF_HH
-/*
- lyricwalker.hh -- declare Lyric_walker
-
- (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen <jan@digicash.nl>
-*/
+//
+// lyricwalker.hh -- declare Lyric_walker
+//
+// (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen <jan@digicash.com>
+//
#ifndef LYRICWALKER_HH
#define LYRICWALKER_HH
void set_text_style(String);
Script_def* get_scriptdef(char);
Text_def*get_text(String s);
+Request* get_plet_request( char c, int dur_i, int type_i );
Request*get_script_req(int d , Script_def*def);
Request*get_text_req(int d , Text_def*def);
Request* get_stemdir_req(int);
virtual Rest_req *rest() { return 0; }
virtual Span_req *span() { return 0; }
virtual Beam_req *beam() { return 0 ; }
+ virtual Plet_req* plet() { return 0; }
virtual Slur_req *slur() { return 0 ; }
virtual Rhythmic_req*rhythmic() { return 0; }
virtual Lyric_req* lreq_l() { return 0; }
struct Score {
/// paper_, staffs_ and commands_ form the problem definition.
Paperdef *paper_p_;
+ Mididef *midi_p_;
IPointerList<Staff*> staffs_;
/// "runtime" fields for setting up spacing
/// output to file
void output(String fn);
+ /// do midi stuff
+ void midi();
+
+ ///
+ void set(Mididef* midi_p);
+
// standard
void OK() const;
void print() const;
//
// source.hh -- part of LilyPond
//
-// copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
#ifndef SOURCE_HH
#define SOURCE_HH
//
// sourcefile.hh -- declare Source_file
//
-// copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
#ifndef SOURCE_FILE_HH
#define SOURCE_FILE_HH
Moment start;
/* *************** */
- Moment when(const Voice_element*)const;
- Moment last() const;
Voice();
Voice(Voice const&);
+
+ Moment when(const Voice_element*)const;
+ Moment last() const;
+
void add(Voice_element*);
+ bool find_plet_start_bo(char c, Moment& moment_r);
void print() const;
void set_default_group(String id);
+ void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
};
/** one horizontal bit. Apart from being a container for the requests, Voice_element is nothing
/* *************** */
- void add(Request*);
Voice_element();
Voice_element(Voice_element const & src );
+
+ void add(Request*);
+ bool find_plet_start_bo(char c, Moment& moment_r);
void print ()const;
void set_default_group(String id);
+ void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
+ /// return true when done
};
#endif
DISTFILES=Makefile kortjakje.ly pavane.ly maartje.ly\
cadenza.ly scales.ly standchen.ly twinkle.ly\
- wohltemperirt.ly error.ly\
+ wohltemperirt.ly\
+ error.ly midi.ly plet.ly\
martien.ly mlalt.ly mlvio1.ly mlvio2.ly mlcello.ly\
coriolan-alto.ly rhythm.ly \
standchen.tex pavane.tex scsii-menuetto.tex scsii-menuetto.ly\
music{ $
\duration { 8 }
\octave{ }
- \plet { 6/9 } |[ a a a a a a a a a ] \plet { 1/1 }
+ |[ a a a a a a a a a ]
\octave{ ' }
- \plet { 6/9 } |[ a a a a a a a a a ] \plet { 1/1 }
+ |[ a a a a a a a a a ]
\octave { ` }
- \plet { 6/9 } [ `c `g d a 'e 'b ''f '''c '''g ] \plet { 1/1 }
- \plet { 6/9 } [ '''g '''c ''f 'b 'e a d `g `c ] \plet { 1/1 }
+ [ `c `g d a 'e 'b ''f '''c '''g ]
+ [ '''g '''c ''f 'b 'e a d `g `c ]
\octave{ ' }
- \plet { 6/9 } [ `c `g d a 'e 'b ''f '''c '''g ] \plet { 1/1 }
- \plet { 6/9 } [ '''g '''c ''f 'b 'e a d `g `c ] \plet { 1/1 }
+ [ `c `g d a 'e 'b ''f '''c '''g ]
+ [ '''g '''c ''f 'b 'e a d `g `c ]
\octave { }
- \plet { 2/3 } [ c g 'd ] \plet { 1/1 }
- \plet { 2/3 } [ 'd g c ] \plet { 1/1 }
- \plet { 2/3 } [ f 'c 'g ] \plet { 1/1 }
- \plet { 2/3 } [ 'g 'c f ] \plet { 1/1 }
+ [ c g 'd ]2/3
+ [ 'd g c ]2/3
+ [ f 'c 'g ]2/3
+ [ 'g 'c f ]2/3
\octave{ ' }
- \plet { 2/3 } [ c g 'd ] \plet { 1/1 }
- \plet { 2/3 } [ 'd g c ] \plet { 1/1 }
- \plet { 2/3 } [ f 'c 'g ] \plet { 1/1 }
- \plet { 2/3 } [ 'g 'c f ] \plet { 1/1 }
+ [ c g 'd ]2/3
+ [ 'd g c ]2/3
+ [ f 'c 'g ]2/3
+ [ 'g 'c f ]2/3
c1
\duration { 8}
\begin{document}
\input lilyponddefs
\input titledefs
-%\def\interstaffline{\vskip10pt}
-%\def\interscoreline{\vskip12pt}
-\def\interstaffline{\vskip1mm}
-\def\interscoreline{\vskip2mm}
+\def\interstaffline{\vskip2mm}
+\def\interscoreline{\vskip3mm}
\vbox to 10mm{\vss}
\title{St\"andchen\normalsize\\[2ex](Serenade)}
\composer{Franz Schubert (1797-1828)}
#include "voice.hh"
#include "musicalrequest.hh"
+void
+Input_music::check_plet(Voice_element* velt_l)
+{
+ for (iter_top(velt_l->reqs,i); i.ok(); i++)
+ if ( i->plet() ) {
+ Moment start_moment = 0.0;
+ if ( !find_plet_start_bo( i->plet()->type_c_, start_moment ) ) {
+ error( "begin of plet not found", i->defined_ch_c_l_ );
+ break;
+ }
+ Moment moment = 0.0;
+ set_plet_backwards( moment, start_moment, i->plet()->dur_i_, i->plet()->type_i_ );
+ i.del();
+ break;
+ }
+}
+
void
Simple_music::add(Voice_element*v)
{
voice_.print();
mtor << "}\n";
}
+bool
+Simple_music::find_plet_start_bo(char c, Moment& moment_r)
+{
+ return voice_.find_plet_start_bo(c, moment_r);
+}
+void
+Simple_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+{
+ voice_.set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
+}
/* *************** */
for (iter_top(elts,i); i.ok(); i++)
i->set_default_group(g);
}
+bool
+Complex_music::find_plet_start_bo(char c, Moment& moment_r)
+{
+ for (iter_bot(elts,i); i.ok(); i--) {
+ if ( i->find_plet_start_bo(c, moment_r) )
+ return true;
+ }
+ return false;
+}
+void
+Complex_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+{
+ for (iter_bot(elts,i); i.ok(); i--) {
+ i->set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
+ }
+}
/* *************************************************************** */
void
c = elts.bottom();
Simple_music *s = c->simple();
s->add(v);
+
+ check_plet(v);
}
Moment
Simple_music*vs = new Simple_music;
vs->add(v);
elts.bottom().add(vs);
+
+ check_plet(v);
}
void
#include "inputmusic.hh"
#include "score.hh"
#include "paperdef.hh"
+#include "mididef.hh"
#include "staff.hh"
paper_p_ = p;
}
+void
+Input_score::set(Mididef* midi_p)
+{
+ delete midi_p_;
+ midi_p_ = midi_p;
+}
+
Input_score::Input_score(Input_score const&s)
{
paper_p_ = (s.paper_p_)? new Paperdef(*s.paper_p_) :0;
Score *s_p = new Score(paper_p);
s_p->defined_ch_c_l_= defined_ch_c_l_;
s_p->errorlevel_i_ = errorlevel_i_;
+ s_p->set(midi_p_);
+ midi_p_ = 0;
for (iter_top(staffs_,i); i.ok(); i++) {
Staff* staf_p=i->parse(s_p, score_wide_music_p_);
{
delete paper_p_;
delete score_wide_music_p_;
+ delete midi_p_;
}
Input_score::Input_score()
score_wide_music_p_ =0;
defined_ch_c_l_=0;
paper_p_= 0;
+ midi_p_ = 0;
errorlevel_i_ = 0;
}
<lyrics>{LYRICS} {
String s (YYText());
int i = 0;
- while ((i=s.pos("_")) != 0)// ugh. Whats this.
- *((char*)s.cptr() + i - 1) = ' ';
- if ((i=s.pos("\\,")) !=0)
+ while ((i=s.pos("_")) != 0) // change word binding "_" to " "
+ *(s.ch_l() + i - 1) = ' ';
+ if ((i=s.pos("\\,")) !=0) // change "\," to TeX's "\c "
{
- *((char*)s.cptr() + i) = 'c';
+ *(s.ch_l() + i) = 'c';
s = s.left(i+1) + " " + s.right(s.len()-i-1);
}
yylval.string = new String(s);
source file of the LilyPond music typesetter
- (c) 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
*/
#include "musicalrequest.hh"
#include "varray.hh"
#include "textdef.hh"
#include "parseconstruct.hh"
+#include "inputmusic.hh"
int default_duration = 4, default_dots=0, default_octave=0;
int default_plet_type = 1, default_plet_dur = 1;
}
/* triplet is '2/3' */
-void set_plet(int num,int den)
+void
+set_plet(int num,int den)
{
assert(num >0&& den>0);
default_plet_dur = num;
parse_octave(d, i, default_octave);
}
+Request*
+get_plet_request( char c, int dur_i, int type_i )
+{
+ Plet_req* plet_req_p = new Plet_req;
+ plet_req_p->dur_i_ = dur_i;
+ plet_req_p->type_i_ = type_i;
+ plet_req_p->type_c_ = c;
+ return plet_req_p;
+}
+
Request*
get_request(char c)
{
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
+#include "plist.hh"
#include "musicalrequest.hh"
#include "complexwalker.hh"
#include "slurreg.hh"
Source_file*
Source::sourcefile_l( char const* ch_c_l )
{
- PCursor<Source_file*> sourcefile_p_pcur( sourcefile_p_iplist_.top() );
- for ( ; sourcefile_p_pcur.ok(); sourcefile_p_pcur++ )
- if ( sourcefile_p_pcur->in_b( ch_c_l ) )
- return *sourcefile_p_pcur;
+ PCursor<Source_file*> sourcefile_l_pcur( sourcefile_p_iplist_.top() );
+ for ( ; sourcefile_l_pcur.ok(); sourcefile_l_pcur++ )
+ if ( sourcefile_l_pcur->in_b( ch_c_l ) )
+ return *sourcefile_l_pcur;
return 0;
}
#include "voice.hh"
#include "musicalrequest.hh"
#include "commandrequest.hh"
+#include "midiitem.hh"
+#include "midistream.hh"
void
Voice::set_default_group(String s)
elts.top()->set_default_group(s);
}
+bool
+Voice::find_plet_start_bo(char c, Moment& moment_r)
+{
+ for (iter_bot(elts, i); i.ok(); i--)
+ if ( i->find_plet_start_bo(c, moment_r) )
+ return true;
+ return false;
+}
+
+void
+Voice::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+{
+ for (iter_bot(elts, i); i.ok(); i--)
+ if ( now_moment_r <= until_moment )
+ i->set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
+ else
+ return;
+}
+
Voice::Voice(Voice const&src)
{
for (iter_top(src.elts, i); i.ok(); i++)
add(i->clone());
}
+bool
+Voice_element::find_plet_start_bo(char c, Moment& moment_r)
+{
+ assert( c == ']' );
+ moment_r += duration;
+ for ( PCursor<Request*> req_l_pcur( reqs.top() ); req_l_pcur.ok(); req_l_pcur++ ) {
+ if (req_l_pcur->melodic())
+ mtor << (char)('c' + req_l_pcur->melodic()->height()) << "\n";
+ if (req_l_pcur->beam() && req_l_pcur->beam()->spantype == Span_req::START )
+ return true;
+ }
+ return false;
+}
+
void
Voice_element::set_default_group(String s)
{
greq->newgroup_str_ = s;
add(greq);
}
+
+void
+Voice_element::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+{
+ now_moment_r += duration;
+ if ( now_moment_r > until_moment )
+ return;
+ for ( PCursor<Request*> req_l_pcur( reqs.top() ); req_l_pcur.ok(); req_l_pcur++ ) {
+ if (req_l_pcur->beam() && req_l_pcur->beam()->spantype == Span_req::START )
+ req_l_pcur->beam()->nplet = den_i;
+ if (req_l_pcur->rhythmic())
+ req_l_pcur->rhythmic()->plet_factor = Moment(num_i, den_i);
+ if (req_l_pcur->stem())
+ req_l_pcur->stem()->plet_factor = Moment(num_i, den_i);
+ if (req_l_pcur->melodic())
+ mtor << (char)('c' + req_l_pcur->melodic()->height()) << "\n";
+ }
+}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
+#include "plist.hh"
#include "musicalrequest.hh"
#include "voicegroup.hh"
#include "register.hh"
head_reg_->set_dir(i);
slur_reg_->set_dir(i);
}
+
error( String message_str, char const* context_ch_c_l )
{
message( message_str, context_ch_c_l );
- exit( 1 );
+ // since when exits error again?
+ // i-d say: error: errorlevel |= 1; -> no output upon error
+ // warning: recovery -> output (possibly wrong)
+ if ( lexer )
+ lexer->errorlevel_i_ |= 1;
+// exit( 1 );
}