13
0

* further reduce the spaghettiness of Session::follow_slave

git-svn-id: svn://localhost/ardour2/branches/3.0@4386 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Hans Baier 2009-01-05 09:22:27 +00:00
parent 5f5a570e50
commit 598b412e6b
2 changed files with 46 additions and 39 deletions

View File

@ -1084,6 +1084,7 @@ class Session : public PBD::StatefulDestructible
nframes_t slave_transport_frame, nframes_t slave_transport_frame,
nframes_t this_delta, nframes_t this_delta,
bool starting); bool starting);
void follow_slave_silently(nframes_t nframes, nframes_t offset, float slave_speed);
void set_slave_source (SlaveSource); void set_slave_source (SlaveSource);

View File

@ -583,44 +583,7 @@ Session::follow_slave (nframes_t nframes, nframes_t offset)
cerr << "reached silent_motion:" <<endl; cerr << "reached silent_motion:" <<endl;
#endif #endif
if (slave_speed && _transport_speed) { follow_slave_silently(nframes, offset, slave_speed);
/* something isn't right, but we should move with the master
for now.
*/
bool need_butler;
prepare_diskstreams ();
silent_process_routes (nframes, offset);
commit_diskstreams (nframes, need_butler);
if (need_butler) {
summon_butler ();
}
int32_t frames_moved = (int32_t) floor (_transport_speed * nframes);
if (frames_moved < 0) {
decrement_transport_position (-frames_moved);
} else {
increment_transport_position (frames_moved);
}
nframes_t stop_limit;
if (actively_recording()) {
stop_limit = max_frames;
} else {
if (Config->get_stop_at_session_end()) {
stop_limit = current_end_frame();
} else {
stop_limit = max_frames;
}
}
maybe_stop (stop_limit);
}
noroll: noroll:
/* don't move at all */ /* don't move at all */
@ -779,6 +742,49 @@ Session::track_slave_state(
} }
} }
void
Session::follow_slave_silently(nframes_t nframes, nframes_t offset, float slave_speed)
{
if (slave_speed && _transport_speed) {
/* something isn't right, but we should move with the master
for now.
*/
bool need_butler;
prepare_diskstreams ();
silent_process_routes (nframes, offset);
commit_diskstreams (nframes, need_butler);
if (need_butler) {
summon_butler ();
}
int32_t frames_moved = (int32_t) floor (_transport_speed * nframes);
if (frames_moved < 0) {
decrement_transport_position (-frames_moved);
} else {
increment_transport_position (frames_moved);
}
nframes_t stop_limit;
if (actively_recording()) {
stop_limit = max_frames;
} else {
if (Config->get_stop_at_session_end()) {
stop_limit = current_end_frame();
} else {
stop_limit = max_frames;
}
}
maybe_stop (stop_limit);
}
}
void void
Session::process_without_events (nframes_t nframes) Session::process_without_events (nframes_t nframes)
{ {