@@ -266,7 +266,10 @@ class notegroup: public boost::static_visitor<void>
266
266
{
267
267
BOOST_ASSERT (stack_begin != stack_end);
268
268
return std::accumulate (std::next (stack_begin), stack_end,
269
- static_cast <rational>(*stack_begin));
269
+ static_cast <rational>(*stack_begin),
270
+ [](rational const &a, value_proxy const &b) {
271
+ return a + rational (b);
272
+ });
270
273
}
271
274
272
275
tuplet_info const &tuplet_state () const { return tuplet; }
@@ -505,7 +508,7 @@ class partial_voice_interpreter
505
508
state.time_signature != 1 && maybe_whole_measure_rest (*iterator)) {
506
509
*stack_end = value_proxy (boost::get<ast::rest>(*iterator), state.time_signature );
507
510
recurse ( std::next (iterator), end, stack_begin, std::next (stack_end)
508
- , zero, position + state.time_signature , tuplet);
511
+ , zero, position + rational ( state.time_signature ) , tuplet);
509
512
}
510
513
}
511
514
}
@@ -589,7 +592,7 @@ class large_and_small_visitor : public boost::static_visitor<bool>
589
592
if (!is_grace (value)) {
590
593
value_proxy *const next = proxy + 1 ;
591
594
if (fast_leq (*new (proxy)value_proxy (value, large_value, factor), max_duration)) {
592
- rational const next_position (position + *proxy);
595
+ rational const next_position (position + rational ( *proxy) );
593
596
// If this is a tuplet end, only accept it if its position makes sense.
594
597
if (!dyadic_next_position || is_dyadic (next_position)) {
595
598
if (std::distance (rest, end) >= 10 && state.threads < max_threads) {
@@ -604,25 +607,25 @@ class large_and_small_visitor : public boost::static_visitor<bool>
604
607
new_proxy->set_tuplet_info (tuplet_begin, tuplet_end);
605
608
future = std::async (std::launch::async, [&]() {
606
609
interpreter.recurse ( rest, end, new_stack.get (), new_proxy + 1
607
- , max_duration - *new_proxy, next_position
610
+ , max_duration - rational ( *new_proxy) , next_position
608
611
, tuplet
609
612
);
610
613
state.threads --;
611
614
});
612
615
} else {
613
616
proxy->set_tuplet_info (tuplet_begin, tuplet_end);
614
617
interpreter.recurse ( rest, end, stack_begin, next
615
- , max_duration - *proxy, next_position, tuplet
618
+ , max_duration - rational ( *proxy) , next_position, tuplet
616
619
);
617
620
}
618
621
}
619
622
}
620
623
if (fast_leq (*new (proxy)value_proxy (value, small_value, factor), max_duration)) {
621
- rational const next_position (position + *proxy);
624
+ rational const next_position (position + rational ( *proxy) );
622
625
if (!dyadic_next_position || is_dyadic (next_position)) {
623
626
proxy->set_tuplet_info (tuplet_begin, tuplet_end);
624
627
interpreter.recurse ( rest, end, stack_begin, next
625
- , max_duration - *proxy, next_position, tuplet
628
+ , max_duration - rational ( *proxy) , next_position, tuplet
626
629
);
627
630
}
628
631
}
@@ -635,8 +638,7 @@ class large_and_small_visitor : public boost::static_visitor<bool>
635
638
{
636
639
if (!position) { // full measure simile
637
640
BOOST_ASSERT (static_cast <bool >(interpreter.last_measure_duration ()));
638
- if (*new (proxy)value_proxy
639
- (simile, interpreter.last_measure_duration ()) > rational (0 ) &&
641
+ if (rational (*new (proxy)value_proxy (simile, interpreter.last_measure_duration ())) > rational (0 ) &&
640
642
fast_leq (static_cast <rational>(*proxy) / rational::int_type (simile.count ), max_duration)) {
641
643
rational const duration (static_cast <rational>(*proxy) / rational::int_type (simile.count ));
642
644
interpreter.recurse ( rest, end, stack_begin, proxy + 1
@@ -666,7 +668,7 @@ class large_and_small_visitor : public boost::static_visitor<bool>
666
668
tuplet.back ().ttl = count_rhythmic (rest, tuplet_end (rest, end, tuplet.back ().number , true ));
667
669
}
668
670
interpreter.recurse ( rest, end, stack_begin, proxy + 1
669
- , max_duration - *proxy, position + *proxy
671
+ , max_duration - rational ( *proxy) , position + rational ( *proxy)
670
672
, tuplet
671
673
);
672
674
}
0 commit comments