Skip to content
Merged
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
33 changes: 24 additions & 9 deletions src/engine/clapprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,23 @@ class CLAPHost final : public CLAPBaseHost
break;
}
}
#if 0
// clap_host_params
virtual bool implementsParams() const noexcept { return false; }
virtual void paramsRescan(clap_param_rescan_flags flags) noexcept {}
virtual void paramsClear(clap_id paramId, clap_param_clear_flags flags) noexcept {}
virtual void paramsRequestFlush() noexcept {}

// clap_host_params
std::function<void()> onRescanParamValues;
bool implementsParams() const noexcept override { return true; }
void paramsRescan (clap_param_rescan_flags flags) noexcept override
{
if (flags & CLAP_PARAM_RESCAN_VALUES)
if (onRescanParamValues)
onRescanParamValues();
}

void paramsClear (clap_id paramId, clap_param_clear_flags flags) noexcept override
{
juce::ignoreUnused (paramId, flags);
}
void paramsRequestFlush() noexcept override {}
#if 0
// clap_host_posix_fd_support
virtual bool implementsPosixFdSupport() const noexcept { return false; }
virtual bool posixFdSupportRegisterFd(int fd, clap_posix_fd_flags_t flags) noexcept { return false; }
Expand Down Expand Up @@ -338,7 +348,7 @@ class CLAPHost final : public CLAPBaseHost
ProxyPtr _proxy;
const clap_plugin_t* _plugin { nullptr };
const clap_plugin_timer_support_t* _timer { nullptr };

void setPlugin (const clap_plugin_t* plugin)
{
if (plugin != nullptr)
Expand Down Expand Up @@ -837,8 +847,10 @@ class CLAPParameter : public Parameter
if (! _params->get_value (_plugin, _info.id, &value))
return;

value = _range.convertFrom0to1 (value);
if (value != _value.load())
std::cout << "sync=" << value << " min: " << _range.start << " max: " << _range.end << std::endl;

value = _range.convertTo0to1 (value);
if (! juce::exactlyEqual (value, (double) _value.load()))
{
_value.store (static_cast<float> (value));
sendValueChangedMessageToListeners (value);
Expand Down Expand Up @@ -1200,6 +1212,8 @@ class CLAPProcessor : public Processor
public:
~CLAPProcessor()
{
_host.onRescanParamValues = nullptr;

if (_plugin != nullptr)
{
_plugin->destroy (_plugin);
Expand Down Expand Up @@ -1543,6 +1557,7 @@ class CLAPProcessor : public Processor
{
_host.setPlugin (plugin);
_plugin = _host.clapPlugin();
_host.onRescanParamValues = [this]() { syncParams(); };
}
}

Expand Down
Loading