Skip to content

Implement offline processing for CLAPs #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 0 additions & 4 deletions src/clap_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,6 @@ const void* Plugin::clapExtension(const clap_host* /*host*/, const char* extensi
{
return &HostExt::tail;
}
if (!strcmp(extension, CLAP_EXT_RENDER))
{
// TODO: implement CLAP_EXT_RENDER
}
if (!strcmp(extension, CLAP_EXT_STATE)) return &HostExt::state;
if (!strcmp(extension, CLAP_EXT_CONTEXT_MENU)) return &HostExt::context_menu;

Expand Down
27 changes: 27 additions & 0 deletions src/wrapasvst3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,33 @@ tresult PLUGIN_API ClapAsVst3::activateBus(Vst::MediaType type, Vst::BusDirectio
return super::activateBus(type, dir, index, state);
}

tresult PLUGIN_API ClapAsVst3::setIoMode(Vst::IoMode mode)
{
auto rext = _plugin->_ext._render;

if (rext)
{
auto mainthread = _plugin->AlwaysMainThread();

bool realtime_only = rext->has_hard_realtime_requirement(_plugin->_plugin);
switch (mode)
{
case Vst::kOfflineProcessing:
if (realtime_only) return kResultFalse;
return (rext->set(_plugin->_plugin, CLAP_RENDER_OFFLINE)) ? kResultOk : kResultFalse;
break;
case Vst::kSimple:
case Vst::kAdvanced:
// both does not make any difference
return (rext->set(_plugin->_plugin, CLAP_RENDER_REALTIME)) ? kResultOk : kResultFalse;
break;
default:
return kNotImplemented;
}
}
return super::setIoMode(mode);
}

//-----------------------------------------------------------------------------

tresult PLUGIN_API ClapAsVst3::setComponentHandler(Vst::IComponentHandler* handler)
Expand Down
2 changes: 2 additions & 0 deletions src/wrapasvst3.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ class ClapAsVst3 : public Steinberg::Vst::SingleComponentEffect,
tresult PLUGIN_API activateBus(Vst::MediaType type, Vst::BusDirection dir, int32 index,
TBool state) override;

tresult PLUGIN_API setIoMode(Vst::IoMode mode) override;

// from IEditController
tresult PLUGIN_API setComponentHandler(Vst::IComponentHandler* handler) override;

Expand Down
Loading