2 music-list.cc -- implement Music_sequence, Simultaneous_music, Sequential_music
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "music-list.hh"
10 #include "music-wrapper.hh"
11 #include "musical-pitch.hh"
13 #include "musical-request.hh"
14 #include "music-iterator.hh"
16 #include "killing-cons.tcc"
19 Simultaneous_music::length_mom () const
21 return maximum_length ();
26 Music_sequence::compress (Moment m
)
28 for (Cons
<Music
> *i
= music_p_list_p_
->head_
; i
; i
= i
->next_
)
29 i
->car_
->compress (m
);
32 Simultaneous_music::Simultaneous_music(Music_list
*p
)
38 Sequential_music::Sequential_music(Music_list
*p
)
44 Sequential_music::length_mom () const
46 return cumulative_length ();
50 Simultaneous_music::to_relative_octave (Musical_pitch p
)
52 return do_relative_octave (p
, true);
57 Music_sequence::do_relative_octave (Musical_pitch p
, bool b
)
59 return music_p_list_p_
->do_relative_octave (p
, b
);
64 Music_list::do_relative_octave (Musical_pitch last
, bool ret_first
)
68 for (Cons
<Music
> *i
= head_
; i
; i
= i
->next_
)
70 last
= i
->car_
->to_relative_octave (last
);
82 Music_list::Music_list (Music_list
const &s
)
83 : Cons_list
<Music
> (s
), Input (s
)
85 Cons_list
<Music
>::init ();
86 clone_killing_cons_list (*this, s
.head_
);
91 Music_list::add_music (Music
*m_p
)
96 append (new Killing_cons
<Music
> (m_p
, 0));
99 Request_chord::Request_chord()
100 : Simultaneous_music (new Music_list
)
106 Request_chord::to_relative_octave (Musical_pitch last
)
108 for (Cons
<Music
> *i
= music_p_list_p_
->head_
; i
; i
= i
->next_
)
110 if (Melodic_req
*m
= dynamic_cast <Melodic_req
*> (i
->car_
))
112 Musical_pitch
&pit
= m
->pitch_
;
113 pit
.to_relative_octave (last
);
121 Music_list::Music_list ()
125 Music_sequence::~Music_sequence ()
127 delete music_p_list_p_
;