Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/detail/standalone/macos/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ - (void)timerCallback:(NSTimer *)instance
plugin->on_main_thread(plugin);
}

if (standaloneHost->restartRequested.exchange(false))
// an inactive plugin has nothing to restart
if (standaloneHost->restartRequested.exchange(false) && standaloneHost->isActive)
{
// manually set running to false to make clapProcess a no-op
// while the plugin is being reactivated. otherwise,
Expand Down
7 changes: 7 additions & 0 deletions src/detail/standalone/standalone_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,13 @@ bool StandaloneHost::activatePlugin(int32_t sr, int32_t minBlock, int32_t maxBlo
{
if (!clapPlugin) return false;

// no device has run yet, or none is attached
if (sr <= 0 || maxBlock < minBlock || minBlock < 1)
{
LOGINFO("[ERROR] Not activating with sampleRate={} blockBounds={} to {}", sr, minBlock, maxBlock);
return false;
}

deactivatePlugin();

LOGINFO("Activating plugin : sampleRate={} blockBounds={} to {}", sr, minBlock, maxBlock);
Expand Down
3 changes: 2 additions & 1 deletion src/detail/standalone/windows/windows_standalone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,8 @@ Plugin::Plugin(std::shared_ptr<Clap::Plugin> clapPlugin, int nCmdShow)
plugin.plugin->on_main_thread(plugin.plugin);
}

if (sah->restartRequested.exchange(false))
// an inactive plugin has nothing to restart
if (sah->restartRequested.exchange(false) && sah->isActive)
{
// Reactivate in place rather than bouncing the whole audio
// engine. activatePlugin parks the callback, reactivates, and
Expand Down
Loading