nframes_t ret;
nframes_t offset;
nframes_t tf;
+
+ if (_transport_speed == 0.0f) {
+ return last_stop_frame;
+ }
/* the first of these two possible settings for "offset"
mean that the audible frame is stationary until
tf = _transport_frame;
}
- if (_transport_speed == 0) {
- ret = tf;
- goto block_retrograde;
- }
-
- if (tf < offset) {
- ret = 0;
- goto block_retrograde;
- }
-
ret = tf;
if (!non_realtime_work_pending()) {
/* MOVING */
- /* take latency into account */
-
- if (_transport_speed > 0.0) {
- /* forwards */
- ret -= offset;
- } else {
- /* backwards */
- ret += offset;
- }
+ /* check to see if we have passed the first guaranteed
+ audible frame past our last stopping position. if not,
+ the return that last stopping point because in terms
+ of audible frames, we have not moved yet.
+ */
- }
+ if (_transport_speed > 0.0f) {
- /* do not allow retrograde motion near startup or a direction change
- caused by latency correction. we detect this by the asking if the present
- and previously-noted transport speed (and thus direction) are the same.
- */
+ if (!play_loop || !have_looped) {
+ if (tf < last_stop_frame + offset) {
+ return last_stop_frame;
+
+ }
+ }
+
- block_retrograde:
- if ((af_last_transport_speed >= 0.0) == (_transport_speed >= 0.0)) {
+ /* forwards */
+ ret -= offset;
- if (_transport_speed > 0.0) {
- if (ret < af_last_frame) {
- ret = af_last_frame;
- }
+ } else if (_transport_speed < 0.0f) {
- } else if (_transport_speed < 0.0) {
- if (ret > af_last_frame) {
- ret = af_last_frame;
+ /* XXX wot? no backward looping? */
+
+ if (tf > last_stop_frame - offset) {
+ return last_stop_frame;
+ } else {
+ /* backwards */
+ ret += offset;
}
- }
- }
-
- af_last_frame = ret;
- af_last_transport_speed = _transport_speed;
+ }
+ }
return ret;
}
g_atomic_int_set (&_record_status, Disabled);
loop_changing = false;
play_loop = false;
+ have_looped = false;
_last_roll_location = 0;
_last_record_location = 0;
pending_locate_frame = 0;
_smpte_offset = 0;
_smpte_offset_negative = true;
last_smpte_valid = false;
- af_last_transport_speed = 0.0;
- af_last_frame = 0.0;
sync_time_vars ();
_requested_return_frame = -1;
}
+ have_looped = false;
+
send_full_time_code ();
deliver_mmc (MIDI::MachineControl::cmdStop, 0);
deliver_mmc (MIDI::MachineControl::cmdLocate, _transport_frame);
}
}
}
-
+ have_looped = true;
TransportLooped(); // EMIT SIGNAL
}
}
Session::start_transport ()
{
_last_roll_location = _transport_frame;
+ have_looped = false;
/* if record status is Enabled, move it to Recording. if its
already Recording, move it to Disabled.