2003-07-02 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * lily/parser.yy (Repeated_music): bug fix beam multiplicity was
+ completely borked
+
+ * lily/chord-tremolo-engraver.cc (try_music): warnings for user-errors.
+ (try_music): bug fix: beam multiplicity was completely borked.
+
* scm/lily.scm: remove tail, filter-list, filter-out-list,
first-n, butfirst-n in favor of srfi-1 functions.
remove string-join, string-pad in favor of srfi-13 functions.
as half notes cannot appear in a regular beam, and should reach the
stems.
+In this example, each tremolo lasts exactly one measure.
+
(To ensure that the spacing engine is not confused we add some regular notes as well.)
"
}
\score {
\context Voice \notes\relative c' {
- % huh -> one beam missing!
- \repeat "tremolo" 16 { d16 e }
+ \time 4/4
+ \repeat "tremolo" 16 { d32 e }
\repeat "tremolo" 8 { d16 e }
- \repeat "tremolo" 4 { d e }
- \repeat "tremolo" 2 { d e }
- c4
- \break
- \repeat "tremolo" 4 { f'8 e }
- \repeat "tremolo" 2 { f e }
- c4 c4
-
- \repeat "tremolo" 3 { f8 e }
- c4
- c4 c4 c4 c4
- c4 c4 c4 c4
- c4 c4 c4 c4
+ \repeat "tremolo" 4 { d8 e }
+
+ \time 3/4
+ \repeat "tremolo" 12 { d32 e }
+ \repeat "tremolo" 6 { d16 e }
+ \repeat "tremolo" 3 { d8 e }
+
+ \time 2/4
+ \repeat "tremolo" 8 { d32 e }
+ \repeat "tremolo" 4 { d16 e }
+ \repeat "tremolo" 2 { d8 e }
+ \time 1/4
+ \repeat "tremolo" 4 { d32 e }
+ \repeat "tremolo" 2 { d16 e }
+
+ c4 c4 c4 c4 c4
}
- \paper {
- linewidth = 90*\staffspace
- }
+
\midi { }
}
%% new-chords-done %%
repeat_ = rp;
start_mom_ = now_mom ();
stop_mom_ = start_mom_ + l;
- sequential_body_b_ = dynamic_cast<Sequential_music*> (rp->body ());
+ Sequential_music * seq = dynamic_cast<Sequential_music*> (rp->body ());
+ sequential_body_b_ = seq;
+
+ int elt_count = seq ? scm_ilength (seq-> music_list ()) : 1;
+
+ if (elt_count != 2)
+ {
+ rp->origin ()->warning (_f ("Chord tremolo with %d elements. Must have two elements.", elt_count));
+ }
+
+ if (elt_count <= 0)
+ elt_count = 1;
+
Rational total_dur = l.main_part_;
- Rational note_dur = (total_dur / Rational (repeat_->repeat_count ()));
- flags_ = intlog2 ((total_dur / note_dur).num ());
+ Rational note_dur = total_dur / Rational (elt_count * repeat_->repeat_count ());
+
+ if (total_dur < Rational (1,4))
+ {
+ /*
+ This would require beams between flagged (8th) notes.
+ */
+ rp->origin ()->warning ("Chord tremolo is too short to denote properly.");
+ }
+
+ Rational written_note_dur = total_dur / Rational (elt_count);
+ flags_ = intlog2 (note_dur.den ()) -2 ;
return true;
}
}
else if (!sequential_body_b_ && !stem_tremolo_)
{
-
if (flags_)
{
stem_tremolo_ = new Item (get_property ("StemTremolo"));
announce_grob(stem_tremolo_, repeat_->self_scm());
stem_tremolo_->set_grob_property ("flag-count",
scm_int2num (flags_));
-
}
}
}
num = gh_int2scm (1);
if (den != SCM_UNDEFINED)
- SCM_ASSERT_TYPE(gh_number_p (den), length, SCM_ARG4, __FUNCTION__, "integer");
+ {
+ SCM_ASSERT_TYPE(gh_number_p (den), length, SCM_ARG4, __FUNCTION__, "integer");
+ compress = true;
+ }
else
den = gh_int2scm (1);
#include "input-smob.hh"
#include "event.hh"
#include "text-item.hh"
-
+#include "music-list.hh"
#define MY_MAKE_MUSIC(x) make_music_by_name (ly_symbol2scm (x))
r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
r-> set_mus_property ("elements",alts);
- if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
- {
- /*
- we can not get durations and other stuff correct down the line, so we have to
- add to the duration log here.
- */
- SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
- if (($3 % 3) == 0)
- gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3*2/3)),gh_int2scm(1));
- else
- gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)), gh_int2scm(0));
+ if (gh_equal_p ($2, scm_makfrom0str ("tremolo"))) {
+ /*
+ we can not get durations and other stuff correct down the line, so we have to
+ add to the duration log here.
+ */
+ static SCM func;
+
+ if (!func)
+ func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
+
+ int dots = ($3 % 3) ? 0 : 1;
+ int shift = -intlog2 ((dots) ? ($3*2/3) : $3);
+
+ Sequential_music * seq = dynamic_cast<Sequential_music*> ($4);
+
+ if (seq) {
+ int list_len =scm_ilength (seq->music_list ());
+ if (list_len != 2)
+ seq->origin ()->warning ("Chord tremolo must have 2 elements.");
+ shift -= 1;
+ r->compress (Moment (Rational (1,list_len)));
+ }
+ gh_call3 (func, r->self_scm (), gh_int2scm(shift),gh_int2scm(dots));
+
}
r->set_spot (*$4->origin ());
(types . (general-music repeated-music percent-repeated-music))
))
- (TremoloRepeteadMusic
+ (TremoloRepeatedMusic
. (
(iterator-ctor . ,Chord_tremolo_iterator::constructor)
(description . "Repeated notes denoted by tremolo beams.")
'(("volta" . VoltaRepeatedMusic)
("unfold" . UnfoldedRepeatedMusic)
("percent" . PercentRepeatedMusic)
- ("tremolo" . TremoloRepeteadMusic)
+ ("tremolo" . TremoloRepeatedMusic)
("fold" . FoldedRepeatedMusic)
)))
(music-name