]> git.donarmstrong.com Git - lilypond.git/blob - lily/part-combine-music.cc
* lily/context-specced-music-iterator.cc (class
[lilypond.git] / lily / part-combine-music.cc
1 /*   
2   part-combine-music.cc --  implement Part_combine_music
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2000--2002 Jan Nieuwenhuizen <janneke@gnu.org>
7   
8  */
9
10 #include "part-combine-music.hh"
11 #include "part-combine-music-iterator.hh"
12 #include "pitch.hh"
13
14 Part_combine_music::Part_combine_music ()
15 {
16 }
17
18 void
19 Part_combine_music::transpose (Pitch p)
20 {
21   get_first ()->transpose (p);
22   get_second () ->transpose (p);
23 }
24
25 Moment
26 Part_combine_music::length_mom () const
27 {
28   return get_first ()->length_mom ();
29 }
30
31 Pitch
32 Part_combine_music::to_relative_octave (Pitch p)
33 {
34   p = get_first ()->to_relative_octave (p);
35   return get_second ()->to_relative_octave (p);
36 }
37
38 void
39 Part_combine_music::compress (Moment m)
40 {
41   get_first ()->compress (m);
42   get_second ()->compress (m);
43 }
44
45 Music*
46 Part_combine_music::get_first () const
47 {
48   SCM l = get_mus_property ("elements");
49   if (!gh_pair_p (l))
50     return 0;
51   return unsmob_music (gh_car (l));
52 }
53
54
55 Music*
56 Part_combine_music::get_second () const
57 {
58   SCM l = get_mus_property ("elements");
59   if (!gh_pair_p (l))
60     return 0;
61   l = gh_cdr (l);
62   if (!gh_pair_p (l))
63     return 0;
64   return unsmob_music (gh_car (l));
65 }
66
67 ADD_MUSIC (Part_combine_music);