}
if (ptw & PostTransportAdjustPlaybackBuffering) {
- /* non_realtime_locate() calls Automatable::transport_located()
- * for every route. This eventually calls
- * ARDOUR::AutomationList::state () which has a LocaleGuard,
- * and would switch locales forth/back every time.
- */
- LocaleGuard lg;
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {
/* don't seek if locate will take care of that in non_realtime_stop() */
if (!(ptw & PostTransportLocate)) {
- LocaleGuard lg; // see note for non_realtime_locate() above
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->non_realtime_locate (_transport_frame);
{
- LocaleGuard lg; // see note for non_realtime_locate() above
boost::shared_ptr<RouteList> rl = routes.reader();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
(*i)->non_realtime_locate (_transport_frame);
/* this for() block can be put inside the previous if() and has the effect of ... ??? what */
{
- LocaleGuard lg; // see note for non_realtime_locate() above
DEBUG_TRACE (DEBUG::Transport, X_("Butler PTW: locate\n"));
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler PTW: locate on %1\n", (*i)->name()));
}
_last_roll_location = _last_roll_or_reversal_location = _transport_frame;
- Located (); /* EMIT SIGNAL */
+ if (!synced_to_engine () || _transport_frame == _engine.transport_frame ()) {
+ Located (); /* EMIT SIGNAL */
+ }
}
/** Set the transport speed.
const Tempo& tempo = _tempo_map->tempo_at_frame (_transport_frame);
const Meter& meter = _tempo_map->meter_at_frame (_transport_frame);
- double div = meter.divisions_per_bar ();
- double pulses = _tempo_map->exact_qn_at_frame (_transport_frame, 0) * div / 4.0;
- double beats_left = fmod (pulses, div);
+ const double num = meter.divisions_per_bar ();
+ const double den = meter.note_divisor ();
+ const double barbeat = _tempo_map->exact_qn_at_frame (_transport_frame, 0) * den / (4. * num);
+ const double bar_fract = fmod (barbeat, 1.0); // fraction of bar elapsed.
_count_in_samples = meter.frames_per_bar (tempo, _current_frame_rate);
- double dt = _count_in_samples / div;
- if (beats_left == 0) {
+ double dt = _count_in_samples / num;
+ if (bar_fract == 0) {
/* at bar boundary, count-in 2 bars before start. */
_count_in_samples *= 2;
} else {
/* beats left after full bar until roll position */
- _count_in_samples += meter.frames_per_grid (tempo, _current_frame_rate) * beats_left;
+ _count_in_samples *= 1. + bar_fract;
}
int clickbeat = 0;
while (cf < _transport_frame) {
add_click (cf - _worst_track_latency, clickbeat == 0);
cf += dt;
- clickbeat = fmod (clickbeat + 1, div);
+ clickbeat = fmod (clickbeat + 1, num);
}
}
}