flower-1.0.2
[lilypond.git] / request.cc
blob27029ba8d759dc6ecbb12da35be11b716a030919
1 #include "request.hh"
2 Request::Request(Voice_element*v)
4 elt = v;
5 tag = UNKNOWN;
8 Note_req::Note_req(Voice_element*v):
9 Request(v)
11 name = 'c';
12 octave = 0;
13 accidental = 0;
14 forceacc = false;
15 balltype = 1;
16 dots = 0;
17 tag = NOTE;
20 Rest_req::Rest_req(Voice_element*v)
21 :Request(v)
23 balltype = 1;
24 dots = 0;
25 tag =REST;
28 Request::Request()
30 elt = 0;
31 tag = UNKNOWN;
34 Note_req*
35 Request::note()
37 assert(tag == NOTE);
38 return (Note_req*)this;
41 Rest_req*
42 Request::rest()
44 assert(tag == REST);
45 return (Rest_req*)this;
49 Real
50 wholes(int dur, int dots)
52 Real f = 1.0/Real(dur);
53 Real delta = f;
55 while (dots--) {
56 delta /= 2.0;
57 f += delta;
59 return f;
62 Real
63 Note_req::duration() const {
64 return wholes( balltype,dots);
66 Real
67 Rest_req::duration() const{
68 return wholes( balltype,dots);