- for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
- if (!(*i)->hidden()) {
- if ((*i)->speed() != 1.0f || (*i)->speed() != -1.0f) {
- (*i)->seek ((nframes_t) (_transport_frame * (double) (*i)->speed()));
- }
- else {
- (*i)->seek (_transport_frame);
+ if (_requested_return_frame >= 0) {
+
+ /* explicit return request pre-queued in event list. overrides everything else */
+
+ cerr << "explicit auto-return to " << _requested_return_frame << endl;
+
+ _transport_frame = _requested_return_frame;
+ do_locate = true;
+
+ } else {
+ if (config.get_auto_return()) {
+
+ if (play_loop) {
+
+ /* don't try to handle loop play when synced to JACK */
+
+ if (!synced_to_jack()) {
+
+ Location *location = _locations->auto_loop_location();
+
+ if (location != 0) {
+ _transport_frame = location->start();
+ } else {
+ _transport_frame = _last_roll_location;
+ }
+ do_locate = true;
+ }
+
+ } else if (_play_range) {
+
+ /* return to start of range */
+
+ if (!current_audio_range.empty()) {
+ _transport_frame = current_audio_range.front().start;
+ do_locate = true;
+ }
+
+ } else {
+
+ /* regular auto-return */
+
+ _transport_frame = _last_roll_location;
+ do_locate = true;
+ }