lilypond-1.3.67
[lilypond.git] / lily / music-sequence.cc
blob2b77780d39579534307e46b81290ff9ab0d741d0
1 /*
2 music-sequence.cc -- implement Music_sequence
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
9 #include "music-list.hh"
10 #include "debug.hh"
11 #include "musical-pitch.hh"
13 Music_sequence::Music_sequence (Music_sequence const&s)
14 : Music (s)
16 music_p_list_p_ = new Music_list (*s.music_p_list_p_);
21 Music_sequence::Music_sequence(Music_list *mlist_p)
23 music_p_list_p_ = mlist_p;
26 void
27 Music_sequence::transpose (Musical_pitch rq)
29 for (Cons<Music> *i = music_p_list_p_->head_; i; i = i->next_)
30 i->car_->transpose (rq);
33 void
34 Music_sequence::do_print() const
36 #ifndef NPRINT
37 for (Cons<Music> *i = music_p_list_p_->head_; i; i = i->next_)
38 i->car_->print();
39 #endif
43 void
44 Music_sequence::add_music (Music *m_p)
46 music_p_list_p_->add_music (m_p);
49 Moment
50 Music_sequence::cumulative_length () const
52 Moment last=0;
53 for (Cons<Music> *i = music_p_list_p_->head_; i; i = i->next_)
55 last += i->car_->length_mom ();
57 return last;
60 Musical_pitch
61 Music_sequence::to_relative_octave (Musical_pitch p)
63 return do_relative_octave (p, false);
67 Moment
68 Music_sequence::maximum_length () const
70 Moment dur = 0;
71 for (Cons<Music> *i = music_p_list_p_->head_; i; i = i->next_)
72 dur = dur >? i->car_->length_mom ();
74 return dur;
76 int
77 Music_sequence::length_i () const
79 return cons_list_size_i (music_p_list_p_->head_);