+pl 9.jcn3
+ - property: unfoldRepeats; unfolding still broken
+ - volta spanner y-collision
+ - bf: volta number,dot placement
+ - bf's: init/table16,20
+ - small additions to init/lily.scm to enable some testing
+ - junked extra repeat braces
+
pl 9.jcn2
- bf/redo: slur.cc, encompass-info: setting of encompass array.
- switched tuplet-engaver off (core dumps)
MAJOR_VERSION=1
MINOR_VERSION=1
PATCH_LEVEL=9
-MY_PATCH_LEVEL=jcn2
+MY_PATCH_LEVEL=jcn3
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
(define emptybar empty1)
(define setdynamic empty1)
-(define settext empty1)
-(define setnumber empty1)
+(define (settext s) (text "text" s))
+(define (setnumber s) (text "number" s))
+(define repeatbar empty1)
+(define startrepeat empty1)
+(define (setbold s) (text "bold" s))
+(define (setnumber-1 s) (text "numberj" s))
;;;;;;;; TeX
% index symbol #parameters xmin xmax ymin ymax
"style" = \table {
- "bold" "setbold" 1 0.0\pt 7.50\pt 0.0\pt 8.0\pt
+ "bold" "setbold" 1 0.0\pt 7.50\pt 0.0\pt 8.0\pt
"dynamic" "setdynamic" 1 0.0\pt 0.0\pt 0.0\pt 8.0\pt
"finger" "setfinger" 1 0.0\pt 2.0\pt 0.0\pt 4.0\pt
"italic" "setitalic" 1 0.0\pt 4.\pt 0.0\pt 8.0\pt
"typewriter" "settypewriter" 1 0.0\pt 4.\pt 0.0\pt 8.0\pt
"large" "setlarge" 1 0.0\pt 9.50\pt 0.0\pt 10.0\pt
"number" "setnumber" 1 0.0\pt 6.0\pt 0.0\pt 8.0\pt
- "number-1" "setnumber-1" 1 0.0\pt 4.0\pt 0.0\pt 6.0\pt
+ "number-1" "setnumber-1" 1 0.0\pt 4.0\pt 0.0\pt 5.0\pt
"roman" "settext" 1 0.0\pt 4.5\pt 0.0\pt 8.0\pt
}
"dynamics" = \table {
% index symbol #parameters xmin xmax ymin ymax
"style" = \table {
- "bold" "setbold" 1 0.0\pt 5.50\pt 0.0\pt 8.0\pt
+ "bold" "setbold" 1 0.0\pt 5.50\pt 0.0\pt 10.0\pt
"dynamic" "setdynamic" 1 0.0\pt 0.0\pt 0.0\pt 10.0\pt
"finger" "setfinger" 1 0.0\pt 4.5\pt 0.0\pt 5.0\pt
"typewriter" "settypewriter" 1 0.0\pt 5.5\pt 0.0\pt 10.0\pt
"Large" "setLarge" 1 0.0\pt 6.50\pt 0.0\pt 12.0\pt
"mark" "setmark" 1 0.0\pt 6.50\pt 0.0\pt 12.0\pt
"number" "setnumber" 1 0.0\pt 8.0\pt 0.0\pt 10.0\pt
- "number-1" "setnumber-1" 1 0.0\pt 6.0\pt 0.0\pt 8.0\pt
+ "number-1" "setnumber-1" 1 0.0\pt 6.0\pt 0.0\pt 7.0\pt
"roman" "settext" 1 0.0\pt 5.6\pt 0.0\pt 10.0\pt
}
\score{
<
- \type Staff \notes\relative c''{
- c c c c
- \repeat 2 { { d d d d } }
- \alternative { { a a a a } { a a a a } }
+ \type Staff \notes\relative c'{
+ c d e f
+ \repeat 2 { g a b c }
+ \alternative { { c b a g } { f e d c } }
}
\type Lyrics \lyrics {
De eer- ste < { maat } { moet } >
- \repeat 2 { { } }
+ \repeat 2 { }
\alternative <
{ en dan twee keer }
{ een koe- plet _ }
$staff1_voice_1 = \notes {
[a8.()fis16]
- \repeat 2 { { d4 fis4 a4 d'2 [fis'8. e'16] d'4 fis4 gis4 a2 [a8 a8]
- fis'4. e'8 d'4 cis'2 [b8. cis'16] d'4 d'4 a4 } }
+ \repeat 2 { d4 fis4 a4 d'2 [fis'8. e'16] d'4 fis4 gis4 a2 [a8 a8]
+ fis'4. e'8 d'4 cis'2 [b8. cis'16] d'4 d'4 a4 }
\alternative { { fis4 d4 [a8. fis16] } { fis4 d4 [fis'8. fis'16] } }
fis'4 g'4 a'4 a'2 [g'8 fis'8] e'4 fis'4
g'4 g'2 g'4 fis'4. e'8 d'4 cis'2 [b8. cis'16] d'4 fis4 gis4 a2 a4
$staff1_voice_2 = \notes {
[a8.()fis16]
- \repeat 2 { { a,4 d4 e4 d4~fis4 [fis8. fis16] fis4 d4 d4 cis2
- [e8 e8] a4. a8 a4 a2 [a8. a16] a4 a4 a4 } }
+ \repeat 2 { a,4 d4 e4 d4~fis4 [fis8. fis16] fis4 d4 d4 cis2
+ [e8 e8] a4. a8 a4 a2 [a8. a16] a4 a4 a4 }
\alternative { { fis4 d4 [a8. fis16] } { fis4 d4 r4 } }
a4 a4 d'4 d'2 [a8 a8] cis'4 cis'4 cis'4 cis'2 a4 a4. a8 a4 a2
[a8. a16] d4 d4 d4 cis2 e4 fis4 e4 d4 d4 d4 dis4 g4 [g8()dis8] e4 e2
$staff2_voice_1 = \notes {
r4
- \repeat 2 { { fis4 a4 a4 b2 [cis'8. cis'16] b4 b4 b4 a2 [cis'8 cis'8]
- d'4. cis'8 d'4 e'2 [e'8. e'16] d'4 d'4 a4 } }
+ \repeat 2 { fis4 a4 a4 b2 [cis'8. cis'16] b4 b4 b4 a2 [cis'8 cis'8]
+ d'4. cis'8 d'4 e'2 [e'8. e'16] d'4 d'4 a4 }
\alternative { { fis4 d4 r4 } { fis4 d4 r4 } }
d4 e4 fis4 fis'2 [e'8 d'8] e'4 e'4 e'4 e'2 cis'4 d'4. cis'8 d'4 e'2
[e'8. e'16] a4 a4 e4 e2 cis'4 a4 a4 a4 g4 g4 b4 b4 b4 b4 a2
$staff2_voice_2 = \notes {
r4
- \repeat 2 { { d4 d4 cis4 b,2 [ais,8. ais,16] b,4 b,4 e4 a,2 [a8 a8]
- d4. e8 [fis8 g8] a2 [g8. g16] fis4 fis4 a4 } }
+ \repeat 2 { d4 d4 cis4 b,2 [ais,8. ais,16] b,4 b,4 e4 a,2 [a8 a8]
+ d4. e8 [fis8 g8] a2 [g8. g16] fis4 fis4 a4 }
\alternative { { fis4 d4 r4 } { fis4 d4 r4 } }
d4 d4 d4 d2 [d8 d8] a4 a4 a4 a2 a,4 d4. e8 [fis8 g8] a2 [g8. g16]
fis4 d4 e4 a,2 a4 d4 e4 fis4 g4 g4 fis4 e4 [e8()fis8] [g8()gis8] a2
}
$text = \lyrics{
- Oh4 __ \repeat 2 { { } }
+ Oh4 __ \repeat 2 { }
\alternative <
{ say. can you see,2 by8. the16 dawn's4 ear- ly light2 What8
so8 proud-4. ly8 we4 hailed,2 At8. the16 twi-4 light's last gleam-
--- /dev/null
+\score{
+ \type Staff \notes\relative c'' {
+ % doesn't quite work yet
+ % \property Staff.unfoldRepeats = 1
+ \repeat 3 { a b c d }
+ \alternative { { d c b a } { a b c d } } d d d d
+ }
+}
virtual void do_process_and_next (Moment);
private:
+ void start_next_element ();
+
+ int unfold_i_;
+ Moment here_mom_;
Music_iterator* repeat_iter_p_;
Music_list_iterator* alternative_iter_p_;
};
{
public:
int repeats_i_;
+ bool unfold_b_;
Music* repeat_p_;
-// Music_list* alternative_p_;
Music_sequence* alternative_p_;
-// Repeated_music (Music*, int n, Music_list*);
Repeated_music (Music*, int n, Music_sequence*);
Repeated_music (Repeated_music const& s);
virtual ~Repeated_music ();
public:
Volta_spanner ();
-// void add_column (Note_column*);
+ void add_column (Note_column*);
void add_column (Bar*);
P<Text_def> number_p_;
P<Text_def> dot_p_;
-// Link_array<Note_column> column_arr_;
Link_array<Bar> column_arr_;
+ Link_array<Note_column> note_column_arr_;
bool last_b_;
protected:
SCM_UNDEFINED);
a.str_ = "volta";
Real interline_f = paper_l_->interline_f ();
- a.dim_[Y_AXIS] = Interval (-interline_f / 2, interline_f / 2);
+// a.dim_[Y_AXIS] = Interval (0, 2 * interline_f);
+ a.dim_[Y_AXIS] = Interval (-interline_f, interline_f);
a.dim_[X_AXIS] = Interval (0, w);
return a;
}
// mmm
Mudela_version oldest_version ("1.0.7");
-Mudela_version version ("1.0.10");
+Mudela_version version ("1.0.11");
// needed for bison.simple's malloc() and free()
%type <trans> translator_spec translator_spec_body
%type <tempo> tempo_request
%type <notenametab> notenames_body notenames_block
-%expect 3
+%expect 4
%left '-' '+'
}
;
-Repeated_music: REPEAT unsigned '{' Music '}' Alternative_music {
- // s/r conflicts -> '{' '}'
- Music_sequence* m = dynamic_cast <Music_sequence*> ($6);
+Repeated_music: REPEAT unsigned Music Alternative_music {
+ Music_sequence* m = dynamic_cast <Music_sequence*> ($4);
assert (m);
- $$ = new Repeated_music ($4, $2, m);
+ $$ = new Repeated_music ($3, $2 >? 1, m);
}
;
#include "repeated-music.hh"
#include "time-description.hh"
#include "volta-spanner.hh"
-//#include "note-column.hh"
+#include "note-column.hh"
ADD_THIS_TRANSLATOR (Repeat_engraver);
{
if (Repeated_music* r = dynamic_cast<Repeated_music *> (m))
{
+ r->unfold_b_ = get_property ("unfoldRepeats").to_bool ();
+ if (r->unfold_b_)
+ return true;
+
Moment stop_mom = now_moment () + r->repeat_p_->duration ()
+ r->alternative_p_->music_p_list_p_->top ()->duration ();
Moment alt_mom = now_moment () + r->repeat_p_->duration ();
Repeat_engraver::acknowledge_element (Score_element_info i)
{
Moment now = now_moment ();
-// if (Note_column *c = dynamic_cast<Note_column *> (i.elem_l_))
+ if (Note_column *c = dynamic_cast<Note_column *> (i.elem_l_))
+ {
+ for (int i = 0; i < volta_p_arr_.size (); i++)
+ if ((now >= alternative_start_mom_arr_[i]) && volta_p_arr_[i])
+ volta_p_arr_[i]->add_column (c);
+ }
if (Bar *c = dynamic_cast<Bar*> (i.elem_l_))
{
for (int i = 0; i < volta_p_arr_.size (); i++)
{
repeat_iter_p_ = 0;
alternative_iter_p_ = 0;
+ here_mom_ = 0;
+#if 0
+ unfold_i_ = repeated_music_l ()->unfold_b_ ?
+ repeated_music_l ()->repeats_i_ - 1 : 0;
+#endif
+ unfold_i_ = -1;
}
Repeated_music_iterator::~Repeated_music_iterator ()
void
Repeated_music_iterator::construct_children ()
{
+#if 0
+ unfold_i_ = repeated_music_l ()->unfold_b_ ?
+ repeated_music_l ()->repeats_i_ - 1 : 0;
+#endif
repeat_iter_p_ = get_iterator_p (repeated_music_l ()->repeat_p_);
}
music_l_->warning ( _("No one to print a volta bracket"));
}
if (repeat_iter_p_ && repeat_iter_p_->ok ())
- repeat_iter_p_->process_and_next (m);
+ repeat_iter_p_->process_and_next (m - here_mom_);
else
- alternative_iter_p_->process_and_next (m -
- repeated_music_l ()->repeat_p_->duration ());
+ alternative_iter_p_->process_and_next (m - here_mom_);
Music_iterator::do_process_and_next (m);
}
Repeated_music_iterator::next_moment () const
{
if (repeat_iter_p_)
- return repeat_iter_p_->next_moment ();
+ return repeat_iter_p_->next_moment () + here_mom_;
else if (alternative_iter_p_)
-// return alternative_iter_p_->next_moment ();
- return alternative_iter_p_->next_moment () +
- repeated_music_l ()->repeat_p_->duration ();
-// return 0;
- return repeated_music_l ()->repeat_p_->duration ();
+ return alternative_iter_p_->next_moment () + here_mom_;
+ // huh?
+// return repeated_music_l ()->repeat_p_->duration ()
+// * Moment (repeated_music_l ()->repeats_i_)
+// + repeated_music_l ()->alternative_p_->duration () + here_mom_;
+ return repeated_music_l ()->alternative_p_->duration () + here_mom_;
}
bool
Repeated_music_iterator::ok () const
{
-#if 0
- if (repeat_iter_p_)
- return repeat_iter_p_->ok ();
- else if (alternative_iter_p_)
- return alternative_iter_p_->ok ();
- return false;
-#elif 0
- if (repeat_iter_p_ && repeat_iter_p_->ok ())
- return true;
- else if (!alternative_iter_p_)
+ if (!repeat_iter_p_ && !alternative_iter_p_)
+ return false;
+
+ if ((repeat_iter_p_ && repeat_iter_p_->ok ())
+ || (alternative_iter_p_ && alternative_iter_p_->ok ()))
return true;
- return alternative_iter_p_->ok ();
-#else // perhaps iterating stops because we return false on repeat_iter...
- if (repeat_iter_p_)
- {
- if (repeat_iter_p_->ok ())
- return true;
- else
- {
- // urg, we're const
- Repeated_music_iterator *urg = (Repeated_music_iterator*)this;
- delete urg->repeat_iter_p_;
- urg->repeat_iter_p_ = 0;
- urg->alternative_iter_p_ = dynamic_cast<Music_list_iterator*>
- (get_iterator_p ((Music*)repeated_music_l ()->alternative_p_));
- }
- }
- if (alternative_iter_p_)
- return alternative_iter_p_->ok ();
- return false;
-#endif
+
+ Repeated_music_iterator *urg = (Repeated_music_iterator*)this;
+ // urg, we're const
+ urg->start_next_element ();
+
+ return ok ();
}
Repeated_music*
return (Repeated_music*)Music_iterator::music_l_;
}
+void
+Repeated_music_iterator::start_next_element ()
+{
+ if (repeat_iter_p_)
+ {
+ assert (!repeat_iter_p_->ok ());
+ assert (!alternative_iter_p_);
+ delete repeat_iter_p_;
+ repeat_iter_p_ = 0;
+ alternative_iter_p_ = dynamic_cast<Music_list_iterator*>
+ (get_iterator_p ((Music*)repeated_music_l ()->alternative_p_));
+ here_mom_ += repeated_music_l ()->repeat_p_->duration ();
+ }
+ else if (alternative_iter_p_)
+ {
+ assert (!alternative_iter_p_->ok ());
+ assert (!repeat_iter_p_);
+ delete alternative_iter_p_;
+ alternative_iter_p_ = 0;
+ if (unfold_i_ < 0)
+ unfold_i_ = repeated_music_l ()->unfold_b_ ?
+ repeated_music_l ()->repeats_i_ - 1 : 0;
+ if (unfold_i_)
+ {
+ unfold_i_--;
+ repeat_iter_p_ = get_iterator_p (repeated_music_l ()->repeat_p_);
+ // urg, assume same length alternatives for now...
+// here_mom_ += repeated_music_l ()->alternative_p_->music_p_list_p_->top ()->duration ();
+ /*
+ URG
+ this is *wrong* but at least it doesn't dump core
+ when unfolding, the alternative (sequential) music
+ shouldn't automatically move to the next alternative
+
+ how to intercept this...
+ */
+ here_mom_ += repeated_music_l ()->alternative_p_->duration ();
+ }
+ }
+}
+
#include "repeated-music.hh"
#include "musical-pitch.hh"
-//Repeated_music::Repeated_music (Music* r, int n, Music_list* a)
Repeated_music::Repeated_music (Music* r, int n, Music_sequence* a)
{
repeats_i_ = n;
+ unfold_b_ = false;
repeat_p_ = r;
alternative_p_ = a;
}
{
repeat_p_ = (s.repeat_p_) ? s.repeat_p_->clone () : 0;
// urg?
-// alternative_p_ = (s.alternative_p_) ? dynamic_cast <Music_list*> (s.alternative_p_->clone ()) : 0;
alternative_p_ = (s.alternative_p_) ? dynamic_cast <Music_sequence*> (s.alternative_p_->clone ()) : 0;
}
#include "debug.hh"
#include "lookup.hh"
#include "molecule.hh"
-//#include "note-column.hh"
+#include "note-column.hh"
#include "p-col.hh" // urg
#include "bar.hh"
#include "p-col.hh"
{
Molecule* mol_p = new Molecule;
- if (column_arr_.size ()){
- Real dx = paper ()->internote_f ();
- Real w = width ().length () - 2 * dx;
- Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_] >
- column_arr_[0]->extent (Y_AXIS) [dir_];
- dy += 4;
+ if (column_arr_.size ())
+ {
+ Real internote_f = paper ()->internote_f ();
+ Real dx = internote_f;
+ Real w = width ().length () - 2 * dx;
+ Atom volta (lookup_l ()->volta (w, last_b_));
+ Real h = volta.dim_.y ().length ();
+ Atom num (number_p_->get_atom (paper (), LEFT));
+ Atom dot (dot_p_->get_atom (paper (), LEFT));
+ Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_] >
+ column_arr_[0]->extent (Y_AXIS) [dir_];
+ dy += 2 * h;
+ for (int i = 0; i < note_column_arr_.size (); i++)
+ dy = dy >? note_column_arr_[i]->height ().max ();
+ dy -= h;
- Atom num (number_p_->get_atom (paper (), LEFT));
- Atom dot (dot_p_->get_atom (paper (), LEFT));
- Real gap = num.dim_.x ().length () / 2;
- Offset off (num.dim_.x ().length () + gap,
- num.dim_.y ().length () - 4 - gap / paper ()->internote_f ());
- // urg?
- off -= Offset (0, num.dim_.y ().length () + gap / paper ()->internote_f ());
- num.translate (off);
- dot.translate (off);
- mol_p->add_atom (num);
- mol_p->add_atom (dot);
- mol_p->add_atom (lookup_l ()->volta (w, last_b_));
- mol_p->translate (Offset (dx, dy));
- }
+ Real gap = num.dim_.x ().length () / 2;
+ Offset off (num.dim_.x ().length () + gap,
+ (h - num.dim_.y ().length ()) / internote_f - gap);
+ num.translate (off);
+ Real dotheight = dot.dim_.y ().length () / 7;
+ off -= Offset (0, dotheight);
+ dot.translate (off);
+ mol_p->add_atom (volta);
+ mol_p->add_atom (num);
+ mol_p->add_atom (dot);
+ mol_p->translate (Offset (dx, dy));
+ }
return mol_p;
}
void
Volta_spanner::do_substitute_dependency (Score_element* o, Score_element* n)
{
-// if (Note_column* c = dynamic_cast <Note_column*> (o))
-// column_arr_.substitute (c, dynamic_cast<Note_column*> (n));
- if (Bar* c = dynamic_cast <Bar*> (o))
+ if (Note_column* c = dynamic_cast <Note_column*> (o))
+ note_column_arr_.substitute (c, dynamic_cast<Note_column*> (n));
+ else if (Bar* c = dynamic_cast <Bar*> (o))
column_arr_.substitute (c, dynamic_cast<Bar*> (n));
}
void
-//Volta_spanner::add_column (Note_column* c)
Volta_spanner::add_column (Bar* c)
{
column_arr_.push (c);
add_dependency (c);
}
+void
+Volta_spanner::add_column (Note_column* c)
+{
+ note_column_arr_.push (c);
+ add_dependency (c);
+}
+
/volta_w exch def
staffheight 2 div /volta_h exch def
volta_t setlinewidth
+% urg: the only Level-2 PS, check effect in print
+% true setstrokeadjust
+ 1 setlinecap
+ 1 setlinejoin
0 0 moveto
0 volta_h lineto
volta_w volta_h lineto