+%
+% irregular spacing.
+
\score{
\context PianoStaff <
\context Staff = upper \notes\relative c''{
}
voicedefault = \notes {
\property Staff.timeSignatureStyle="C"
- \time 4/4; \key f;
+ \time 4/4; \key f \major;
\tempo 4 = 200;
}
\score{
forced_stem_shorten3=0.;
\translator{
\PianoStaffContext
- maxVerticalAlign=42.\pt;
- minVerticalAlign=42.\pt;
+ maxVerticalAlign=8.4;
+ minVerticalAlign=8.4;
}
\translator{\StaffContext
timeSignatureStyle="C";}
lh=\property Thread.noteHeadStyle = #'diamond
n=\property Thread.fontSize=#0
sm=\property Thread.fontSize=#-1
-su=\property Voice.verticalDirection=#1
-sd=\property Voice.verticalDirection=#-1
+% su=\property Voice.verticalDirection=#1
+% sd=\property Voice.verticalDirection=#-1
+
+su=\property Voice.basicStemProperties \push #'direction = #1
+sd=\property Voice.basicStemProperties \push #'direction = #-1
+
zs=\property Voice.forceHorizontalShift=#0.0
ls=\property Voice.forceHorizontalShift=#-0.6
sls=\property Voice.forceHorizontalShift=#-0.22
\score {
\notes \context PianoStaff <
\context Staff = "up" {
- \autochange Staff \relative c' { g4 a b c d e f g }
+ \autochange Staff \context Voice = VA < \relative c' { g4 a b c d r4 a g } >
}
\context Staff = "down" {
\clef bass;
}
-Pitch_interrogate_req* spanish_inquisition; // nobody expects it
+/*
+ Look ahead to find first pitches to determine staff position.
+ WARNING: this means that
-void
-Auto_change_iterator::process (Moment m)
+ \autochange Staff \notes { .... \context Staff = otherstaff { .. } .. }
+
+ will confuse the autochanger, since it will not notice that the
+ music for OTHERSTAFF is not his.
+
+ PRECONDITION: this->ok() holds.
+*/
+Array<Musical_pitch>
+Auto_change_iterator::pending_pitch (Moment m) const
{
- Music_wrapper_iterator::process (m);
+ Music_iterator * iter = child_iter_p_ ->clone ();
+ Array<Musical_pitch> ps;
+ while (1)
+ {
+ SCM muses = iter->get_music (m);
+ for (SCM s = muses; gh_pair_p (s); s=gh_cdr (s))
+ if (Note_req* nr = dynamic_cast<Note_req*> (unsmob_music (gh_car (s))))
+ {
+ ps.push (nr->pitch_);
+ }
+
+ if (ps.size ())
+ break;
+
+ iter->skip (m);
+ if (!iter->ok())
+ break;
+
+ m = iter->pending_moment ();
+ }
- if (!spanish_inquisition)
- spanish_inquisition = new Pitch_interrogate_req;
+ delete iter;
+ return ps;
+}
- Music_iterator *it = try_music (spanish_inquisition);
+void
+Auto_change_iterator::process (Moment m)
+{
+ /*
+ first we get the pitches, then we do the real work.
+ Music_wrapper_iterator::process() might process (and throw away)
+ pitches we need. */
+ Array<Musical_pitch> ps = pending_pitch (m);
- if (it && spanish_inquisition->pitch_arr_.size ())
+ Music_wrapper_iterator::process (m);
+ if (ps.size ())
{
- Musical_pitch p = spanish_inquisition->pitch_arr_[0];
+ Musical_pitch p = ps[0];
Direction s = Direction (sign(p.steps ()));
if (s != where_dir_)
{
String to_id = (s >= 0) ? "up" : "down";
Auto_change_music const * auto_mus = dynamic_cast<Auto_change_music const* > (music_l_);
- change_to (it, auto_mus->what_str_, to_id);
+ change_to (child_iter_p_, auto_mus->what_str_, to_id);
}
}
-
- spanish_inquisition->pitch_arr_.clear ();
}
Auto_change_iterator::Auto_change_iterator( )
protected:
virtual void process (Moment);
+
+ Array<Musical_pitch> pending_pitch (Moment)const;
private:
+
+
Direction where_dir_;
void change_to (Music_iterator* , String, String);
};
height -- real (dy)
- damping -- amount of beam slope damping. (int)
- should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams
-
-
- molecule-callback --
- beam-thickness -- weight of beams, in staffspace
+ Read-only
+ =========
+
+ flag-width-function --
- beam-space-function -- function of type multiplicity -> real (in staffspace)
+ damping -- amount of beam slope damping. (int)
+ should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams
default-neutral-direction -- which direction to choose if we're in
the middle of the staff
- after-line-breaking-callback --
+ thickness -- weight of beams, in staffspace
+
+ space-function -- function of type multiplicity -> real (in staffspace)
+ beamed-stem-shorten --
+
+ height-quants --
+
+ vertical-position-quant-function --
+
+ dir-function --
+
damping -- damping factor (real).
outer-stem-length-limit -- catch suspect beam slopes, set slope to zero if
outer stem is lengthened more than this (in staffspace)
slope-limit -- set slope to zero if slope is running away steeper than this.
-
*/
class Beam
{
class Performer;
class Performer_group_performer;
class Piano_bar_engraver;
-class Pitch_interrogate_req;
+
class Pitch_squash_engraver;
class Property_iterator;
class Rational;
ok () -- events left ?
pending_mom () -- time tag of the next event to be processed.
+ PRECONDITION: this->ok() holds.
- process (M) -- process all at M (Precondition: no events exist before
- M). Side-effects:
+ process (M) -- process all at M (Precondition: no events exist
+ before M, this->ok() holds). Side-effects:
* This removes all events at M from the pending queue.
TODO:
- merge pending_moment and process.
+ merge pending_moment and process?
*/
class Music_iterator
VIRTUAL_COPY_CONS (Music_iterator);
Moment music_length_mom () const;
-
-
Music_iterator ();
Music_iterator (Music_iterator const&);
virtual ~Music_iterator ();
VIRTUAL_COPY_CONS (Music);
};
-/**
- What pitches have ben acked ?
- */
-class Pitch_interrogate_req : public Request
-{
-public:
- Array<Musical_pitch> pitch_arr_;
- VIRTUAL_COPY_CONS (Music);
-};
-
-/**
- What rhythms have ben acked ?
- */
-class Rhythm_interrogate_req : public Request
-{
-public:
- Array<Duration> duration_arr_;
- VIRTUAL_COPY_CONS (Music);
-};
/**
virtual Moment pending_moment () const;
virtual bool ok () const;
virtual SCM get_music (Moment)const;
+ virtual void skip (Moment);
protected:
virtual void process (Moment);
y-free -- ?
- */
+ control-points --
+
+
+
+ Read-only
+ =========
+
+ extremity-rules --
+
+ extremity-offset-alist --
+
+ thickness --
+
+*/
class Slur
{
public:
{
return now_mom () < note_end_mom_;
}
- else if (Pitch_interrogate_req *p = dynamic_cast<Pitch_interrogate_req*> (m))
- {
- for (int i= note_req_l_arr_.size (); i--;)
- p->pitch_arr_.push (note_req_l_arr_[i]->pitch_); // GUH UGH UGHUGH.
- return true;
- }
- else if (Rhythm_interrogate_req *r = dynamic_cast<Rhythm_interrogate_req*> (m))
- {
- for (int i= note_req_l_arr_.size (); i--;)
- r->duration_arr_.push (note_req_l_arr_[i]->duration_); // GUH UGH UGHUGH.
- return true;
- }
return false;
}
rest_req_l_ = r;
return true;
}
- else if (Rhythm_interrogate_req *r = dynamic_cast<Rhythm_interrogate_req*> (m))
- {
- if (rest_req_l_)
- r->duration_arr_.push (rest_req_l_->duration_); // GUH UGH UGHUGH.
- return true;
- }
return false;
}
Sequential_music_iterator::~Sequential_music_iterator()
{
- if (iter_p_)
- {
-#if 0
- if (iter_p_->ok () )
- music_l_->origin ()->warning (_ ("Must stop before this music ends"));
-#endif
- delete iter_p_;
- }
+ delete iter_p_;
}
void
/*
+ Retrieve all music (starting at HERE), until a music with length L >
+ 0 is found. From the precondition, we know that UNTIL is later than
+ the earliest event. Hence we know
-
- Hier staat in feite: haal alle muziek op (startend op tijd HERE) tot
- je iets met lengte L > 0 tegenkomt. Aangezien de preconditie is dat
- UNTIL het eerstvolgende event is, weet je (per definitie)
-
L >= (UNTIL - HERE)
- en iets wat hierna komt (op tijd T) komt dus na tijd
+ so something that comes after this thing with L > 0 happens after
HERE + L >= HERE + (UNTIL - HERE) = UNTIL
- Dus als je een L>0 tegenkomt, wil je de rest niet meer. Aangezien
- alles wat tot nu toe hebt gespaard op HERE begint, is dat precies wat
- je nodig hebt.
-
- Misschien kan je deze comment erbij stoppen, en moeten we de
- eigenschappen van het muziek datatype wat formaliseren, zodat deze
- redenering helderder is.
+ Hence all events after the one with L>0 are uninteresting, so we
+ ignore them.
+
*/
SCM
void
Sequential_music_iterator::skip (Moment until)
{
- SCM curs = cursor_;
while (1)
{
Moment l =iter_p_->music_length_mom ();
delete iter_p_;
iter_p_ =0;
- curs = gh_cdr (curs);
+ cursor_ = gh_cdr (cursor_);
- if (!gh_pair_p (curs))
+ if (!gh_pair_p (cursor_))
return ;
else
- iter_p_ = get_iterator_p (unsmob_music (gh_car (curs)));
+ iter_p_ = get_iterator_p (unsmob_music (gh_car (cursor_)));
}
}
/*
Callback that quantises in staff-spaces, rounding in the direction
- of the elements "direction" elt property. */
+ of the elements "direction" elt property.
+
+ Only rounds when we're inside the staff, as determined by
+ Staff_symbol_referencer::staff_radius() */
Real
Side_position::quantised_position (Score_element *me, Axis )
{
{
Real p = Staff_symbol_referencer::position_f (me);
Real rp = directed_round (p, d);
-
+ Real rad = Staff_symbol_referencer::staff_radius (me) *2 ;
int ip = int (rp);
- if ((ip % 2) == 0)
+
+ if (abs (ip) < rad && (ip % 2) == 0)
{
ip += d;
rp += d;
Simultaneous_music_iterator::Simultaneous_music_iterator ()
{
separate_contexts_b_ = false;
- cursor_i_ = 0;
}
Simultaneous_music_iterator::Simultaneous_music_iterator (Simultaneous_music_iterator const& src)
: Music_iterator (src)
{
- cursor_i_ = src.cursor_i_;
separate_contexts_b_ = src.separate_contexts_b_;
- for (Cons<Music_iterator> *p = children_p_list_.head_; p; p = p->next_)
+ for (Cons<Music_iterator> *p = src.children_p_list_.head_; p; p = p->next_)
{
Music_iterator *i = p->car_;
children_p_list_.append (new Killing_cons<Music_iterator> (i->clone (), 0));
children_p_list_.junk ();
}
-/*
- Should roll next () into this as well
-
-
- huh? --hwn
- */
SCM
Simultaneous_music_iterator::get_music (Moment m)const
{
}
}
+void
+Simultaneous_music_iterator::skip (Moment until)
+{
+ for (Cons<Music_iterator> **pp = &children_p_list_.head_; *pp;)
+ {
+ Music_iterator * i = (*pp)->car_;
+ if (i->pending_moment() <= until)
+ {
+ i->skip (until);
+ }
+ if (!i->ok())
+ delete children_p_list_.remove_cons (pp);
+ else
+ pp = &(*pp)->next_;
+ }
+}
+
Moment
Simultaneous_music_iterator::pending_moment() const
{
b =p->car_->try_music (m);
return b;
}
+
+
\version "1.3.59";
-%hmm, (these) abbrevs suck, imo
-% i guess they're meant as some form of doco
-% that's what i use them for...
+%{
stemup = \property Voice.verticalDirection = \up
stemboth= \property Voice.verticalDirection = \center
stemdown = \property Voice.verticalDirection = \down
+%}
+
+stemup = \property Voice.basicStemProperties \push #'direction = #1
+stemdown = \property Voice.basicStemProperties \push #'direction = #-1
+stemboth= \property basicStemProperties \pop #'direction
slurup = \property Voice.slurVerticalDirection = \up
slurboth = \property Voice.slurVerticalDirection = \center
d,8( a' d f a d f d a f d )a
}
-accompany = \notes \relative c{
+accompany = \notes \relative c {
% snapnie, hoevaak relative c heeft ze nodig?
- \notes\relative c \basloopje
- \notes\relative c \basloopje
- \notes\relative c \basloopje
- \transpose bes \notes\relative c{ \basloopje }
- \transpose bes \notes\relative c{ \basloopje }
- \notes\relative c \basloopje
- \transpose bes \notes\relative c{ \basloopje }
- \transpose bes \notes\relative c{ \basloopje }
- \transpose a \notes\relative c{ \basloopje }
- \transpose bes \notes\relative c{ \basloopje }
- \transpose a \notes\relative c{ \basloopje }
- \notes\relative c \basloopje
- \notes\relative c \basloopje
+ \basloopje
+ \basloopje
+ \basloopje
+ \transpose bes \basloopje
+ \transpose bes \basloopje
+ \basloopje
+ \transpose bes \basloopje
+ \transpose bes \basloopje
+ \transpose a \basloopje
+ \transpose bes \basloopje
+ \transpose a \basloopje
+ \basloopje
+ \basloopje
% huh? d'
- \transpose d' \notes\relative c{ \basloopje }
- \notes\relative c \basloopje
- \notes\relative c \basloopje
- \transpose d' \notes\relative c{ \basloopje }
- \notes\relative c \basloopje
- \notes\relative c \basloopje
- \transpose e' \notes\relative c{ \basloopje }
- \notes\relative c \basloopje
- \notes\relative c \basloopje
- \transpose bes \notes\relative c{ \basloopje }
- \transpose a \notes\relative c{ \basloopje }
- \notes\relative c \basloopje
- \notes\relative c \basloopje
- \transpose d' \notes\relative c{ \basloopje }
- \notes\relative c \basloopje
- \transpose d' \notes\relative c{ \basloopje }
- \notes\relative c \basloopje
- \notes\relative c \basloopje
- \transpose e' \notes\relative c{ \basloopje }
+ \transpose d' \basloopje
+ \basloopje
+ \basloopje
+ \transpose d' \basloopje
+ \basloopje
+ \basloopje
+ \transpose e' \basloopje
+ \basloopje
+ \basloopje
+ \transpose bes \basloopje
+ \transpose a \basloopje
+ \basloopje
+ \basloopje
+ \transpose d' \basloopje
+ \basloopje
+ \transpose d' \basloopje
+ \basloopje
+ \basloopje
+ \transpose e' \basloopje
< e1*6/4 b' e> ~ < e b' e>
}
\context Staff=up <
\global
\context Voice=foo {
- \property Voice.verticalDirection = #1
- \property Voice.scriptVerticalDirection = #1
+ \stemup
+ \property Voice.basicScriptProperties \push #'direction = #1
+
\melody
}
>
\context Staff=down <
\global
\clef bass;
- \autochange Staff \accompany
+ \autochange Staff \context Voice \accompany
>
>