blob: 27029ba8d759dc6ecbb12da35be11b716a030919 (
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
|
#include "request.hh"
Request::Request(Voice_element*v)
{
elt = v;
tag = UNKNOWN;
}
Note_req::Note_req(Voice_element*v):
Request(v)
{
name = 'c';
octave = 0;
accidental = 0;
forceacc = false;
balltype = 1;
dots = 0;
tag = NOTE;
}
Rest_req::Rest_req(Voice_element*v)
:Request(v)
{
balltype = 1;
dots = 0;
tag =REST;
}
Request::Request()
{
elt = 0;
tag = UNKNOWN;
}
Note_req*
Request::note()
{
assert(tag == NOTE);
return (Note_req*)this;
}
Rest_req*
Request::rest()
{
assert(tag == REST);
return (Rest_req*)this;
}
Real
wholes(int dur, int dots)
{
Real f = 1.0/Real(dur);
Real delta = f;
while (dots--) {
delta /= 2.0;
f += delta;
}
return f;
}
Real
Note_req::duration() const {
return wholes( balltype,dots);
}
Real
Rest_req::duration() const{
return wholes( balltype,dots);
}
|