1
Fork 0

Add Model::removePlugin() function

This commit is contained in:
gvnnz 2023-06-12 23:13:50 +02:00
parent 37637ff544
commit 3d9d08b808
3 changed files with 6 additions and 5 deletions

View File

@ -418,16 +418,15 @@ ChannelShared& Model::addChannelShared(std::unique_ptr<ChannelShared> cs) { retu
/* -------------------------------------------------------------------------- */
void Model::removePlugin(const Plugin& p) { remove_(m_shared.plugins, p); }
template <typename T>
void Model::removeShared(const T& ref)
{
if constexpr (std::is_same_v<T, Plugin>)
remove_(m_shared.plugins, ref);
if constexpr (std::is_same_v<T, Wave>)
remove_(m_shared.waves, ref);
}
template void Model::removeShared<Plugin>(const Plugin& t);
template void Model::removeShared<Wave>(const Wave& t);
/* -------------------------------------------------------------------------- */

View File

@ -204,6 +204,8 @@ public:
template <typename T>
void removeShared(const T&);
void removePlugin(const Plugin&);
template <typename T>
void clearShared();

View File

@ -130,13 +130,13 @@ void PluginHost::swapPlugin(const m::Plugin& p1, const m::Plugin& p2, std::vecto
void PluginHost::freePlugin(const m::Plugin& plugin)
{
m_model.removeShared(plugin);
m_model.removePlugin(plugin);
}
void PluginHost::freePlugins(const std::vector<Plugin*>& plugins)
{
for (const Plugin* p : plugins)
m_model.removeShared(*p);
m_model.removePlugin(*p);
}
/* -------------------------------------------------------------------------- */