Restore connections when using templates

This also fixes an issue when duplicating tracks. Saved
connections were ignored and tracks were auto-connected.
This commit is contained in:
Robin Gareus 2022-04-26 15:06:40 +02:00
parent 6f5d3d8dd9
commit 98bfede1fc
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 20 additions and 1 deletions

View File

@ -3113,7 +3113,7 @@ Session::new_route_from_template (uint32_t how_many, PresentationInfo::order_t i
out:
if (!ret.empty()) {
add_routes (ret, true, true, insert_at);
add_routes (ret, false, false, insert_at);
}
if (!ret.empty()) {
@ -3128,6 +3128,25 @@ Session::new_route_from_template (uint32_t how_many, PresentationInfo::order_t i
(*x)->remove_monitor_send ();
}
}
/* reconnect ports using information from state */
for (auto const& wio : (*x)->all_inputs ()) {
boost::shared_ptr<IO> io = wio.lock();
if (!io) {
continue;
}
for (auto const& p : io->ports()) {
p->reconnect ();
}
}
for (auto const& wio : (*x)->all_outputs ()) {
boost::shared_ptr<IO> io = wio.lock();
if (!io) {
continue;
}
for (auto const& p : io->ports()) {
p->reconnect ();
}
}
}
}