ritme = rhythmstaff {
- voice { $ c2 c2
+ $
+ c8 c2 c2
%[c8( )'a8 c8 c8]
c2 c2
[fis16 'dis16( fis16 'dis16 ][fis16) 'dis16 fis16 'dis16]
- c2 r32 r32 r16 r8 r4 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ }
+ c2 r32 r32 r16 r8 r4 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $
}
melody=
melodicstaff {
- voice { $ c () `bes $ start 0.5 }
- voice { $
- %[fis16 'dis16 fis16 'dis16 fis16 'dis16 fis16 'dis16]
- c2
- 'fis ()'gisis $ }
+ $
+ c8
+ r1
+ 'cis2.. r8
+ r4 r8 r16 r32 r32
+ \duration {4} \chord {
+ \voice { c () `bes c}
+ \voice {'fis ()'gisis fis }
+ \voice { d () d dis }
+ \voice { a () bes eis }
+ \voice { fis () g gis }
+ }
+ c4
- voice { $ d () d $ start 0.5 }
- voice { $ a () bes $ start 0.5 }
- voice { $ fis () g $ start 0.5 }
-
-
- voice { $
- ''c2.. r8 r4 r8 r16 r32 r32
- [d8 e8 'f8 g8] [d8 e8 f8 g8]
- ''fis1
+ [d8 e8 'f8 g8] d8 e8 f8 g8
+ ''fis2
a8 b8 'c8 'd8 ''c8 ```c8 c4 c4 c4 c4
- \duration 16 `b16 `a16 `g16 `f16 \duration 4
- c `b `a `g `f `e `d `c ``b ``a ``g ``f ``e ``d ``c$
- start 1.0 }
+ \duration{ 16 } `b `a `g `f \duration{ 4}
+ c `b `a `g `f `e `d `c ``b ``a ``g ``f ``e ``d ``c
+ $
+
+
+commands {
+ skip 2:0
+ key $ fis cis gis $
+ skip 2:0
+ key $ $
+ skip 5:0
+ clef bass
+}
}
+
score {
paper {
geometric 1.4
staff { melody }
% staff { melody }
commands {
+ partial 0.125 skip 0:0.125
+
meter 4 4
- key $ fis cis gis $
- skip 2:0
- key $ $
+ skip 2:0
meter 2 4
skip 19:0
}
#include "staff.hh"
+#include "score.hh"
+#include "voice.hh"
#include "swalker.hh"
+#include "getcommand.hh"
#include "stcol.hh"
#include "sccol.hh"
+#include "inputcommands.hh"
+#include "staffcommands.hh"
#include "debug.hh"
Staff::Staff(Staff const&src)
{
PL_copy(voices,src.voices);
- PL_copy(commands,src.commands);
+ staff_commands_ = src.staff_commands_;
assert(!cols.size()); // cols is a runtime field.
-
+ input_commands_ = src.input_commands_;
+
score_ = src.score_;
pscore_ = src.pscore_;
}
+void
+Staff::add(svec<Command*> &s)
+{
+ input_commands_.add(get_reset_command());
+ input_commands_.concat(s);
+}
+void
+Staff::add(PointerList<Voice*> &l)
+{
+ for (PCursor<Voice*> i(l); i.ok(); i++)
+ voices.bottom().add(i);
+}
+void
+Staff::process_input_commands(svec<Command*> &s, Real l)
+{
+ Input_commands commands;
+ for (int i = 0 ; i< s.sz(); i++)
+ commands.add(new Command(*s[i]));
+ for (int i = 0 ; i< input_commands_.sz(); i++)
+ commands.add(input_commands_[i]);
+ commands.truncate(l);
+ commands.print();
+
+ staff_commands_ = commands.parse();
+ staff_commands_->clean(l);
+ commands.print();
+ print();
+}
+
Paperdef*
-Staff::paper() const{
+Staff::paper() const
+{
return score_->paper_;
}
// ; assert((i-1).ok())
// todo!
- // making a fix at 2:30 am, with several beers drunk.
+ // making a fix at 2:30 am, with several beers drunk.
+ // but it works :-)
if ((i-1).ok()&& (i-1)->when() == newst->when()) {
i--;
}
*/
void
Staff::setup_staffcols()
-{
-
+{
for (PCursor<Voice*> vc(voices); vc.ok(); vc++) {
-
Real now = vc->start;
for (PCursor<Voice_element *> ve(vc->elts); ve.ok(); ve++) {
}
}
- for (PCursor<Command*> cc(commands); cc.ok(); cc++) {
+ for (PCursor<Command*> cc(*staff_commands_); cc.ok(); cc++) {
Staff_column *sc=get_col(cc->when,false);
sc->s_commands.add(cc);
}
}
-/// merge commands from score
-void
-Staff::add_commands(PointerList<Command*> const &cl)
-{
- PCursor<Command*> score_c(cl);
- PCursor<Command*> cc(commands);
-
- while (score_c.ok()) {
- while (cc.ok() && cc->when <= score_c->when)
- cc++;
-
- Command*nc = new Command (*(* score_c));
- if (cc.ok()) {
- // cc->when > score_c->when
- cc.insert( nc );
- } else {
- commands.bottom().add( nc);
- cc = commands.bottom();
- }
- score_c++;
- }
-
- // now integrate break commands with other commands.
- // maybe do this in derived functions.
-}
-
void
Staff::process()
{
{
#ifndef NDEBUG
cols.OK();
- commands.OK();
voices.OK();
assert(score_);
#endif
#ifndef NPRINT
mtor << "Staff {\n";
for (PCursor<Voice*> vc(voices); vc.ok(); vc++) {
- vc->print();
-
+ vc->print();
}
+ if (staff_commands_)
+ staff_commands_->print();
+ for (int i =0; i <input_commands_.sz(); i++)
+ input_commands_[i]->print();
mtor <<"}\n";
#endif
}
Staff::Staff()
{
+ staff_commands_ = 0;
score_ =0;
pscore_=0;
}