void auto_loop_changed (Location *);
void auto_loop_declick_range (Location *, framepos_t &, framepos_t &);
- int ensure_engine (uint32_t desired_sample_rate);
+ int ensure_engine (uint32_t desired_sample_rate, bool);
void pre_engine_init (std::string path);
int post_engine_init ();
int immediately_post_engine ();
#ifdef USE_TRACKS_CODE_FEATURES
sr = EngineStateController::instance()->get_current_sample_rate();
#endif
- if (ensure_engine (sr)) {
+ if (ensure_engine (sr, true)) {
destroy ();
throw SessionException (_("Cannot connect to audio/midi engine"));
}
}
}
- if (ensure_engine (sr)) {
+ if (ensure_engine (sr, false)) {
destroy ();
throw SessionException (_("Cannot connect to audio/midi engine"));
}
}
int
-Session::ensure_engine (uint32_t desired_sample_rate)
+Session::ensure_engine (uint32_t desired_sample_rate, bool isnew)
{
if (_engine.current_backend() == 0) {
/* backend is unknown ... */
if (r.get_value_or (-1) != 0) {
return -1;
}
+ } else if (!isnew && _engine.running() && _engine.sample_rate () == desired_sample_rate) {
+ /* keep engine */
} else if (_engine.setup_required()) {
/* backend is known, but setup is needed */
boost::optional<int> r = AudioEngineSetupRequired (desired_sample_rate);
}
}
- /* at this point the engine should be running
- */
+ /* at this point the engine should be running */
if (!_engine.running()) {
return -1;