framepos_t transport_frame () const {return _transport_frame; }
framepos_t record_location () const {return _last_record_location; }
- framepos_t audible_frame () const;
+ framepos_t audible_frame (bool* latent_locate = NULL) const;
framepos_t requested_return_frame() const { return _requested_return_frame; }
void set_requested_return_frame(framepos_t return_to);
}
framepos_t
-Session::audible_frame () const
+Session::audible_frame (bool* latent_locate) const
{
framepos_t ret;
frameoffset_t offset = worst_playback_latency (); // - _engine.samples_since_cycle_start ();
offset *= transport_speed ();
+ if (latent_locate) {
+ *latent_locate = false;
+ }
if (synced_to_engine()) {
/* Note: this is basically just sync-to-JACK */
if (!play_loop || !have_looped) {
if (ret < _last_roll_or_reversal_location) {
+ if (latent_locate) {
+ *latent_locate = true;
+ }
return _last_roll_or_reversal_location;
}
} else {
- // latent loops
+ /* the play-position wrapped at the loop-point
+ * ardour is already playing the beginning of the loop,
+ * but due to playback latency, the "audible frame"
+ * is still at the end of the loop.
+ */
Location *location = _locations->auto_loop_location();
frameoffset_t lo = location->start() - ret;
if (lo > 0) {
ret = location->end () - lo;
+ if (latent_locate) {
+ *latent_locate = true;
+ }
}
}
msc->set_input_port (boost::dynamic_pointer_cast<MidiPort>(scene_input_port()));
msc->set_output_port (boost::dynamic_pointer_cast<MidiPort>(scene_output_port()));
- boost::function<framecnt_t(void)> timer_func (boost::bind (&Session::audible_frame, this));
+ boost::function<framecnt_t(void)> timer_func (boost::bind (&Session::audible_frame, this, (bool*)(0)));
boost::dynamic_pointer_cast<AsyncMIDIPort>(scene_input_port())->set_timer (timer_func);
setup_midi_machine_control ();