when loading a session into a running instance, if the SR doesn't match the engine, stop engine and show dialog
This commit is contained in:
parent
debcb22697
commit
ff7fe6d4d6
|
@ -212,6 +212,8 @@ public:
|
|||
void finish();
|
||||
|
||||
int load_session (const std::string& path, const std::string& snapshot, std::string mix_template = std::string());
|
||||
int load_session_stage_two (const std::string& path, const std::string& snapshot, std::string mix_template = std::string());
|
||||
void audio_midi_setup_reconfigure_done (int response, std::string path, std::string snapshot, std::string mix_template);
|
||||
bool session_load_in_progress;
|
||||
int build_session (const std::string& path, const std::string& snapshot, ARDOUR::BusProfile const *);
|
||||
bool session_is_new() const { return _session_is_new; }
|
||||
|
|
|
@ -337,21 +337,66 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
|
|||
}
|
||||
PBD::Unwinder<bool> lsu (session_load_in_progress, true);
|
||||
|
||||
Session *new_session;
|
||||
int unload_status;
|
||||
int retval = -1;
|
||||
bool had_session = false;
|
||||
|
||||
if (_session) {
|
||||
had_session = true;
|
||||
|
||||
unload_status = unload_session ();
|
||||
|
||||
if (unload_status < 0) {
|
||||
goto out;
|
||||
} else if (unload_status > 0) {
|
||||
retval = 0;
|
||||
goto out;
|
||||
if (unload_status != 0) {
|
||||
hide_splash ();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (had_session) {
|
||||
float sr;
|
||||
SampleFormat sf;
|
||||
string pv;
|
||||
|
||||
Session::get_info_from_path (Glib::build_filename (path, snap_name + statefile_suffix), sr, sf, pv);
|
||||
|
||||
/* this will stop the engine if the SR is different */
|
||||
|
||||
audio_midi_setup->set_desired_sample_rate (sr);
|
||||
|
||||
if (!AudioEngine::instance()->running()) {
|
||||
audio_midi_setup->set_position (WIN_POS_CENTER);
|
||||
audio_midi_setup->present ();
|
||||
audio_midi_setup->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::audio_midi_setup_reconfigure_done), path, snap_name, mix_template));
|
||||
/* not done yet, but we're avoiding modal dialogs */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return load_session_stage_two (path, snap_name, mix_template);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::audio_midi_setup_reconfigure_done (int response, std::string path, std::string snap_name, std::string mix_template)
|
||||
{
|
||||
switch (response) {
|
||||
case Gtk::RESPONSE_DELETE_EVENT:
|
||||
break;
|
||||
default:
|
||||
if (!AudioEngine::instance()->running()) {
|
||||
return; // keep dialog visible, maybe try again
|
||||
}
|
||||
}
|
||||
|
||||
audio_midi_setup->hide();
|
||||
|
||||
(void) load_session_stage_two (path, snap_name, mix_template);
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR_UI::load_session_stage_two (const std::string& path, const std::string& snap_name, std::string mix_template)
|
||||
{
|
||||
Session *new_session;
|
||||
int retval = -1;
|
||||
|
||||
BootMessage (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME));
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue
Block a user