Skip to content

Commit

Permalink
version 0.7.2 (#232)
Browse files Browse the repository at this point in the history
* bumping version to 0.7.2

* restartPlugin does not lead to kReloadComponent anymore, ensure flush() being called from main_thread, more documentation on vst3 specific extensions
  • Loading branch information
defiantnerd committed Mar 10, 2024
1 parent 5e66464 commit 900f847
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ option(CLAP_WRAPPER_WINDOWS_SINGLE_FILE "Build a single fine (rather than folder

project(clap-wrapper
LANGUAGES C CXX
VERSION 0.7.1
VERSION 0.7.2
DESCRIPTION "CLAP-as-X wrappers"
)
set(CLAP_WRAPPER_VERSION "${CMAKE_PROJECT_VERSION}" CACHE STRING "Version of the wrapper project")
Expand Down
11 changes: 7 additions & 4 deletions include/clapwrapper/vst3.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
#endif

// the factory extension
static const CLAP_CONSTEXPR char CLAP_PLUGIN_FACTORY_INFO_VST3[] =
"clap.plugin-factory-info-as-vst3.draft0";
static const CLAP_CONSTEXPR char CLAP_PLUGIN_FACTORY_INFO_VST3[] = "clap.plugin-factory-info-as-vst3/0";

// the plugin extension
static const CLAP_CONSTEXPR char CLAP_PLUGIN_AS_VST3[] = "clap.plugin-info-as-vst3.draft0";
static const CLAP_CONSTEXPR char CLAP_PLUGIN_AS_VST3[] = "clap.plugin-info-as-vst3/0";

typedef uint8_t array_of_16_bytes[16];

Expand Down Expand Up @@ -77,6 +76,8 @@ typedef uint8_t array_of_16_bytes[16];
all members are optional when set to nullptr
if not provided, the wrapper code will use/generate appropriate values
this struct is being returned by the plugin in clap_plugin_factory_as_vst3_t::get_vst3_info()
*/

typedef struct clap_plugin_info_as_vst3
Expand All @@ -92,7 +93,7 @@ typedef struct clap_plugin_info_as_vst3
all members are optional and can be set to nullptr
if not provided, the wrapper code will use/generate appropriate values
retrieved when asking for factory CLAP_PLUGIN_FACTORY_INFO_VST3
retrieved when asking for factory CLAP_PLUGIN_FACTORY_INFO_VST3 by clap_entry::get_factory()
*/

typedef struct clap_plugin_factory_as_vst3
Expand Down Expand Up @@ -125,6 +126,8 @@ enum clap_supported_note_expressions
/*
retrieve additional information for the plugin itself, if note expressions are being supported and if there
is a limit in MIDI channels (to reduce the offered controllers etc. in the VST3 host)
This extension is optionally returned by the plugin when asked for extension CLAP_PLUGIN_AS_VST3
*/
typedef struct clap_plugin_as_vst3
{
Expand Down
5 changes: 0 additions & 5 deletions src/detail/vst3/parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ class Vst3Parameter : public Steinberg::Vst::Parameter

inline double asClapValue(double vst3value) const
{
auto& info = this->getInfo();
if (info.stepCount > 0)
{
return (vst3value * float(info.stepCount)) + min_value;
}
return (vst3value * (max_value - min_value)) + min_value;
}
inline double asVst3Value(double clapvalue) const
Expand Down
14 changes: 12 additions & 2 deletions src/wrapasvst3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ tresult PLUGIN_API ClapAsVst3::setActive(TBool state)

tresult PLUGIN_API ClapAsVst3::process(Vst::ProcessData& data)
{
if (!_active || !_processing)
{
return kNotInitialized;
}
auto thisFn = _plugin->AlwaysAudioThread();

this->_processAdapter->process(data);
return kResultOk;
}
Expand All @@ -132,7 +137,7 @@ tresult PLUGIN_API ClapAsVst3::getState(IBStream* state)

uint32 PLUGIN_API ClapAsVst3::getLatencySamples()
{
if (_plugin->_ext._latency)
if (_plugin->_ext._latency && _active)
{
return _plugin->_ext._latency->get(_plugin->_plugin);
}
Expand Down Expand Up @@ -830,7 +835,9 @@ void ClapAsVst3::request_callback()

void ClapAsVst3::restartPlugin()
{
if (componentHandler) componentHandler->restartComponent(Vst::RestartFlags::kReloadComponent);
if (componentHandler)
componentHandler->restartComponent(Vst::RestartFlags::kIoChanged |
Vst::RestartFlags::kLatencyChanged);
}

void ClapAsVst3::onBeginEdit(clap_id id)
Expand Down Expand Up @@ -949,6 +956,9 @@ void ClapAsVst3::onIdle()
Clap::ProcessAdapter pa;
pa.setupProcessing(_plugin->_plugin, _plugin->_ext._params, audioInputs, audioOutputs, 0, 0, 0,
this->parameters, componentHandler, nullptr, false, false);

auto thisFn = _plugin->AlwaysMainThread(); // just to pacify the clap-helper

pa.flush();
}
}
Expand Down

0 comments on commit 900f847

Please sign in to comment.