Distinguish error-messages.

The vast majority of errors reported by users as
  "Cannot configure audio/midi engine with session parameters"
have nothing to do with engine-parameters.
This commit is contained in:
Robin Gareus 2017-06-27 20:28:45 +02:00
parent 1dd4aab0b4
commit 1f5013b4a8
2 changed files with 32 additions and 7 deletions

View File

@ -412,9 +412,27 @@ Session::Session (AudioEngine &eng,
}
}
if (post_engine_init ()) {
int err = post_engine_init ();
if (err) {
destroy ();
throw SessionException (_("Cannot configure audio/midi engine with session parameters"));
switch (err) {
case -1:
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Failed to create background threads.")));
break;
case -2:
case -3:
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Invalid TempoMap in session-file.")));
break;
case -4:
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Invalid or corrupt session state.")));
break;
case -5:
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Port registration failed.")));
break;
default:
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Unexpected exception during session setup, possibly invalid audio/midi engine parameters. Please see stdout/stderr for details")));
break;
}
}
store_recent_sessions (_name, _path);

View File

@ -265,7 +265,15 @@ Session::post_engine_init ()
_tempo_map = new TempoMap (_current_frame_rate);
_tempo_map->PropertyChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
_tempo_map->MetricPositionChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
} catch (std::exception const & e) {
error << _("Unexpected exception during session setup: ") << e.what() << endmsg;
return -2;
} catch (...) {
error << _("Unknown exception during session setup") << endmsg;
return -3;
}
try {
/* MidiClock requires a tempo map */
delete midi_clock;
@ -288,7 +296,7 @@ Session::post_engine_init ()
if (state_tree) {
if (set_state (*state_tree->root(), Stateful::loading_state_version)) {
error << _("Could not set session state from XML") << endmsg;
return -1;
return -4;
}
} else {
// set_state() will call setup_raid_path(), but if it's a new session we need
@ -351,15 +359,14 @@ Session::post_engine_init ()
_locations->changed.connect_same_thread (*this, boost::bind (&Session::locations_changed, this));
} catch (AudioEngine::PortRegistrationFailure& err) {
/* handle this one in a different way than all others, so that its clear what happened */
error << err.what() << endmsg;
return -1;
return -5;
} catch (std::exception const & e) {
error << _("Unexpected exception during session setup: ") << e.what() << endmsg;
return -1;
return -6;
} catch (...) {
error << _("Unknown exception during session setup") << endmsg;
return -1;
return -7;
}
BootMessage (_("Reset Remote Controls"));