2 new-repeated-music.cc -- implement New_repeated_music
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "new-repeated-music.hh"
11 #include "music-list.hh"
12 #include "musical-pitch.hh"
15 New_repeated_music::New_repeated_music(Music *beg, int times, Music_sequence * alts)
20 alternatives_p_ = alts;
24 New_repeated_music::New_repeated_music (New_repeated_music const &s)
27 repeats_i_ = s.repeats_i_;
29 semi_fold_b_ = s.semi_fold_b_;
31 repeat_body_p_ = s.repeat_body_p_ ? s.repeat_body_p_->clone () : 0;
32 alternatives_p_ = s.alternatives_p_
33 ? dynamic_cast<Music_sequence*> (s.alternatives_p_->clone ()):0;
36 New_repeated_music::~New_repeated_music ()
38 delete repeat_body_p_;
39 delete alternatives_p_;
43 New_repeated_music::do_print () const
46 DOUT << "Fold = " << fold_b_ << " reps: " << repeats_i_;
49 repeat_body_p_->print();
52 alternatives_p_->print();
57 New_repeated_music::to_relative_octave (Musical_pitch p)
60 p = repeat_body_p_->to_relative_octave (p);
63 p = alternatives_p_->do_relative_octave (p, true);
69 New_repeated_music::transpose (Musical_pitch p)
72 repeat_body_p_->transpose (p);
75 alternatives_p_->transpose (p);
79 New_repeated_music::compress (Moment p)
82 repeat_body_p_->compress (p);
85 alternatives_p_->compress (p);
89 New_repeated_music::alternatives_length_mom () const
94 ? alternatives_p_->maximum_length ()
95 : alternatives_p_->cumulative_length ();
101 New_repeated_music::length_mom () const
107 m += repeat_body_p_->length_mom ();
111 Moment beg = (repeat_body_p_) ? repeat_body_p_->length_mom () : Rational(0);
113 beg *= Rational (repeats_i_);
117 m += alternatives_length_mom ();