blob: abe444cf6f42f330a23668ffbdccc823fed85250 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/*
music-list.cc -- implement Music_sequence, Simultaneous_music, Sequential_music
source file of the GNU LilyPond music typesetter
(c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "music-list.hh"
#include "music-wrapper.hh"
#include "musical-pitch.hh"
#include "request.hh"
#include "musical-request.hh"
#include "music-iterator.hh"
#include "main.hh"
#include "killing-cons.tcc"
Moment
Simultaneous_music::length_mom () const
{
return maximum_length ();
}
void
Music_sequence::compress (Moment m)
{
for (Cons<Music> *i = music_p_list_p_->head_; i; i = i->next_)
i->car_->compress (m);
}
Simultaneous_music::Simultaneous_music(Music_list *p)
: Music_sequence (p)
{
}
Sequential_music::Sequential_music(Music_list *p)
: Music_sequence (p)
{
}
Moment
Sequential_music::length_mom () const
{
return cumulative_length ();
}
Musical_pitch
Simultaneous_music::to_relative_octave (Musical_pitch p)
{
return do_relative_octave (p, true);
}
Musical_pitch
Music_sequence::do_relative_octave (Musical_pitch p, bool b)
{
return music_p_list_p_->do_relative_octave (p, b);
}
Musical_pitch
Music_list::do_relative_octave (Musical_pitch last, bool ret_first)
{
Musical_pitch retval;
int count=0;
for (Cons<Music> *i = head_; i ; i = i->next_)
{
last = i->car_->to_relative_octave (last);
if (!count ++ )
retval = last;
}
if (!ret_first)
retval = last;
return retval;
}
Music_list::Music_list (Music_list const &s)
: Cons_list<Music> (s), Input (s)
{
Cons_list<Music>::init ();
clone_killing_cons_list (*this, s.head_);
}
void
Music_list::add_music (Music*m_p)
{
if (!m_p)
return;
append (new Killing_cons<Music> (m_p, 0));
}
Request_chord::Request_chord()
: Simultaneous_music (new Music_list)
{
}
Musical_pitch
Request_chord::to_relative_octave (Musical_pitch last)
{
for (Cons<Music> *i = music_p_list_p_->head_; i ; i = i->next_)
{
if (Melodic_req *m= dynamic_cast <Melodic_req *> (i->car_))
{
Musical_pitch &pit = m->pitch_;
pit.to_relative_octave (last);
return pit;
}
}
return last;
}
Music_list::Music_list ()
{
}
Music_sequence::~Music_sequence ()
{
delete music_p_list_p_;
}
|