Skip to content

Commit e2c5ad7

Browse files
committed
Fix VST3 validator build and runtime issues
- Add platform-specific module loading sources from SDK (module_linux.cpp, etc.) - Fix VST3ValidatorRunner to use correct SDK APIs: - Use template createInstance<T>() method - Use FUnknownPtr for interface casting - Remove incompatible ITestResult implementation - Add sdk library to link dependencies - Fix argument parsing to not auto-insert --validate when using --vst3-validator-mode https://claude.ai/code/session_01AY9chvBEmsCVjNZSUkNcbw
1 parent 0d509f7 commit e2c5ad7

3 files changed

Lines changed: 34 additions & 58 deletions

File tree

CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,19 @@ if(PLUGINVAL_VST3_VALIDATOR)
126126
Source/vst3validator/VST3ValidatorRunner.h
127127
Source/vst3validator/VST3ValidatorRunner.cpp
128128
)
129+
130+
# Add platform-specific module loading sources from the SDK
131+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
132+
list(APPEND VST3ValidatorFiles
133+
${vst3sdk_SOURCE_DIR}/public.sdk/source/vst/hosting/module_linux.cpp)
134+
elseif(APPLE)
135+
list(APPEND VST3ValidatorFiles
136+
${vst3sdk_SOURCE_DIR}/public.sdk/source/vst/hosting/module_mac.mm)
137+
elseif(WIN32)
138+
list(APPEND VST3ValidatorFiles
139+
${vst3sdk_SOURCE_DIR}/public.sdk/source/vst/hosting/module_win32.cpp)
140+
endif()
141+
129142
target_sources(pluginval PRIVATE ${VST3ValidatorFiles})
130143
source_group("Source/vst3validator" FILES ${VST3ValidatorFiles})
131144

@@ -175,7 +188,8 @@ endif()
175188

176189
if (PLUGINVAL_VST3_VALIDATOR)
177190
target_link_libraries(pluginval PRIVATE
178-
sdk_hosting)
191+
sdk_hosting
192+
sdk)
179193
endif()
180194

181195
if (PLUGINVAL_ENABLE_RTCHECK)

Source/CommandLine.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,11 @@ static juce::ArgumentList createCommandLineArgs (juce::String commandLine)
502502
const bool hasValidateOrOtherCommand = argList.containsOption ("--validate")
503503
|| argList.containsOption ("--help|-h")
504504
|| argList.containsOption ("--version")
505-
|| argList.containsOption ("--run-tests");
505+
|| argList.containsOption ("--run-tests")
506+
#if PLUGINVAL_VST3_VALIDATOR
507+
|| argList.containsOption ("--vst3-validator-mode")
508+
#endif
509+
;
506510

507511
if (! hasValidateOrOtherCommand)
508512
if (isPluginArgument (argList.arguments.getLast().text))

Source/vst3validator/VST3ValidatorRunner.cpp

Lines changed: 14 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
#include <sstream>
1818
#include <iostream>
19+
#include <cstring>
1920

2021
// VST3 SDK includes
2122
#include "public.sdk/source/vst/hosting/module.h"
2223
#include "public.sdk/source/vst/hosting/hostclasses.h"
2324
#include "public.sdk/source/vst/hosting/plugprovider.h"
24-
#include "public.sdk/source/vst/testsuite/vsttestsuite.h"
2525
#include "pluginterfaces/vst/ivstaudioprocessor.h"
2626
#include "pluginterfaces/vst/ivsteditcontroller.h"
2727
#include "pluginterfaces/vst/ivsthostapplication.h"
@@ -41,10 +41,12 @@ class ValidatorHostApp : public IHostApplication
4141

4242
tresult PLUGIN_API getName (String128 name) override
4343
{
44-
return StringCopy (name, u"pluginval VST3 Validator");
44+
const char16_t hostName[] = u"pluginval VST3 Validator";
45+
std::memcpy (name, hostName, sizeof (hostName));
46+
return kResultOk;
4547
}
4648

47-
tresult PLUGIN_API createInstance (TUID cid, TUID iid, void** obj) override
49+
tresult PLUGIN_API createInstance (TUID /*cid*/, TUID /*_iid*/, void** obj) override
4850
{
4951
*obj = nullptr;
5052
return kResultFalse;
@@ -62,47 +64,6 @@ class ValidatorHostApp : public IHostApplication
6264
uint32 PLUGIN_API release () override { return 1; }
6365
};
6466

65-
//==============================================================================
66-
/** Test result handler that captures output. */
67-
class TestResultHandler : public ITestResult
68-
{
69-
public:
70-
TestResultHandler (std::ostream& os, bool verbose)
71-
: output (os), verboseOutput (verbose)
72-
{
73-
}
74-
75-
void PLUGIN_API addErrorMessage (const char8* msg) override
76-
{
77-
if (msg)
78-
{
79-
output << "ERROR: " << msg << "\n";
80-
hasErrors = true;
81-
}
82-
}
83-
84-
void PLUGIN_API addMessage (const char8* msg) override
85-
{
86-
if (msg && verboseOutput)
87-
output << msg << "\n";
88-
}
89-
90-
tresult PLUGIN_API queryInterface (const TUID, void** obj) override
91-
{
92-
*obj = nullptr;
93-
return kNoInterface;
94-
}
95-
96-
uint32 PLUGIN_API addRef () override { return 1; }
97-
uint32 PLUGIN_API release () override { return 1; }
98-
99-
bool hasErrors = false;
100-
101-
private:
102-
std::ostream& output;
103-
bool verboseOutput;
104-
};
105-
10667
//==============================================================================
10768
Result runValidator (const Options& options)
10869
{
@@ -153,9 +114,6 @@ Result runValidator (const Options& options)
153114
// Create host application
154115
ValidatorHostApp hostApp;
155116

156-
// Create test result handler
157-
TestResultHandler testResult (outputStream, options.verbose);
158-
159117
bool allTestsPassed = true;
160118
int numProcessorClasses = 0;
161119

@@ -172,9 +130,9 @@ Result runValidator (const Options& options)
172130
numProcessorClasses++;
173131
outputStream << " [Audio Processor]\n";
174132

175-
// Create the component
176-
IPtr<IComponent> component;
177-
if (factory.createInstance (classInfo.ID (), component) != kResultOk || ! component)
133+
// Create the component using the template method
134+
auto component = factory.createInstance<IComponent> (classInfo.ID ());
135+
if (! component)
178136
{
179137
outputStream << " ERROR: Failed to create component instance\n";
180138
allTestsPassed = false;
@@ -192,8 +150,8 @@ Result runValidator (const Options& options)
192150
outputStream << " Component created and initialized successfully\n";
193151

194152
// Get audio processor interface
195-
IPtr<IAudioProcessor> processor;
196-
if (component->queryInterface (IAudioProcessor::iid, (void**)&processor) != kResultOk || ! processor)
153+
FUnknownPtr<IAudioProcessor> processor (component);
154+
if (! processor)
197155
{
198156
outputStream << " WARNING: Component does not implement IAudioProcessor\n";
199157
}
@@ -206,8 +164,8 @@ Result runValidator (const Options& options)
206164
TUID controllerCID;
207165
if (component->getControllerClassId (controllerCID) == kResultOk)
208166
{
209-
IPtr<IEditController> controller;
210-
if (factory.createInstance (VST3::UID (controllerCID), controller) == kResultOk && controller)
167+
auto controller = factory.createInstance<IEditController> (VST3::UID (controllerCID));
168+
if (controller)
211169
{
212170
if (controller->initialize (&hostApp) == kResultOk)
213171
{
@@ -244,10 +202,10 @@ Result runValidator (const Options& options)
244202
outputStream << "----------------------------------------\n";
245203
outputStream << "Validation Summary:\n";
246204
outputStream << " Audio Processor classes found: " << numProcessorClasses << "\n";
247-
outputStream << " Result: " << (allTestsPassed && ! testResult.hasErrors ? "PASSED" : "FAILED") << "\n";
205+
outputStream << " Result: " << (allTestsPassed ? "PASSED" : "FAILED") << "\n";
248206

249207
result.output = outputStream.str ();
250-
result.success = allTestsPassed && ! testResult.hasErrors;
208+
result.success = allTestsPassed;
251209
result.exitCode = result.success ? 0 : 1;
252210

253211
return result;

0 commit comments

Comments
 (0)