13
0

Fix endless loop when using "load session anyway"

Fixes a while-loop `break`, vs switch `break`.
This commit is contained in:
Robin Gareus 2022-08-08 16:26:16 +02:00
parent 902c36d019
commit 20c942bb48
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -1668,31 +1668,29 @@ Session::set_state (const XMLNode& node, int version)
while (!AudioEngine::instance()->running () || _base_sample_rate != AudioEngine::instance()->sample_rate ()) { while (!AudioEngine::instance()->running () || _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);
switch (r.value_or (0)) { int rv = r.value_or (0);
case 0: if (rv == 0 && AudioEngine::instance()->running ()) {
if (AudioEngine::instance()->running ()) { /* continue with rate mismatch */
/* continue with rate mismatch */ break;
break; } else if (rv == -1 && AudioEngine::instance()->running ()) {
} /* retry */
/* fallthrough */ set_block_size (_engine.samples_per_cycle());
case -1: /* retry */
if (AudioEngine::instance()->running ()) { continue;
set_block_size (_engine.samples_per_cycle()); } else {
set_sample_rate (_engine.sample_rate()); if (AudioEngine::instance()->running ()) {
/* retry */ error << _("Session: Load aborted due to sample-rate mismatch") << endmsg;
continue; } else {
} error << _("Session: Load aborted since engine if offline") << endmsg;
/* fallthrough */ }
default: ret = -2;
if (AudioEngine::instance()->running ()) { goto out;
error << _("Session: Load aborted due to sample-rate mismatch") << endmsg;
} else {
error << _("Session: Load aborted since engine if offline") << endmsg;
}
ret = -2;
goto out;
} }
} }
if (_base_sample_rate != _engine.sample_rate ()) {
set_sample_rate (_engine.sample_rate());
}
} }
/* need the tempo map setup ASAP */ /* need the tempo map setup ASAP */