mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-12 09:36:33 +01:00
Prepare to allow engine reconfiguration when SR mismatches
Rather than fail to load the session or load with mismatching sample-rate, this will allow a user to reconfigure the engine and retry.
This commit is contained in:
parent
7ee4f116f2
commit
93e6f5a882
2 changed files with 35 additions and 7 deletions
|
|
@ -442,6 +442,9 @@ Session::Session (AudioEngine &eng,
|
||||||
case -5:
|
case -5:
|
||||||
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Port registration failed.")));
|
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Port registration failed.")));
|
||||||
break;
|
break;
|
||||||
|
case -6:
|
||||||
|
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Audio/MIDI Engine is not running or sample-rate mismatches.")));
|
||||||
|
break;
|
||||||
default:
|
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")));
|
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;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,14 @@ Session::post_engine_init ()
|
||||||
|
|
||||||
if (state_tree) {
|
if (state_tree) {
|
||||||
try {
|
try {
|
||||||
if (set_state (*state_tree->root(), Stateful::loading_state_version)) {
|
switch (set_state (*state_tree->root(), Stateful::loading_state_version)) {
|
||||||
|
case 0:
|
||||||
|
/* OK */
|
||||||
|
break;
|
||||||
|
case -2:
|
||||||
|
/* SR mismatch */
|
||||||
|
return -6;
|
||||||
|
default:
|
||||||
error << _("Could not set session state from XML") << endmsg;
|
error << _("Could not set session state from XML") << endmsg;
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
@ -1674,10 +1681,28 @@ Session::set_state (const XMLNode& node, int version)
|
||||||
|
|
||||||
_nominal_sample_rate = _base_sample_rate;
|
_nominal_sample_rate = _base_sample_rate;
|
||||||
|
|
||||||
assert (AudioEngine::instance()->running ());
|
while (!AudioEngine::instance()->running () || _base_sample_rate != AudioEngine::instance()->sample_rate ()) {
|
||||||
if (_base_sample_rate != AudioEngine::instance()->sample_rate ()) {
|
|
||||||
boost::optional<int> r = AskAboutSampleRateMismatch (_base_sample_rate, _current_sample_rate);
|
boost::optional<int> r = AskAboutSampleRateMismatch (_base_sample_rate, _current_sample_rate);
|
||||||
if (r.value_or (0)) {
|
switch (r.value_or (0)) {
|
||||||
|
case 0:
|
||||||
|
if (AudioEngine::instance()->running ()) {
|
||||||
|
/* continue with rate mismatch */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* fallthrough */
|
||||||
|
case -1:
|
||||||
|
if (AudioEngine::instance()->running ()) {
|
||||||
|
/* retry */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* fallthrough */
|
||||||
|
default:
|
||||||
|
if (AudioEngine::instance()->running ()) {
|
||||||
|
error << _("Session: Load aborted due to sample-rate mismatch") << endmsg;
|
||||||
|
} else {
|
||||||
|
error << _("Session: Load aborted since engine if offline") << endmsg;
|
||||||
|
}
|
||||||
|
ret = -2;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue