Initial release

This commit is contained in:
civ
2026-08-16 18:24:52 +07:00
commit 876886a39a
13244 changed files with 2353959 additions and 0 deletions
@@ -0,0 +1,73 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/editorclasses.cpp
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#include "public.sdk/source/vst/testsuite/general/editorclasses.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
// EditorClassesTest
//------------------------------------------------------------------------
EditorClassesTest::EditorClassesTest (ITestPlugProvider* plugProvider) : TestBase (plugProvider)
{
}
//------------------------------------------------------------------------
bool PLUGIN_API EditorClassesTest::run (ITestResult* testResult)
{
if (!testResult || !vstPlug)
return false;
printTestHeader (testResult);
// no controller is allowed...
if (FUnknownPtr<IEditController> (vstPlug).getInterface ())
{
addMessage (testResult, STR ("Processor and edit controller united."));
return true;
}
TUID controllerClassTUID;
if (vstPlug->getControllerClassId (controllerClassTUID) != kResultOk)
{
addMessage (testResult,
STR ("This component does not export an edit controller class ID!!!"));
return true;
}
FUID controllerClassUID;
controllerClassUID = FUID::fromTUID (controllerClassTUID);
if (controllerClassUID.isValid () == false)
{
addErrorMessage (testResult, STR ("The edit controller class has no valid UID!!!"));
return false;
}
addMessage (testResult, STR ("This component has an edit controller class"));
char8 cidString[50];
controllerClassUID.toRegistryString (cidString);
addMessage (testResult, printf (" Controller CID: %s", cidString));
return true;
}
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,43 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/editorclasses.h
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#pragma once
#include "public.sdk/source/vst/testsuite/testbase.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
/** Test Scan Editor Classes.
* \ingroup TestClass
*/
class EditorClassesTest : public TestBase
{
public:
EditorClassesTest (ITestPlugProvider* plugProvider);
DECLARE_VSTTEST ("Scan Editor Classes")
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
//------------------------------------------------------------------------
};
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,66 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/midilearn.cpp
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#include "public.sdk/source/vst/testsuite/general/midilearn.h"
#include "pluginterfaces/base/funknownimpl.h"
#include "pluginterfaces/vst/ivstmidicontrollers.h"
#include "pluginterfaces/vst/ivstmidilearn.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
// MidiLearnTest
//------------------------------------------------------------------------
MidiLearnTest::MidiLearnTest (ITestPlugProvider* plugProvider) : TestBase (plugProvider)
{
}
//------------------------------------------------------------------------
bool PLUGIN_API MidiLearnTest::run (ITestResult* testResult)
{
if (!testResult || !vstPlug)
return false;
printTestHeader (testResult);
if (!controller)
{
addMessage (testResult, STR ("No Edit Controller supplied!"));
return true;
}
auto midiLearn = U::cast<IMidiLearn> (controller);
if (!midiLearn)
{
addMessage (testResult, STR ("No MIDI Learn interface supplied!"));
return true;
}
if (midiLearn->onLiveMIDIControllerInput (0, 0, ControllerNumbers::kCtrlPan) != kResultTrue)
addMessage (testResult, STR ("onLiveMIDIControllerInput do not return kResultTrue!"));
if (midiLearn->onLiveMIDIControllerInput (0, 0, ControllerNumbers::kCtrlVibratoDelay) !=
kResultTrue)
addMessage (testResult, STR ("onLiveMIDIControllerInput do not return kResultTrue!"));
return true;
}
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,43 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/midilearn.h
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#pragma once
#include "public.sdk/source/vst/testsuite/testbase.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
/** Test MIDI Learn.
* \ingroup TestClass
*/
class MidiLearnTest : public TestBase
{
public:
MidiLearnTest (ITestPlugProvider* plugProvider);
DECLARE_VSTTEST ("MIDI Learn")
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
//------------------------------------------------------------------------
};
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,140 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/midimapping.cpp
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#include "public.sdk/source/vst/testsuite/general/midimapping.h"
#include "pluginterfaces/base/funknownimpl.h"
#include "pluginterfaces/vst/ivstmidicontrollers.h"
#include <unordered_set>
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
// MidiMappingTest
//------------------------------------------------------------------------
MidiMappingTest::MidiMappingTest (ITestPlugProvider* plugProvider) : TestBase (plugProvider)
{
}
//------------------------------------------------------------------------
bool PLUGIN_API MidiMappingTest::run (ITestResult* testResult)
{
if (!testResult || !vstPlug)
return false;
printTestHeader (testResult);
if (!controller)
{
addMessage (testResult, STR ("No Edit Controller supplied!"));
return true;
}
auto midiMapping = U::cast<IMidiMapping> (controller);
if (!midiMapping)
{
addMessage (testResult, STR ("No MIDI Mapping interface supplied!"));
return true;
}
int32 numParameters = controller->getParameterCount ();
int32 eventBusCount = vstPlug->getBusCount (kEvent, kInput);
bool interruptProcess = false;
std::unordered_set<ParamID> parameterIds;
for (int32 i = 0; i < numParameters; ++i)
{
ParameterInfo parameterInfo;
if (controller->getParameterInfo (i, parameterInfo) == kResultTrue)
parameterIds.insert (parameterInfo.id);
}
for (int32 bus = 0; bus < eventBusCount + 1; bus++)
{
if (interruptProcess)
break;
BusInfo info;
if (vstPlug->getBusInfo (kEvent, kInput, bus, info) == kResultTrue)
{
if (bus >= eventBusCount)
{
addMessage (testResult, STR ("getBusInfo supplied for an unknown event bus"));
break;
}
}
else
break;
for (int16 channel = 0; channel < info.channelCount; channel++)
{
if (interruptProcess)
break;
int32 foundCount = 0;
// test with the cc outside the valid range too (>=kCountCtrlNumber)
for (CtrlNumber cc = 0; cc < kCountCtrlNumber + 1; cc++)
{
ParamID tag;
if (midiMapping->getMidiControllerAssignment (bus, channel, cc, tag) == kResultTrue)
{
if (bus >= eventBusCount)
{
addMessage (testResult,
STR ("MIDI Mapping supplied for an unknown event bus"));
interruptProcess = true;
break;
}
if (cc >= kCountCtrlNumber)
{
addMessage (
testResult,
STR (
"MIDI Mapping supplied for a wrong ControllerNumbers value (bigger than the max)"));
break;
}
if (parameterIds.find (tag) == parameterIds.end ())
{
addErrorMessage (
testResult,
printf ("Unknown ParamID [%d] returned for MIDI Mapping", tag));
return false;
}
foundCount++;
}
else
{
if (bus >= eventBusCount)
interruptProcess = true;
}
}
if (foundCount == 0 && (bus < eventBusCount))
{
addMessage (
testResult,
printf (
"MIDI Mapping getMidiControllerAssignment (%d, %d) : no assignment available!",
bus, channel));
}
}
}
return true;
}
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,44 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/midimapping.h
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#pragma once
#include "public.sdk/source/vst/testsuite/testbase.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
/** Test MIDI Mapping.
* \ingroup TestClass
*/
class MidiMappingTest : public TestBase
{
public:
//------------------------------------------------------------------------
MidiMappingTest (ITestPlugProvider* plugProvider);
DECLARE_VSTTEST ("MIDI Mapping")
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
//------------------------------------------------------------------------
};
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,134 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/parameterfunctionname.cpp
// Created by : Steinberg, 04/2020
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#include "public.sdk/source/vst/testsuite/general/parameterfunctionname.h"
#include "public.sdk/source/vst/utility/stringconvert.h"
#include "pluginterfaces/base/funknownimpl.h"
#include "pluginterfaces/vst/ivstparameterfunctionname.h"
#include "pluginterfaces/vst/ivstunits.h"
#include <unordered_map>
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
// ParameterFunctionNameTest
//------------------------------------------------------------------------
ParameterFunctionNameTest::ParameterFunctionNameTest (ITestPlugProvider* plugProvider)
: TestBase (plugProvider)
{
}
//------------------------------------------------------------------------
bool PLUGIN_API ParameterFunctionNameTest::run (ITestResult* testResult)
{
if (!testResult || !vstPlug)
return false;
printTestHeader (testResult);
if (!controller)
{
addMessage (testResult, STR ("No Edit Controller supplied!"));
return true;
}
auto iParameterFunctionName = U::cast<IParameterFunctionName> (controller);
if (!iParameterFunctionName)
{
addMessage (testResult, STR ("No IParameterFunctionName support."));
return true;
}
addMessage (testResult, STR ("IParameterFunctionName supported."));
int32 numParameters = controller->getParameterCount ();
if (numParameters <= 0)
{
addMessage (testResult, STR ("This component does not export any parameters!"));
return true;
}
// used for ID check
std::unordered_map<int32, int32> paramIds;
for (int32 i = 0; i < numParameters; ++i)
{
ParameterInfo paramInfo = {};
tresult result = controller->getParameterInfo (i, paramInfo);
if (result != kResultOk)
{
addErrorMessage (testResult, printf ("Parameter %03d: is missing!!!", i));
return false;
}
int32 paramId = paramInfo.id;
if (paramId < 0)
{
addErrorMessage (testResult,
printf ("Parameter %03d (id=%d): Invalid Id!!!", i, paramId));
return false;
}
auto search = paramIds.find (paramId);
if (search != paramIds.end ())
{
addErrorMessage (testResult,
printf ("Parameter %03d (id=%d): ID already used by idx=%03d!!!", i,
paramId, search->second));
return false;
}
else
paramIds[paramId] = i;
} // end for each parameter
auto iUnitInfo2 = U::cast<IUnitInfo> (controller);
const CString arrayFunctionName[] = {FunctionNameType::kCompGainReduction,
FunctionNameType::kCompGainReductionMax,
FunctionNameType::kCompGainReductionPeakHold,
FunctionNameType::kCompResetGainReductionMax,
FunctionNameType::kLowLatencyMode,
FunctionNameType::kRandomize,
FunctionNameType::kDryWetMix};
ParamID paramID;
for (auto item : arrayFunctionName)
{
if (iParameterFunctionName->getParameterIDFromFunctionName (kRootUnitId, item, paramID) ==
kResultTrue)
{
addMessage (testResult,
printf ("FunctionName %s supported => paramID %d", item, paramID));
auto search = paramIds.find (paramID);
if (search == paramIds.end ())
{
addErrorMessage (
testResult,
printf ("Parameter (id=%d) for FunctionName %s: not Found!!!", paramID, item));
return false;
}
}
}
return true;
}
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,44 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/ParameterFunctionNameTest.h
// Created by : Steinberg, 04/2020
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#pragma once
#include "public.sdk/source/vst/testsuite/testbase.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
/** Test Parameter Function Name.
\ingroup TestClass */
//------------------------------------------------------------------------
class ParameterFunctionNameTest : public TestBase
{
public:
//------------------------------------------------------------------------
ParameterFunctionNameTest (ITestPlugProvider* plugProvider);
DECLARE_VSTTEST ("Parameter Function Name")
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
//------------------------------------------------------------------------
};
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,83 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/plugcompat.cpp
// Created by : Steinberg, 03/2022
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#include "public.sdk/source/vst/testsuite/general/plugcompat.h"
#include "public.sdk/source/vst/moduleinfo/moduleinfoparser.h"
#include "pluginterfaces/base/funknownimpl.h"
#include <string>
//------------------------------------------------------------------------
namespace Steinberg {
//------------------------------------------------------------------------
namespace {
//------------------------------------------------------------------------
struct StringStream : U::ImplementsNonDestroyable<U::Directly<IBStream>>
{
std::string str;
tresult PLUGIN_API read (void*, int32, int32*) override { return kNotImplemented; }
tresult PLUGIN_API write (void* buffer, int32 numBytes, int32* numBytesWritten) override
{
str.append (static_cast<char*> (buffer), numBytes);
if (numBytesWritten)
*numBytesWritten = numBytes;
return kResultTrue;
}
tresult PLUGIN_API seek (int64, int32, int64*) override { return kNotImplemented; }
tresult PLUGIN_API tell (int64*) override { return kNotImplemented; }
};
//------------------------------------------------------------------------
} // anonymous
//------------------------------------------------------------------------
bool checkPluginCompatibility (VST3::Hosting::Module::Ptr& module,
IPtr<IPluginCompatibility> compat, std::ostream* errorStream)
{
bool failure = false;
if (auto moduleInfoPath = VST3::Hosting::Module::getModuleInfoPath (module->getPath ()))
{
if (errorStream)
{
*errorStream
<< "Warning: The module contains a moduleinfo.json file and the module factory exports a IPluginCompatibility class. The moduleinfo.json one is preferred.\n";
}
}
StringStream strStream;
if (compat->getCompatibilityJSON (&strStream) != kResultTrue)
{
if (errorStream)
{
*errorStream
<< "Error: Call to IPluginCompatiblity::getCompatibilityJSON (IBStream*) failed\n";
}
failure = true;
}
else if (auto result = ModuleInfoLib::parseCompatibilityJson (strStream.str, errorStream))
{
// TODO: Check that the "New" classes are part of the Module;
}
else
{
failure = true;
}
return !failure;
}
//------------------------------------------------------------------------
} // Steinberg
@@ -0,0 +1,32 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/plugcompat.h
// Created by : Steinberg, 03/2022
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#pragma once
#include "public.sdk/source/vst/hosting/module.h"
#include "pluginterfaces/base/iplugincompatibility.h"
#include <iosfwd>
//------------------------------------------------------------------------
namespace Steinberg {
//------------------------------------------------------------------------
bool checkPluginCompatibility (VST3::Hosting::Module::Ptr& module,
IPtr<IPluginCompatibility> compat, std::ostream* errorStream);
//------------------------------------------------------------------------
} // Steinberg
@@ -0,0 +1,364 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/scanparameters.cpp
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#include "public.sdk/source/vst/testsuite/general/scanparameters.h"
#include "public.sdk/source/vst/utility/stringconvert.h"
#include "pluginterfaces/base/funknownimpl.h"
#include "pluginterfaces/vst/ivstunits.h"
#include <algorithm>
#include <map>
#include <unordered_map>
#include <vector>
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
// ScanParametersTest
//------------------------------------------------------------------------
ScanParametersTest::ScanParametersTest (ITestPlugProvider* plugProvider) : TestBase (plugProvider)
{
}
//------------------------------------------------------------------------
bool PLUGIN_API ScanParametersTest::run (ITestResult* testResult)
{
if (!testResult || !vstPlug)
return false;
printTestHeader (testResult);
if (!controller)
{
addMessage (testResult, STR ("No Edit Controller supplied!"));
return true;
}
int32 numParameters = controller->getParameterCount ();
if (numParameters <= 0)
{
addMessage (testResult, STR ("This component does not export any parameters!"));
return true;
}
addMessage (testResult, printf ("This component exports %d parameter(s)", numParameters));
auto iUnitInfo2 = U::cast<IUnitInfo> (controller);
if (!iUnitInfo2 && numParameters > 20)
{
addMessage (
testResult,
STR ("Note: it could be better to use UnitInfo in order to sort Parameters (>20)."));
}
struct SUnitCount
{
int32 idx {-1};
int32 numParams {0};
std::string name;
};
std::unordered_map<int32, SUnitCount> unitIds;
// root unit
unitIds[kRootUnitId].name = "Root";
if (iUnitInfo2)
{
for (int32 ui = 0, uc = iUnitInfo2->getUnitCount (); ui < uc; ++ui)
{
UnitInfo uinfo = {};
if (iUnitInfo2->getUnitInfo (ui, uinfo) == kResultTrue)
{
// check if ID is already used by another unit
if (uinfo.id != kRootUnitId)
{
auto search = unitIds.find (uinfo.id);
if (search != unitIds.end ())
{
addErrorMessage (
testResult,
printf ("=>Unit %03d (id=%d): ID already used by idx=%03d!!!", ui,
uinfo.id, search->second.idx));
return false;
}
}
std::string unitTitle;
unitTitle = StringConvert::convert (uinfo.name);
unitIds[uinfo.id] = {ui, 0, unitTitle}; // init counter
}
else
{
addErrorMessage (testResult, printf ("IUnitInfo::getUnitInfo (%d..) failed.", ui));
return false;
}
}
}
// used for ID check
std::unordered_map<int32, int32> paramIds;
std::map<int32, std::vector<std::string>> listTitleUnitMap;
bool foundBypass = false;
for (int32 i = 0; i < numParameters; ++i)
{
ParameterInfo paramInfo = {};
tresult result = controller->getParameterInfo (i, paramInfo);
if (result != kResultOk)
{
addErrorMessage (testResult, printf ("=>Parameter %03d: is missing!!!", i));
return false;
}
int32 paramId = paramInfo.id;
if (paramId < 0)
{
addErrorMessage (testResult,
printf ("=>Parameter %03d (id=%d): Invalid Id!!!", i, paramId));
return false;
}
// check if ID is already used by another parameter
auto search = paramIds.find (paramId);
if (search != paramIds.end ())
{
addErrorMessage (testResult,
printf ("=>Parameter %03d (id=%d): ID already used by idx=%03d!!!", i,
paramId, search->second));
return false;
}
paramIds[paramId] = i;
const char8* paramType = kEmptyString8;
if (paramInfo.stepCount < 0)
{
addErrorMessage (
testResult,
printf ("=>Parameter %03d (id=%d): invalid stepcount (<0)!!!", i, paramId));
return false;
}
if (paramInfo.stepCount == 0)
paramType = "Float";
else if (paramInfo.stepCount == 1)
paramType = "Toggle";
else
paramType = "Discrete";
auto paramTitle = StringConvert::convert (paramInfo.title);
auto paramUnits = StringConvert::convert (paramInfo.units);
addMessage (
testResult,
printf (
R"( Parameter %03d (id=%d): [title="%s"] [unit="%s"] [type = %s, default = %lf, unit = %d])",
i, paramId, paramTitle.data (), paramUnits.data (), paramType,
paramInfo.defaultNormalizedValue, paramInfo.unitId));
if (paramTitle.empty ())
{
addErrorMessage (testResult,
printf ("=>Parameter %03d (id=%d): has no title!!!", i, paramId));
return false;
}
// check if the same title is present in the same unit
auto it = listTitleUnitMap.find (paramInfo.unitId);
if (it != listTitleUnitMap.end ())
{
const std::vector<std::string>& list = it->second;
auto found = std::find (list.begin (), list.end (), paramTitle);
if (found != list.end ())
{
addMessage (
testResult,
printf (
"=>Parameter %03d (id=%d): [title=\"%s\"] has the same title as another parameter in this unit = %d!",
i, paramId, paramTitle.c_str (), paramInfo.unitId));
}
}
listTitleUnitMap[paramInfo.unitId].push_back (paramTitle);
if (paramInfo.defaultNormalizedValue != -1.f &&
(paramInfo.defaultNormalizedValue < 0. || paramInfo.defaultNormalizedValue > 1.))
{
addErrorMessage (
testResult,
printf (
"=>Parameter %03d (id=%d): paramInfo.defaultNormalizedValue is not normalized!!!",
i, paramId));
return false;
}
int32 unitId = paramInfo.unitId;
if (unitId < -1)
{
addErrorMessage (
testResult,
printf ("=>Parameter %03d (id=%d): No appropriate unit ID!!!", i, paramId));
return false;
}
if (unitId >= -1)
{
auto iUnitInfo = U::cast<IUnitInfo> (controller);
if (!iUnitInfo && unitId != kRootUnitId)
{
addErrorMessage (
testResult,
printf (
"IUnitInfo interface is missing, but ParameterInfo::unitID is not %03d (kRootUnitId).",
kRootUnitId));
return false;
}
auto searchUnit = unitIds.find (unitId);
if (searchUnit != unitIds.end ())
{
unitIds[unitId].numParams++;
}
else if (unitId != kRootUnitId)
{
addErrorMessage (
testResult,
printf (
"=>Parameter %03d (id=%d) has a UnitID (%d), which isn't defined in IUnitInfo.",
i, paramId, unitId));
return false;
}
else // if (unitId == kRootUnitId)
unitIds[kRootUnitId].numParams++;
}
//---check for incompatible flags---------------------
// kCanAutomate and kIsReadOnly
if (((paramInfo.flags & ParameterInfo::kCanAutomate) != 0) &&
((paramInfo.flags & ParameterInfo::kIsReadOnly) != 0))
{
addErrorMessage (
testResult,
printf (
"=>Parameter %03d (id=%d) must not be kCanAutomate and kReadOnly at the same time.",
i, paramId));
return false;
}
// kIsProgramChange and kIsReadOnly
if (((paramInfo.flags & ParameterInfo::kIsProgramChange) != 0) &&
((paramInfo.flags & ParameterInfo::kIsReadOnly) != 0))
{
addErrorMessage (
testResult,
printf (
"=>Parameter %03d (id=%d) must not be kIsProgramChange and kReadOnly at the same time.",
i, paramId));
return false;
}
// kIsBypass only or kIsBypass and kCanAutomate only
if (((paramInfo.flags & ParameterInfo::kIsBypass) != 0) &&
!((paramInfo.flags == ParameterInfo::kIsBypass) ||
((paramInfo.flags & ParameterInfo::kCanAutomate) != 0)))
{
addErrorMessage (
testResult,
printf (
"=>Parameter %03d (id=%d) is kIsBypass and could have only kCanAutomate as other flag at the same time.",
i, paramId));
return false;
}
//---maybe wrong combination of flags-------------------
// kIsBypass but not kCanAutomate
if (paramInfo.flags == ParameterInfo::kIsBypass)
{
addMessage (testResult,
printf ("=>Parameter %03d (id=%d) is kIsBypass, but not kCanAutomate!", i,
paramId));
}
// kIsHidden and (kCanAutomate or not kIsReadOnly)
if (paramInfo.flags == ParameterInfo::kIsHidden)
{
if ((paramInfo.flags & ParameterInfo::kCanAutomate) != 0)
{
addMessage (
testResult,
printf ("=>Parameter %03d (id=%d) is kIsHidden and kCanAutomate!", i, paramId));
}
if ((paramInfo.flags & ParameterInfo::kIsReadOnly) == 0)
{
addMessage (testResult,
printf ("=>Parameter %03d (id=%d) is kIsHidden and NOT kIsReadOnly!", i,
paramId));
}
}
// kIsProgramChange and not kIsList
if (((paramInfo.flags & ParameterInfo::kIsProgramChange) != 0) &&
((paramInfo.flags & ParameterInfo::kIsList) == 0))
{
addMessage (testResult,
printf ("=>Parameter %03d (id=%d) is kIsProgramChange, but not a kIsList!",
i, paramId));
}
// kIsReadOnly and kIsWrapAround
if (((paramInfo.flags & ParameterInfo::kIsReadOnly) != 0) &&
((paramInfo.flags & ParameterInfo::kIsWrapAround) != 0))
{
addMessage (
testResult,
printf ("=>Parameter %03d (id=%d) is kIsReadOnly, no need to be kIsWrapAround too!",
i, paramId));
}
//---check bypass--------------------------------------
if ((paramInfo.flags & ParameterInfo::kIsBypass) != 0)
{
if (!foundBypass)
foundBypass = true;
else
{
addErrorMessage (
testResult,
printf ("=>Parameter %03d (id=%d): There can only be one bypass (kIsBypass).",
i, paramId));
return false;
}
}
} // end for each parameter
for (const auto& unit : unitIds)
{
if (unit.second.numParams > 128) // 128 due to MIDI CC mapped parameter
{
addMessage (
testResult,
printf (
"Note: This Unit (idx=%d, id=%d, name=\"%s\") has %d parameters: it could be better to split it in sub-units!.",
unit.second.idx, unit.first, unit.second.name.data (), unit.second.numParams));
}
}
if (foundBypass == false)
{
StringResult subCat;
plugProvider->getSubCategories (subCat);
if (subCat.get ().find ("Instrument") != std::string::npos)
addMessage (testResult, STR ("No bypass parameter found. This is an instrument."));
else
addMessage (testResult, STR ("Warning: No bypass parameter found. Is this intended ?"));
}
return true;
}
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,44 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/scanparameters.h
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#pragma once
#include "public.sdk/source/vst/testsuite/testbase.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
/** Test Scan Parameters.
* \ingroup TestClass
*/
class ScanParametersTest : public TestBase
{
public:
//------------------------------------------------------------------------
ScanParametersTest (ITestPlugProvider* plugProvider);
DECLARE_VSTTEST ("Scan Parameters")
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
//------------------------------------------------------------------------
};
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,74 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/suspendresume.cpp
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#include "public.sdk/source/vst/testsuite/general/suspendresume.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
// SuspendResumeTest
//------------------------------------------------------------------------
SuspendResumeTest::SuspendResumeTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl)
: TestEnh (plugProvider, sampl)
{
}
//------------------------------------------------------------------------
bool PLUGIN_API SuspendResumeTest::run (ITestResult* testResult)
{
if (!testResult || !vstPlug)
return false;
printTestHeader (testResult);
for (int32 i = 0; i < 3; ++i)
{
if (audioEffect)
{
if (audioEffect->canProcessSampleSize (kSample32) == kResultOk)
processSetup.symbolicSampleSize = kSample32;
else if (audioEffect->canProcessSampleSize (kSample64) == kResultOk)
processSetup.symbolicSampleSize = kSample64;
else
{
addErrorMessage (testResult,
STR ("No appropriate symbolic sample size supported!"));
return false;
}
if (audioEffect->setupProcessing (processSetup) != kResultOk)
{
addErrorMessage (testResult, STR ("Process setup failed!"));
return false;
}
}
tresult result = vstPlug->setActive (true);
if (result != kResultOk)
return false;
result = vstPlug->setActive (false);
if (result != kResultOk)
return false;
}
return true;
}
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,44 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/suspendresume.h
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#pragma once
#include "public.sdk/source/vst/testsuite/testbase.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
/** Test Suspend/Resume.
* \ingroup TestClass
*/
class SuspendResumeTest : public TestEnh
{
public:
//------------------------------------------------------------------------
SuspendResumeTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
DECLARE_VSTTEST ("Suspend/Resume")
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
//------------------------------------------------------------------------
};
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,63 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/terminit.cpp
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#include "public.sdk/source/vst/testsuite/general/terminit.h"
#include "pluginterfaces/base/funknownimpl.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
// TerminateInitializeTest
//------------------------------------------------------------------------
TerminateInitializeTest::TerminateInitializeTest (ITestPlugProvider* plugProvider)
: TestBase (plugProvider)
{
}
//------------------------------------------------------------------------
bool TerminateInitializeTest::run (ITestResult* testResult)
{
if (!testResult || !vstPlug)
return false;
printTestHeader (testResult);
auto plugBase = U::cast<IPluginBase> (vstPlug);
if (!plugBase)
{
addErrorMessage (testResult, STR ("No IPluginBase interface available."));
return false;
}
bool result = true;
if (plugBase->terminate () != kResultTrue)
{
addErrorMessage (testResult, STR ("IPluginBase::terminate () failed."));
result = false;
}
if (plugBase->initialize (TestingPluginContext::get ()) != kResultTrue)
{
addErrorMessage (testResult, STR ("IPluginBase::initialize (..) failed."));
result = false;
}
return result;
}
//------------------------------------------------------------------------
} // Vst
} // Steinberg
@@ -0,0 +1,44 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/general/terminit.h
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#pragma once
#include "public.sdk/source/vst/testsuite/testbase.h"
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
/** Test Terminate/Initialize.
* \ingroup TestClass
*/
class TerminateInitializeTest : public TestBase
{
public:
//------------------------------------------------------------------------
TerminateInitializeTest (ITestPlugProvider* plugProvider);
DECLARE_VSTTEST ("Terminate/Initialize")
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
//------------------------------------------------------------------------
};
//------------------------------------------------------------------------
} // Vst
} // Steinberg