5 #include "inputcommands.hh"
6 #include "inputcommand.hh"
8 #include "staffcommands.hh"
9 #include "getcommand.hh"
13 interpret_meter(Input_command
*c
, int &beats_per_meas
, int& one_beat
,
14 Real
& whole_per_measure
)
16 beats_per_meas
= c
->args
[1].value();
17 one_beat
= c
->args
[2].value();
18 whole_per_measure
= beats_per_meas
/Real(one_beat
);
22 Input_cursor::when()const
28 Input_cursor::print() const
31 mtor
<< "meter " << whole_per_measure
32 << " pos "<< bars
<< ":" << whole_in_measure
<<'\n';
39 whole_per_measure
= 1.0; // ?
40 whole_in_measure
=0.0;
45 Input_cursor :: Input_cursor(PCursor
<Input_command
*>c
)
46 :PCursor
<Input_command
*>(c
)
56 whole_in_measure
+= when() - last
;
57 while (whole_per_measure
> 0 && whole_in_measure
>= whole_per_measure
) {
59 whole_in_measure
-= whole_per_measure
;
61 if (whole_in_measure
< 1e-5) // ugr
62 whole_in_measure
= 0.0;
66 Input_cursor::operator++(int)
69 (*(PCursor
<Input_command
*> *) this) ++;
73 if (ptr()->args
[0] == "METER") {
75 interpret_meter(ptr(), i
, j
, whole_per_measure
);
81 Input_cursor::addbot(Input_command
*c
)
89 Input_cursor::add(Input_command
*c
)
91 PCursor
<Input_command
*> ::add(c
);
96 Input_cursor::last_command_here()
99 PCursor
<Input_command
*> next
= (*this)+1;
100 while (next
.ok() && next
->when
== when()){
108 Input_cursor::setpartial(Real p
)
111 error_t ("Partial measure only allowed at beginning.", when() );
112 if (p
<0||p
> whole_per_measure
)
113 error_t ("Partial measure has incorrect size", when());
115 whole_in_measure
= whole_per_measure
- p
;