Initial release
This commit is contained in:
+326
@@ -0,0 +1,326 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/automation.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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "public.sdk/source/vst/testsuite/processing/automation.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// AutomationTest
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
AutomationTest::AutomationTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl,
|
||||
int32 everyNSamples, int32 numParams, bool sampleAccuracy)
|
||||
: ProcessTest (plugProvider, sampl)
|
||||
, bypassId (kNoParamId)
|
||||
, countParamChanges (0)
|
||||
, everyNSamples (everyNSamples)
|
||||
, numParams (numParams)
|
||||
, sampleAccuracy (sampleAccuracy)
|
||||
, onceExecuted (false)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
AutomationTest::~AutomationTest ()
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API AutomationTest::queryInterface (const TUID _iid, void** obj)
|
||||
{
|
||||
QUERY_INTERFACE (_iid, obj, FUnknown::iid, IParameterChanges);
|
||||
QUERY_INTERFACE (_iid, obj, Vst::IParameterChanges::iid, IParameterChanges);
|
||||
return ProcessTest::queryInterface (_iid, obj);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
const char* AutomationTest::getName () const
|
||||
{
|
||||
static std::string text;
|
||||
const char* accTxt = "Sample";
|
||||
if (!sampleAccuracy)
|
||||
accTxt = "Block";
|
||||
text = "Accuracy: ";
|
||||
text += accTxt;
|
||||
if (numParams < 1)
|
||||
text += ", All Parameters";
|
||||
else
|
||||
{
|
||||
text += ", ";
|
||||
text += std::to_string (numParams);
|
||||
text += " Parameters";
|
||||
}
|
||||
text += ", Change every";
|
||||
text += std::to_string (everyNSamples);
|
||||
text += " Samples";
|
||||
return text.data ();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool AutomationTest::setup ()
|
||||
{
|
||||
onceExecuted = false;
|
||||
if (!ProcessTest::setup ())
|
||||
return false;
|
||||
|
||||
if (!controller)
|
||||
return false;
|
||||
if ((numParams < 1) || (numParams > controller->getParameterCount ()))
|
||||
numParams = controller->getParameterCount ();
|
||||
if (audioEffect && (numParams > 0))
|
||||
{
|
||||
ParameterInfo inf = {};
|
||||
for (int32 i = 0; i < numParams; ++i)
|
||||
{
|
||||
paramChanges.push_back (owned (new ParamChanges));
|
||||
tresult r = controller->getParameterInfo (i, inf);
|
||||
if (r != kResultTrue)
|
||||
return false;
|
||||
if ((inf.flags & inf.kCanAutomate) != 0)
|
||||
paramChanges[i]->init (inf.id, processSetup.maxSamplesPerBlock);
|
||||
}
|
||||
|
||||
for (int32 i = 0; i < controller->getParameterCount (); ++i)
|
||||
{
|
||||
tresult r = controller->getParameterInfo (i, inf);
|
||||
if (r != kResultTrue)
|
||||
return false;
|
||||
if ((inf.flags & inf.kIsBypass) != 0)
|
||||
{
|
||||
bypassId = inf.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return numParams == 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool AutomationTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult)
|
||||
return false;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
if (numParams == 0)
|
||||
addMessage (testResult, STR ("No Parameters present."));
|
||||
bool ret = ProcessTest::run (testResult);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool AutomationTest::teardown ()
|
||||
{
|
||||
paramChanges.clear ();
|
||||
return ProcessTest::teardown ();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool AutomationTest::preProcess (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult)
|
||||
return false;
|
||||
if (paramChanges.empty ())
|
||||
return numParams == 0;
|
||||
bool check = true;
|
||||
for (int32 i = 0; i < numParams; ++i)
|
||||
{
|
||||
paramChanges[i]->resetPoints ();
|
||||
int32 point = 0;
|
||||
for (int32 pos = 0; pos < processData.numSamples; pos++)
|
||||
{
|
||||
bool add = (rand () % everyNSamples) == 0;
|
||||
if (!onceExecuted)
|
||||
{
|
||||
if (pos == 0)
|
||||
{
|
||||
add = true;
|
||||
if (!sampleAccuracy)
|
||||
onceExecuted = true;
|
||||
}
|
||||
else if ((pos == 1) && sampleAccuracy)
|
||||
{
|
||||
add = true;
|
||||
onceExecuted = true;
|
||||
}
|
||||
}
|
||||
if (add)
|
||||
check &= paramChanges[i]->setPoint (point++, pos,
|
||||
((float)(rand () % 1000000000)) / 1000000000.0);
|
||||
}
|
||||
if (check)
|
||||
processData.inputParameterChanges = this;
|
||||
}
|
||||
return check;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool AutomationTest::postProcess (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult)
|
||||
return false;
|
||||
if (paramChanges.empty ())
|
||||
return numParams == 0;
|
||||
|
||||
for (int32 i = 0; i < numParams; ++i)
|
||||
{
|
||||
if ((paramChanges[i]->getPointCount () > 0) &&
|
||||
!paramChanges[i]->havePointsBeenRead (!sampleAccuracy))
|
||||
{
|
||||
if (sampleAccuracy)
|
||||
addMessage (testResult,
|
||||
STR (" Not all points have been read via IParameterChanges"));
|
||||
else
|
||||
addMessage (testResult,
|
||||
STR (" No point at all has been read via IParameterChanges"));
|
||||
|
||||
return true; // should not be a problem
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
int32 AutomationTest::getParameterCount ()
|
||||
{
|
||||
if (paramChanges.empty ())
|
||||
return numParams;
|
||||
return static_cast<int32> (paramChanges.size ());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
IParamValueQueue* AutomationTest::getParameterData (int32 index)
|
||||
{
|
||||
if ((index >= 0) && (index < getParameterCount ()))
|
||||
return paramChanges[index];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
IParamValueQueue* AutomationTest::addParameterData (const ParamID& /*id*/, int32& /*index*/)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FlushParamTest
|
||||
//------------------------------------------------------------------------
|
||||
FlushParamTest::FlushParamTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl)
|
||||
: AutomationTest (plugProvider, sampl, 100, 1, false)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
void FlushParamTest::prepareProcessData ()
|
||||
{
|
||||
processData.numSamples = 0;
|
||||
processData.numInputs = 0;
|
||||
processData.numOutputs = 0;
|
||||
processData.inputs = nullptr;
|
||||
processData.outputs = nullptr;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API FlushParamTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!vstPlug || !testResult || !audioEffect)
|
||||
return false;
|
||||
|
||||
if (!canProcessSampleSize (testResult))
|
||||
return true;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
unprepareProcessing ();
|
||||
|
||||
prepareProcessData ();
|
||||
|
||||
audioEffect->setProcessing (true);
|
||||
|
||||
preProcess (testResult);
|
||||
|
||||
tresult result = audioEffect->process (processData);
|
||||
if (result != kResultOk)
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
STR ("The component failed to process without audio buffers!"));
|
||||
|
||||
audioEffect->setProcessing (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
postProcess (testResult);
|
||||
|
||||
audioEffect->setProcessing (false);
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FlushParamTest2
|
||||
//------------------------------------------------------------------------
|
||||
FlushParamTest2::FlushParamTest2 (ITestPlugProvider* plugProvider, ProcessSampleSize sampl)
|
||||
: FlushParamTest (plugProvider, sampl)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
void FlushParamTest2::prepareProcessData ()
|
||||
{
|
||||
prepareProcessing ();
|
||||
processData.numSamples = 0;
|
||||
|
||||
// remember original processData config
|
||||
std::swap (numInputs, processData.numInputs);
|
||||
std::swap (numOutputs, processData.numOutputs);
|
||||
if (processData.inputs)
|
||||
std::swap (numChannelsIn, processData.inputs[0].numChannels);
|
||||
if (processData.outputs)
|
||||
std::swap (numChannelsOut, processData.outputs[0].numChannels);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool FlushParamTest2::teardown ()
|
||||
{
|
||||
// restore original processData config for correct deallocation
|
||||
std::swap (numInputs, processData.numInputs);
|
||||
std::swap (numOutputs, processData.numOutputs);
|
||||
if (processData.inputs)
|
||||
std::swap (numChannelsIn, processData.inputs[0].numChannels);
|
||||
if (processData.outputs)
|
||||
std::swap (numChannelsOut, processData.outputs[0].numChannels);
|
||||
|
||||
return FlushParamTest::teardown ();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// FlushParamTest3
|
||||
//------------------------------------------------------------------------
|
||||
FlushParamTest3::FlushParamTest3 (ITestPlugProvider* plugProvider, ProcessSampleSize sampl)
|
||||
: FlushParamTest (plugProvider, sampl)
|
||||
{
|
||||
paramChanges.clear ();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/automation.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/processing/process.h"
|
||||
#include <vector>
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
class ParamChanges;
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Automation.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class AutomationTest : public ProcessTest, public IParameterChanges
|
||||
{
|
||||
public:
|
||||
AutomationTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl, int32 everyNSamples,
|
||||
int32 numParams, bool sampleAccuracy);
|
||||
~AutomationTest () override;
|
||||
|
||||
const char* getName () const SMTG_OVERRIDE;
|
||||
// ITest
|
||||
bool PLUGIN_API setup () SMTG_OVERRIDE;
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
bool PLUGIN_API teardown () SMTG_OVERRIDE;
|
||||
|
||||
// IParameterChanges
|
||||
int32 PLUGIN_API getParameterCount () SMTG_OVERRIDE;
|
||||
IParamValueQueue* PLUGIN_API getParameterData (int32 index) SMTG_OVERRIDE;
|
||||
IParamValueQueue* PLUGIN_API addParameterData (const ParamID& id, int32& index) SMTG_OVERRIDE;
|
||||
|
||||
// FUnknown
|
||||
DELEGATE_REFCOUNT (ProcessTest)
|
||||
tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) override;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
protected:
|
||||
bool preProcess (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
bool postProcess (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
ParamID bypassId;
|
||||
|
||||
using ParamChangeVector = std::vector<IPtr<ParamChanges>>;
|
||||
ParamChangeVector paramChanges;
|
||||
int32 countParamChanges;
|
||||
int32 everyNSamples;
|
||||
int32 numParams;
|
||||
bool sampleAccuracy;
|
||||
bool onceExecuted;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Parameters Flush (no Buffer).
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class FlushParamTest : public AutomationTest
|
||||
{
|
||||
public:
|
||||
FlushParamTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
|
||||
DECLARE_VSTTEST ("Parameters Flush (no Buffer)")
|
||||
protected:
|
||||
virtual void prepareProcessData ();
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Parameters Flush 2 (no Buffer).
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class FlushParamTest2 : public FlushParamTest
|
||||
{
|
||||
public:
|
||||
FlushParamTest2 (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
|
||||
bool PLUGIN_API teardown () SMTG_OVERRIDE;
|
||||
|
||||
DECLARE_VSTTEST ("Parameters Flush 2 (only numChannel==0)")
|
||||
protected:
|
||||
void prepareProcessData () SMTG_OVERRIDE;
|
||||
int32 numInputs {0};
|
||||
int32 numOutputs {0};
|
||||
int32 numChannelsIn {0};
|
||||
int32 numChannelsOut {0};
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Parameters Flush 3 (no Buffer, no parameter change).
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class FlushParamTest3 : public FlushParamTest
|
||||
{
|
||||
public:
|
||||
FlushParamTest3 (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
|
||||
DECLARE_VSTTEST ("Parameters Flush 2 (no Buffer, no parameter change)")
|
||||
protected:
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+275
@@ -0,0 +1,275 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/process.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/processing/process.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ProcessTest
|
||||
//------------------------------------------------------------------------
|
||||
ProcessTest::ProcessTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl)
|
||||
: TestEnh (plugProvider, sampl)
|
||||
{
|
||||
processData.numSamples = TestDefaults::instance ().defaultBlockSize;
|
||||
processData.symbolicSampleSize = sampl;
|
||||
|
||||
processSetup.processMode = kRealtime;
|
||||
processSetup.symbolicSampleSize = sampl;
|
||||
processSetup.maxSamplesPerBlock = TestDefaults::instance ().maxBlockSize;
|
||||
processSetup.sampleRate = TestDefaults::instance ().defaultSampleRate;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API ProcessTest::setup ()
|
||||
{
|
||||
if (!TestEnh::setup ())
|
||||
return false;
|
||||
if (!vstPlug || !audioEffect)
|
||||
return false;
|
||||
if (processSetup.symbolicSampleSize != processData.symbolicSampleSize)
|
||||
return false;
|
||||
if (audioEffect->canProcessSampleSize (processSetup.symbolicSampleSize) != kResultOk)
|
||||
return true; // this fails in run (..)
|
||||
|
||||
prepareProcessing ();
|
||||
|
||||
if (vstPlug->setActive (true) != kResultTrue)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API ProcessTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult || !audioEffect)
|
||||
return false;
|
||||
|
||||
if (processSetup.symbolicSampleSize != processData.symbolicSampleSize)
|
||||
return false;
|
||||
if (!canProcessSampleSize (testResult))
|
||||
return true;
|
||||
|
||||
audioEffect->setProcessing (true);
|
||||
|
||||
for (int32 i = 0; i < TestDefaults::instance ().numAudioBlocksToProcess; ++i)
|
||||
{
|
||||
if (!preProcess (testResult))
|
||||
return false;
|
||||
tresult result = audioEffect->process (processData);
|
||||
if (result != kResultOk)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
addErrorMessage (testResult,
|
||||
STR ("IAudioProcessor::process (..with kSample32..) failed."));
|
||||
else
|
||||
addErrorMessage (testResult,
|
||||
STR ("IAudioProcessor::process (..with kSample64..) failed."));
|
||||
|
||||
audioEffect->setProcessing (false);
|
||||
return false;
|
||||
}
|
||||
if (!postProcess (testResult))
|
||||
{
|
||||
audioEffect->setProcessing (false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
audioEffect->setProcessing (false);
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessTest::preProcess (ITestResult* /*testResult*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessTest::postProcess (ITestResult* /*testResult*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessTest::canProcessSampleSize (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult || !audioEffect)
|
||||
return false;
|
||||
if (processSetup.symbolicSampleSize != processData.symbolicSampleSize)
|
||||
return false;
|
||||
if (audioEffect->canProcessSampleSize (processSetup.symbolicSampleSize) != kResultOk)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
addMessage (testResult, STR ("32bit Audio Processing not supported."));
|
||||
else
|
||||
addMessage (testResult, STR ("64bit Audio Processing not supported."));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API ProcessTest::teardown ()
|
||||
{
|
||||
unprepareProcessing ();
|
||||
if (!vstPlug || (vstPlug->setActive (false) != kResultOk))
|
||||
return false;
|
||||
return TestEnh::teardown ();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessTest::prepareProcessing ()
|
||||
{
|
||||
if (!vstPlug || !audioEffect)
|
||||
return false;
|
||||
|
||||
if (audioEffect->setupProcessing (processSetup) == kResultOk)
|
||||
{
|
||||
processData.prepare (*vstPlug, 0, processSetup.symbolicSampleSize);
|
||||
|
||||
for (BusDirection dir = kInput; dir <= kOutput; dir++)
|
||||
{
|
||||
int32 numBusses = vstPlug->getBusCount (kAudio, dir);
|
||||
AudioBusBuffers* audioBuffers =
|
||||
dir == kInput ? processData.inputs :
|
||||
processData.outputs; // new AudioBusBuffers [numBusses];
|
||||
if (!setupBuffers (numBusses, audioBuffers, dir))
|
||||
return false;
|
||||
|
||||
if (dir == kInput)
|
||||
{
|
||||
processData.numInputs = numBusses;
|
||||
processData.inputs = audioBuffers;
|
||||
}
|
||||
else
|
||||
{
|
||||
processData.numOutputs = numBusses;
|
||||
processData.outputs = audioBuffers;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessTest::setupBuffers (int32 numBusses, AudioBusBuffers* audioBuffers, BusDirection dir)
|
||||
{
|
||||
if (((numBusses > 0) && !audioBuffers) || !vstPlug)
|
||||
return false;
|
||||
for (int32 busIndex = 0; busIndex < numBusses; busIndex++) // buses
|
||||
{
|
||||
BusInfo busInfo {};
|
||||
if (vstPlug->getBusInfo (kAudio, dir, busIndex, busInfo) == kResultTrue)
|
||||
{
|
||||
if (!setupBuffers (audioBuffers[busIndex]))
|
||||
return false;
|
||||
|
||||
if ((busInfo.flags & BusInfo::kDefaultActive) != 0)
|
||||
{
|
||||
for (int32 chIdx = 0; chIdx < busInfo.channelCount; chIdx++) // channels per bus
|
||||
audioBuffers[busIndex].silenceFlags |=
|
||||
(TestDefaults::instance ().channelIsSilent << chIdx);
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessTest::setupBuffers (AudioBusBuffers& audioBuffers)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize != processData.symbolicSampleSize)
|
||||
return false;
|
||||
audioBuffers.silenceFlags = 0;
|
||||
for (int32 chIdx = 0; chIdx < audioBuffers.numChannels; chIdx++)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
{
|
||||
if (audioBuffers.channelBuffers32)
|
||||
{
|
||||
audioBuffers.channelBuffers32[chIdx] =
|
||||
new Sample32[processSetup.maxSamplesPerBlock];
|
||||
if (audioBuffers.channelBuffers32[chIdx])
|
||||
memset (audioBuffers.channelBuffers32[chIdx], 0,
|
||||
processSetup.maxSamplesPerBlock * sizeof (Sample32));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else if (processSetup.symbolicSampleSize == kSample64)
|
||||
{
|
||||
if (audioBuffers.channelBuffers64)
|
||||
{
|
||||
audioBuffers.channelBuffers64[chIdx] =
|
||||
new Sample64[processSetup.maxSamplesPerBlock];
|
||||
if (audioBuffers.channelBuffers64[chIdx])
|
||||
memset (audioBuffers.channelBuffers64[chIdx], 0,
|
||||
processSetup.maxSamplesPerBlock * sizeof (Sample64));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessTest::unprepareProcessing ()
|
||||
{
|
||||
bool ret = true;
|
||||
ret &= freeBuffers (processData.numInputs, processData.inputs);
|
||||
ret &= freeBuffers (processData.numOutputs, processData.outputs);
|
||||
processData.unprepare ();
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessTest::freeBuffers (int32 numBuses, AudioBusBuffers* buses)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize != processData.symbolicSampleSize)
|
||||
return false;
|
||||
for (int32 busIndex = 0; busIndex < numBuses; busIndex++)
|
||||
{
|
||||
for (int32 chIdx = 0; chIdx < buses[busIndex].numChannels; chIdx++)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
delete[] buses[busIndex].channelBuffers32[chIdx];
|
||||
else if (processSetup.symbolicSampleSize == kSample64)
|
||||
delete[] buses[busIndex].channelBuffers64[chIdx];
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
@@ -0,0 +1,60 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/process.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/hosting/processdata.h"
|
||||
#include "public.sdk/source/vst/testsuite/testbase.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Process Test.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class ProcessTest : public TestEnh
|
||||
{
|
||||
public:
|
||||
ProcessTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
|
||||
DECLARE_VSTTEST ("Process Test")
|
||||
|
||||
// ITest
|
||||
bool PLUGIN_API setup () SMTG_OVERRIDE;
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
bool PLUGIN_API teardown () SMTG_OVERRIDE;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual bool prepareProcessing (); ///< setup ProcessData and allocate buffers
|
||||
virtual bool unprepareProcessing (); ///< free dynamic memory of ProcessData
|
||||
virtual bool preProcess (ITestResult* testResult); ///< is called just before the process call
|
||||
virtual bool postProcess (ITestResult* testResult); ///< is called right after the process call
|
||||
|
||||
bool setupBuffers (int32 numBusses, AudioBusBuffers* audioBuffers, BusDirection dir);
|
||||
bool setupBuffers (AudioBusBuffers& audioBuffers);
|
||||
bool freeBuffers (int32 numBuses, AudioBusBuffers* buses);
|
||||
bool canProcessSampleSize (ITestResult* testResult); ///< audioEffect has to be available
|
||||
|
||||
HostProcessData processData;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
Vendored
+145
@@ -0,0 +1,145 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/processcontextrequirements.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/processing/processcontextrequirements.h"
|
||||
#include "public.sdk/source/vst/hosting/module.h"
|
||||
#include "public.sdk/source/vst/utility/processcontextrequirements.h"
|
||||
#include "public.sdk/source/vst/utility/versionparser.h"
|
||||
#include "pluginterfaces/base/funknownimpl.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
namespace {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
VST3::Optional<VST3::Version> getPluginSDKVersion (ITestPlugProvider* plugProvider,
|
||||
ITestResult* testResult)
|
||||
{
|
||||
auto pp2 = U::cast<ITestPlugProvider2> (plugProvider);
|
||||
if (!pp2)
|
||||
{
|
||||
addErrorMessage (testResult, STR ("Internal test Error. Expected Interface not there!"));
|
||||
return {};
|
||||
}
|
||||
VST3::Hosting::PluginFactory pluginFactory (pp2->getPluginFactory ());
|
||||
if (!pluginFactory.get ())
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
STR ("Internal test Error. Expected PluginFactory not there!"));
|
||||
return {};
|
||||
}
|
||||
FUID fuid;
|
||||
if (pp2->getComponentUID (fuid) != kResultTrue)
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
STR ("Internal test Error. Could not query the UID of the plug-in!"));
|
||||
return {};
|
||||
}
|
||||
auto plugClassID = VST3::UID::fromTUID (fuid.toTUID ());
|
||||
auto classInfos = pluginFactory.classInfos ();
|
||||
auto it = std::find_if (classInfos.begin (), classInfos.end (),
|
||||
[&] (const auto& element) { return element.ID () == plugClassID; });
|
||||
if (it == classInfos.end ())
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult, STR ("Internal test Error. Could not find the class info of the plug-in!"));
|
||||
return {};
|
||||
}
|
||||
return VST3::Version::parse (it->sdkVersion ());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // anonymous
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ProcessContextRequirementsTest
|
||||
//------------------------------------------------------------------------
|
||||
ProcessContextRequirementsTest::ProcessContextRequirementsTest (ITestPlugProvider* plugProvider)
|
||||
: TestEnh (plugProvider, kSample32)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API ProcessContextRequirementsTest::setup ()
|
||||
{
|
||||
return TestEnh::setup ();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API ProcessContextRequirementsTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!vstPlug || !testResult || !audioEffect)
|
||||
return false;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
// check if plug-in is build with any earlier VST SDK which does not support this interface
|
||||
auto sdkVersion = getPluginSDKVersion (plugProvider, testResult);
|
||||
if (!sdkVersion)
|
||||
return false;
|
||||
if (sdkVersion->getMajor () < 3 ||
|
||||
(sdkVersion->getMajor () == 3 && sdkVersion->getMinor () < 7))
|
||||
{
|
||||
addMessage (testResult,
|
||||
STR ("No ProcessContextRequirements required. Plug-In built with older SDK."));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (auto contextRequirements = U::cast<IProcessContextRequirements> (audioEffect))
|
||||
{
|
||||
ProcessContextRequirements req (contextRequirements->getProcessContextRequirements ());
|
||||
addMessage (testResult, STR ("ProcessContextRequirements:"));
|
||||
if (req.wantsNone ())
|
||||
addMessage (testResult, STR (" - None"));
|
||||
else
|
||||
{
|
||||
if (req.wantsSystemTime ())
|
||||
addMessage (testResult, STR (" - SystemTime"));
|
||||
if (req.wantsContinousTimeSamples ())
|
||||
addMessage (testResult, STR (" - ContinousTimeSamples"));
|
||||
if (req.wantsProjectTimeMusic ())
|
||||
addMessage (testResult, STR (" - ProjectTimeMusic"));
|
||||
if (req.wantsBarPositionMusic ())
|
||||
addMessage (testResult, STR (" - BarPosititionMusic"));
|
||||
if (req.wantsCycleMusic ())
|
||||
addMessage (testResult, STR (" - CycleMusic"));
|
||||
if (req.wantsSamplesToNextClock ())
|
||||
addMessage (testResult, STR (" - SamplesToNextClock"));
|
||||
if (req.wantsTempo ())
|
||||
addMessage (testResult, STR (" - Tempo"));
|
||||
if (req.wantsTimeSignature ())
|
||||
addMessage (testResult, STR (" - TimeSignature"));
|
||||
if (req.wantsChord ())
|
||||
addMessage (testResult, STR (" - Chord"));
|
||||
if (req.wantsFrameRate ())
|
||||
addMessage (testResult, STR (" - FrameRate"));
|
||||
if (req.wantsTransportState ())
|
||||
addMessage (testResult, STR (" - TransportState"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
addMessage (testResult,
|
||||
STR ("Since VST SDK 3.7 you need to implement IProcessContextRequirements!"));
|
||||
addErrorMessage (testResult, STR ("Missing mandatory IProcessContextRequirements extension!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/processcontextrequirements.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 Silence Flags.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class ProcessContextRequirementsTest : public TestEnh
|
||||
{
|
||||
public:
|
||||
ProcessContextRequirementsTest (ITestPlugProvider* plugProvider);
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
bool PLUGIN_API setup () SMTG_OVERRIDE;
|
||||
|
||||
DECLARE_VSTTEST ("ProcessContext Requirements")
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/processformat.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/processing/processformat.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ProcessFormatTest
|
||||
//------------------------------------------------------------------------
|
||||
ProcessFormatTest::ProcessFormatTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl)
|
||||
: ProcessTest (plugProvider, sampl)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API ProcessFormatTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!vstPlug || !testResult || !audioEffect)
|
||||
return false;
|
||||
|
||||
if (!canProcessSampleSize (testResult))
|
||||
return true;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
int32 numFails = 0;
|
||||
const int32 numRates = 12;
|
||||
SampleRate sampleRateFormats[numRates] = {22050., 32000., 44100., 48000.,
|
||||
88200., 96000., 192000., 384000.,
|
||||
1234.5678, 12345.678, 123456.78, 1234567.8};
|
||||
|
||||
tresult result = vstPlug->setActive (false);
|
||||
if (result != kResultOk)
|
||||
{
|
||||
addErrorMessage (testResult, STR ("IComponent::setActive (false) failed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
addMessage (testResult, STR ("***Tested Sample Rates***"));
|
||||
|
||||
for (int32 i = 0; i < numRates; ++i)
|
||||
{
|
||||
processSetup.sampleRate = sampleRateFormats[i];
|
||||
result = audioEffect->setupProcessing (processSetup);
|
||||
if (result == kResultOk)
|
||||
{
|
||||
result = vstPlug->setActive (true);
|
||||
if (result != kResultOk)
|
||||
{
|
||||
addErrorMessage (testResult, STR ("IComponent::setActive (true) failed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
audioEffect->setProcessing (true);
|
||||
result = audioEffect->process (processData);
|
||||
audioEffect->setProcessing (false);
|
||||
|
||||
if (result == kResultOk)
|
||||
{
|
||||
addMessage (testResult,
|
||||
printf (" %10.10G Hz - processed successfully!", sampleRateFormats[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
numFails++;
|
||||
addErrorMessage (testResult,
|
||||
printf (" %10.10G Hz - failed to process!", sampleRateFormats[i]));
|
||||
}
|
||||
|
||||
result = vstPlug->setActive (false);
|
||||
if (result != kResultOk)
|
||||
{
|
||||
addErrorMessage (testResult, STR ("IComponent::setActive (false) failed."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (sampleRateFormats[i] > 0.)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
printf ("IAudioProcessor::setupProcessing (..) failed for samplerate %.3f Hz! ",
|
||||
sampleRateFormats[i]));
|
||||
// return false;
|
||||
}
|
||||
}
|
||||
|
||||
result = vstPlug->setActive (true);
|
||||
if (result != kResultOk)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/processformat.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/processing/process.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Process Format.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class ProcessFormatTest : public ProcessTest
|
||||
{
|
||||
public:
|
||||
ProcessFormatTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
|
||||
DECLARE_VSTTEST ("Process Format")
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
Vendored
+177
@@ -0,0 +1,177 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/processinputoverwriting.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/processing/processinputoverwriting.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ProcessInputOverwritingTest
|
||||
//------------------------------------------------------------------------
|
||||
ProcessInputOverwritingTest::ProcessInputOverwritingTest (ITestPlugProvider* plugProvider,
|
||||
ProcessSampleSize sampl)
|
||||
: ProcessTest (plugProvider, sampl)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessInputOverwritingTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult || !vstPlug)
|
||||
return false;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
bool ret = ProcessTest::run (testResult);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessInputOverwritingTest::preProcess (ITestResult* /*testResult*/)
|
||||
{
|
||||
int32 min = processData.numInputs < processData.numOutputs ? processData.numInputs :
|
||||
processData.numOutputs;
|
||||
noNeedtoProcess = true;
|
||||
|
||||
for (int32 i = 0; i < min; i++)
|
||||
{
|
||||
if (!noNeedtoProcess)
|
||||
break;
|
||||
|
||||
int32 minChannel = processData.inputs[i].numChannels < processData.outputs[i].numChannels ?
|
||||
processData.inputs[i].numChannels :
|
||||
processData.outputs[i].numChannels;
|
||||
|
||||
auto ptrIn = processData.inputs[i].channelBuffers32;
|
||||
auto ptrOut = processData.outputs[i].channelBuffers32;
|
||||
for (int32 j = 0; j < minChannel; j++)
|
||||
{
|
||||
if (ptrIn[j] != ptrOut[j])
|
||||
{
|
||||
noNeedtoProcess = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (noNeedtoProcess)
|
||||
return true;
|
||||
|
||||
for (int32 i = 0; i < processData.numInputs; i++)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
{
|
||||
auto ptr = processData.inputs[i].channelBuffers32;
|
||||
if (ptr)
|
||||
{
|
||||
float inc = 1.f / (processData.numSamples - 1);
|
||||
for (int32 c = 0; c < processData.inputs[i].numChannels; c++)
|
||||
{
|
||||
auto chaBuf = ptr[c];
|
||||
for (int32 j = 0; j < processData.numSamples; j++)
|
||||
{
|
||||
*chaBuf = inc * j;
|
||||
chaBuf++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (processSetup.symbolicSampleSize == kSample64)
|
||||
{
|
||||
auto ptr = processData.inputs[i].channelBuffers64;
|
||||
if (ptr)
|
||||
{
|
||||
double inc = 1.0 / (processData.numSamples - 1);
|
||||
for (int32 c = 0; c < processData.inputs[i].numChannels; c++)
|
||||
{
|
||||
auto chaBuf = ptr[c];
|
||||
for (int32 j = 0; j < processData.numSamples; j++)
|
||||
{
|
||||
*chaBuf = inc * j;
|
||||
chaBuf++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessInputOverwritingTest::postProcess (ITestResult* testResult)
|
||||
{
|
||||
if (noNeedtoProcess)
|
||||
return true;
|
||||
|
||||
for (int32 i = 0; i < processData.numInputs; i++)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
{
|
||||
auto ptr = processData.inputs[i].channelBuffers32;
|
||||
if (ptr)
|
||||
{
|
||||
float inc = 1.f / (processData.numSamples - 1);
|
||||
for (int32 c = 0; c < processData.inputs[i].numChannels; c++)
|
||||
{
|
||||
auto chaBuf = ptr[c];
|
||||
for (int32 j = 0; j < processData.numSamples; j++)
|
||||
{
|
||||
if (*chaBuf != inc * j)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
STR (
|
||||
"IAudioProcessor::process overwrites input buffer (..with kSample32..)!"));
|
||||
return false;
|
||||
}
|
||||
chaBuf++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (processSetup.symbolicSampleSize == kSample64)
|
||||
{
|
||||
auto ptr = processData.inputs[i].channelBuffers64;
|
||||
if (ptr)
|
||||
{
|
||||
double inc = 1.0 / (processData.numSamples - 1);
|
||||
for (int32 c = 0; c < processData.inputs[i].numChannels; c++)
|
||||
{
|
||||
auto chaBuf = ptr[c];
|
||||
for (int32 j = 0; j < processData.numSamples; j++)
|
||||
{
|
||||
if (*chaBuf != inc * j)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
STR (
|
||||
"IAudioProcessor::process overwrites input buffer (..with kSample64..)!"));
|
||||
return false;
|
||||
}
|
||||
chaBuf++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/processinputoverwriting.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/processing/process.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Input Overwriting
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class ProcessInputOverwritingTest : public ProcessTest
|
||||
{
|
||||
public:
|
||||
ProcessInputOverwritingTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
bool preProcess (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
bool postProcess (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
|
||||
DECLARE_VSTTEST ("Process Input Overwriting")
|
||||
private:
|
||||
bool noNeedtoProcess = false;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+250
@@ -0,0 +1,250 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/processtail.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/processing/processtail.h"
|
||||
#include <cmath>
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ProcessTailTest
|
||||
//------------------------------------------------------------------------
|
||||
ProcessTailTest::ProcessTailTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl)
|
||||
: ProcessTest (plugProvider, sampl)
|
||||
, mTailSamples (0)
|
||||
, mInTail (0)
|
||||
, dataPtrFloat (nullptr)
|
||||
, dataPtrDouble (nullptr)
|
||||
, mInSilenceInput (false)
|
||||
, mDontTest (false) {FUNKNOWN_CTOR}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
ProcessTailTest::~ProcessTailTest ()
|
||||
{
|
||||
if (dataPtrFloat)
|
||||
{
|
||||
delete[] dataPtrFloat;
|
||||
dataPtrFloat = nullptr;
|
||||
}
|
||||
if (dataPtrDouble)
|
||||
{
|
||||
delete[] dataPtrDouble;
|
||||
dataPtrDouble = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API ProcessTailTest::setup ()
|
||||
{
|
||||
bool result = ProcessTest::setup ();
|
||||
if (result)
|
||||
{
|
||||
mTailSamples = audioEffect->getTailSamples ();
|
||||
|
||||
StringResult subCat;
|
||||
plugProvider->getSubCategories (subCat);
|
||||
if (subCat.get ().find ("Generator") != std::string::npos ||
|
||||
subCat.get ().find ("Instrument") != std::string::npos)
|
||||
{
|
||||
mDontTest = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessTailTest::preProcess (ITestResult* /*testResult*/)
|
||||
{
|
||||
if (!mInSilenceInput)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
{
|
||||
if (!dataPtrFloat)
|
||||
dataPtrFloat = new float[processData.numSamples];
|
||||
float* ptr = dataPtrFloat;
|
||||
for (int32 i = 0; i < processData.numSamples; ++i)
|
||||
ptr[i] = (float)(2 * rand () / 32767.0 - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!dataPtrDouble)
|
||||
dataPtrDouble = new double[processData.numSamples];
|
||||
double* ptr = (double*)dataPtrDouble;
|
||||
for (int32 i = 0; i < processData.numSamples; ++i)
|
||||
ptr[i] = (double)(2 * rand () / 32767.0 - 1);
|
||||
}
|
||||
for (int32 i = 0; i < processData.numOutputs; ++i)
|
||||
{
|
||||
for (int32 c = 0; c < processData.outputs->numChannels; ++c)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
memset (processData.outputs->channelBuffers32[c], 0,
|
||||
processData.numSamples * sizeof (float));
|
||||
else
|
||||
memset (processData.outputs->channelBuffers64[c], 0,
|
||||
processData.numSamples * sizeof (double));
|
||||
}
|
||||
}
|
||||
for (int32 i = 0; i < processData.numInputs; ++i)
|
||||
{
|
||||
for (int32 c = 0; c < processData.inputs->numChannels; ++c)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
memcpy (processData.inputs->channelBuffers32[c], dataPtrFloat,
|
||||
processData.numSamples * sizeof (float));
|
||||
else
|
||||
memcpy (processData.inputs->channelBuffers64[c], dataPtrDouble,
|
||||
processData.numSamples * sizeof (double));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// process with silent buffers
|
||||
for (int32 i = 0; i < processData.numOutputs; ++i)
|
||||
{
|
||||
for (int32 c = 0; c < processData.outputs->numChannels; ++c)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
memset (processData.outputs->channelBuffers32[c], 0,
|
||||
processData.numSamples * sizeof (float));
|
||||
else
|
||||
memset (processData.outputs->channelBuffers64[c], 0,
|
||||
processData.numSamples * sizeof (double));
|
||||
}
|
||||
}
|
||||
for (int32 i = 0; i < processData.numInputs; ++i)
|
||||
{
|
||||
for (int32 c = 0; c < processData.inputs->numChannels; ++c)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
memset (processData.inputs->channelBuffers32[c], 0,
|
||||
processData.numSamples * sizeof (float));
|
||||
else
|
||||
memset (processData.inputs->channelBuffers64[c], 0,
|
||||
processData.numSamples * sizeof (double));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessTailTest::postProcess (ITestResult* testResult)
|
||||
{
|
||||
if (mInSilenceInput)
|
||||
{
|
||||
// should be silence
|
||||
if (mTailSamples < mInTail + processData.numSamples)
|
||||
{
|
||||
int32 start = mTailSamples > mInTail ? mTailSamples - mInTail : 0;
|
||||
int32 end = processData.numSamples;
|
||||
|
||||
for (int32 i = 0; i < processData.numOutputs; ++i)
|
||||
{
|
||||
for (int32 c = 0; c < processData.outputs->numChannels; ++c)
|
||||
{
|
||||
if (processSetup.symbolicSampleSize == kSample32)
|
||||
{
|
||||
for (int32 s = start; s < end; ++s)
|
||||
{
|
||||
if (fabsf (processData.outputs->channelBuffers32[c][s]) >= 1e-7)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
printf (
|
||||
"IAudioProcessor::process (..) generates non silent output for silent input for tail above %d samples.",
|
||||
mTailSamples));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int32 s = start; s < end; ++s)
|
||||
{
|
||||
if (fabs (processData.outputs->channelBuffers64[c][s]) >= 1e-7)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
printf (
|
||||
"IAudioProcessor::process (..) generates non silent output for silent input for tail above %d samples.",
|
||||
mTailSamples));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mInTail += processData.numSamples;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API ProcessTailTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult || !audioEffect)
|
||||
return false;
|
||||
|
||||
if (processSetup.symbolicSampleSize != processData.symbolicSampleSize)
|
||||
return false;
|
||||
if (!canProcessSampleSize (testResult))
|
||||
return true;
|
||||
|
||||
if (mDontTest)
|
||||
return true;
|
||||
|
||||
addMessage (testResult,
|
||||
printf ("===%s == Tail=%d ======================", getName (), mTailSamples));
|
||||
|
||||
audioEffect->setProcessing (true);
|
||||
|
||||
// process with signal (noise) and silence
|
||||
for (int32 i = 0; i < 20 * TestDefaults::instance ().numAudioBlocksToProcess; ++i)
|
||||
{
|
||||
mInSilenceInput = i > 10;
|
||||
|
||||
if (!preProcess (testResult))
|
||||
return false;
|
||||
tresult result = audioEffect->process (processData);
|
||||
if (result != kResultOk)
|
||||
{
|
||||
addErrorMessage (testResult, STR ("IAudioProcessor::process (..) failed."));
|
||||
|
||||
audioEffect->setProcessing (false);
|
||||
return false;
|
||||
}
|
||||
if (!postProcess (testResult))
|
||||
{
|
||||
audioEffect->setProcessing (false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
audioEffect->setProcessing (false);
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/processtail.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/processing/process.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test ProcesTail.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class ProcessTailTest : public ProcessTest
|
||||
{
|
||||
public:
|
||||
ProcessTailTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
~ProcessTailTest () override;
|
||||
|
||||
DECLARE_VSTTEST ("Check Tail processing")
|
||||
|
||||
// ITest
|
||||
bool PLUGIN_API setup () SMTG_OVERRIDE;
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
bool preProcess (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
bool postProcess (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
protected:
|
||||
private:
|
||||
uint32 mTailSamples;
|
||||
uint32 mInTail;
|
||||
|
||||
float* dataPtrFloat;
|
||||
double* dataPtrDouble;
|
||||
bool mInSilenceInput;
|
||||
bool mDontTest;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/processthreaded.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/processing/processthreaded.h"
|
||||
#include <thread>
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ProcessTest
|
||||
//------------------------------------------------------------------------
|
||||
ProcessThreadTest::ProcessThreadTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl)
|
||||
: ProcessTest (plugProvider, sampl)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
ProcessThreadTest::~ProcessThreadTest ()
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProcessThreadTest::run (ITestResult* testResult)
|
||||
{
|
||||
constexpr auto NUM_ITERATIONS = 9999;
|
||||
|
||||
if (!vstPlug || !testResult || !audioEffect)
|
||||
return false;
|
||||
if (!canProcessSampleSize (testResult))
|
||||
return true;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
bool result = false;
|
||||
std::thread processThread ([&] () {
|
||||
result = true;
|
||||
audioEffect->setProcessing (true);
|
||||
for (auto i = 0; i < NUM_ITERATIONS; i++)
|
||||
{
|
||||
tresult tr = audioEffect->process (processData);
|
||||
if (tr != kResultTrue)
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
audioEffect->setProcessing (false);
|
||||
});
|
||||
|
||||
processThread.join ();
|
||||
|
||||
if (!result)
|
||||
testResult->addErrorMessage (STR ("Processing failed."));
|
||||
return result;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/processthreaded.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/processing/process.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ProcessTest
|
||||
//------------------------------------------------------------------------
|
||||
class ProcessThreadTest : public ProcessTest
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------
|
||||
ProcessThreadTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
~ProcessThreadTest () override;
|
||||
|
||||
DECLARE_VSTTEST ("Process function running in another thread")
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) override;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/silenceflags.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/processing/silenceflags.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// SilenceFlagsTest
|
||||
//------------------------------------------------------------------------
|
||||
SilenceFlagsTest::SilenceFlagsTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl)
|
||||
: ProcessTest (plugProvider, sampl)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API SilenceFlagsTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!vstPlug || !testResult || !audioEffect)
|
||||
return false;
|
||||
|
||||
if (!canProcessSampleSize (testResult))
|
||||
return true;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
if (processData.inputs != nullptr)
|
||||
{
|
||||
audioEffect->setProcessing (true);
|
||||
|
||||
for (int32 inputsIndex = 0; inputsIndex < processData.numInputs; inputsIndex++)
|
||||
{
|
||||
int32 numSilenceFlagsCombinations =
|
||||
(1 << processData.inputs[inputsIndex].numChannels) - 1;
|
||||
for (int32 flagCombination = 0; flagCombination <= numSilenceFlagsCombinations;
|
||||
flagCombination++)
|
||||
{
|
||||
processData.inputs[inputsIndex].silenceFlags = flagCombination;
|
||||
tresult result = audioEffect->process (processData);
|
||||
if (result != kResultOk)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
printf (
|
||||
"The component failed to process bus %i with silence flag combination %x!",
|
||||
inputsIndex, flagCombination));
|
||||
audioEffect->setProcessing (false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (processData.numInputs > 0)
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
STR ("ProcessData::inputs are 0 but ProcessData::numInputs are nonzero."));
|
||||
return false;
|
||||
}
|
||||
|
||||
audioEffect->setProcessing (false);
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/silenceflags.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/processing/process.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Silence Flags.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class SilenceFlagsTest : public ProcessTest
|
||||
{
|
||||
public:
|
||||
SilenceFlagsTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
|
||||
DECLARE_VSTTEST ("Silence Flags")
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/silenceprocessing.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/processing/silenceprocessing.h"
|
||||
#include <cmath>
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// SilenceProcessingTest
|
||||
//------------------------------------------------------------------------
|
||||
SilenceProcessingTest::SilenceProcessingTest (ITestPlugProvider* plugProvider,
|
||||
ProcessSampleSize sampl)
|
||||
: ProcessTest (plugProvider, sampl)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool SilenceProcessingTest::isBufferSilent (void* buffer, int32 numSamples, ProcessSampleSize sampl)
|
||||
{
|
||||
if (sampl == kSample32)
|
||||
{
|
||||
const float kSilenceThreshold = 0.000132184039f;
|
||||
|
||||
float* floatBuffer = (float*)buffer;
|
||||
while (numSamples--)
|
||||
{
|
||||
if (fabsf (*floatBuffer) > kSilenceThreshold)
|
||||
return false;
|
||||
floatBuffer++;
|
||||
}
|
||||
}
|
||||
else if (sampl == kSample64)
|
||||
{
|
||||
const double kSilenceThreshold = 0.000132184039;
|
||||
|
||||
double* floatBuffer = (double*)buffer;
|
||||
while (numSamples--)
|
||||
{
|
||||
if (fabs (*floatBuffer) > kSilenceThreshold)
|
||||
return false;
|
||||
floatBuffer++;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API SilenceProcessingTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!vstPlug || !testResult || !audioEffect)
|
||||
return false;
|
||||
|
||||
if (!canProcessSampleSize (testResult))
|
||||
return true;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
if (processData.inputs != nullptr)
|
||||
{
|
||||
// process 20s before checking flags
|
||||
int32 numPasses = int32 (20 * processSetup.sampleRate / processData.numSamples + 0.5);
|
||||
|
||||
audioEffect->setProcessing (true);
|
||||
for (int32 pass = 0; pass < numPasses; pass++)
|
||||
{
|
||||
for (int32 busIndex = 0; busIndex < processData.numInputs; busIndex++)
|
||||
{
|
||||
processData.inputs[busIndex].silenceFlags = 0;
|
||||
for (int32 channelIndex = 0;
|
||||
channelIndex < processData.inputs[busIndex].numChannels; channelIndex++)
|
||||
{
|
||||
processData.inputs[busIndex].silenceFlags |= (uint64)1 << (uint64)channelIndex;
|
||||
if (processData.symbolicSampleSize == kSample32)
|
||||
memset (processData.inputs[busIndex].channelBuffers32[channelIndex], 0,
|
||||
sizeof (float) * processData.numSamples);
|
||||
else if (processData.symbolicSampleSize == kSample64)
|
||||
memset (processData.inputs[busIndex].channelBuffers32[channelIndex], 0,
|
||||
sizeof (double) * processData.numSamples);
|
||||
}
|
||||
}
|
||||
|
||||
for (int32 busIndex = 0; busIndex < processData.numOutputs; busIndex++)
|
||||
{
|
||||
if (processData.numInputs > busIndex)
|
||||
processData.outputs[busIndex].silenceFlags =
|
||||
processData.inputs[busIndex].silenceFlags;
|
||||
else
|
||||
{
|
||||
processData.outputs[busIndex].silenceFlags = 0;
|
||||
for (int32 channelIndex = 0;
|
||||
channelIndex < processData.outputs[busIndex].numChannels; channelIndex++)
|
||||
processData.outputs[busIndex].silenceFlags |= (uint64)1
|
||||
<< (uint64)channelIndex;
|
||||
}
|
||||
}
|
||||
|
||||
tresult result = audioEffect->process (processData);
|
||||
if (result != kResultOk)
|
||||
{
|
||||
addErrorMessage (testResult, printf ("%s", "The component failed to process!"));
|
||||
|
||||
audioEffect->setProcessing (false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int32 busIndex = 0; busIndex < processData.numOutputs; busIndex++)
|
||||
{
|
||||
for (int32 channelIndex = 0; channelIndex < processData.outputs[busIndex].numChannels;
|
||||
channelIndex++)
|
||||
{
|
||||
bool channelShouldBeSilent = (processData.outputs[busIndex].silenceFlags &
|
||||
(uint64)1 << (uint64)channelIndex) != 0;
|
||||
bool channelIsSilent =
|
||||
isBufferSilent (processData.outputs[busIndex].channelBuffers32[channelIndex],
|
||||
processData.numSamples, processData.symbolicSampleSize);
|
||||
if (channelShouldBeSilent != channelIsSilent)
|
||||
{
|
||||
constexpr auto silentText = STR (
|
||||
"The component reported a wrong silent flag for its output buffer! : output is silent but silenceFlags not set !");
|
||||
constexpr auto nonSilentText = STR (
|
||||
"The component reported a wrong silent flag for its output buffer! : silenceFlags is set to silence but output is not silent");
|
||||
addMessage (testResult, channelIsSilent ? silentText : nonSilentText);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (processData.numInputs > 0)
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
STR ("ProcessData::inputs are 0 but ProcessData::numInputs are nonzero."));
|
||||
return false;
|
||||
}
|
||||
|
||||
audioEffect->setProcessing (false);
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/silenceprocessing.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/processing/process.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Silence Processing.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class SilenceProcessingTest : public ProcessTest
|
||||
{
|
||||
public:
|
||||
SilenceProcessingTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
|
||||
DECLARE_VSTTEST ("Silence Processing")
|
||||
protected:
|
||||
bool isBufferSilent (void* buffer, int32 numSamples, ProcessSampleSize sampl);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+233
@@ -0,0 +1,233 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/speakerarrangement.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/processing/speakerarrangement.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// SpeakerArrangementTest
|
||||
//------------------------------------------------------------------------
|
||||
SpeakerArrangementTest::SpeakerArrangementTest (ITestPlugProvider* plugProvider,
|
||||
ProcessSampleSize sampl, SpeakerArrangement inSpArr,
|
||||
SpeakerArrangement outSpArr)
|
||||
: ProcessTest (plugProvider, sampl), inSpArr (inSpArr), outSpArr (outSpArr)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
const char* SpeakerArrangementTest::getSpeakerArrangementName (SpeakerArrangement spArr)
|
||||
{
|
||||
const char* saName = nullptr;
|
||||
switch (spArr)
|
||||
{
|
||||
case SpeakerArr::kMono: saName = "Mono"; break;
|
||||
case SpeakerArr::kStereo: saName = "Stereo"; break;
|
||||
case SpeakerArr::kStereoSurround: saName = "StereoSurround"; break;
|
||||
case SpeakerArr::kStereoCenter: saName = "StereoCenter"; break;
|
||||
case SpeakerArr::kStereoSide: saName = "StereoSide"; break;
|
||||
case SpeakerArr::kStereoCLfe: saName = "StereoCLfe"; break;
|
||||
case SpeakerArr::k30Cine: saName = "30Cine"; break;
|
||||
case SpeakerArr::k30Music: saName = "30Music"; break;
|
||||
case SpeakerArr::k31Cine: saName = "31Cine"; break;
|
||||
case SpeakerArr::k31Music: saName = "31Music"; break;
|
||||
case SpeakerArr::k40Cine: saName = "40Cine"; break;
|
||||
case SpeakerArr::k40Music: saName = "40Music"; break;
|
||||
case SpeakerArr::k41Cine: saName = "41Cine"; break;
|
||||
case SpeakerArr::k41Music: saName = "41Music"; break;
|
||||
case SpeakerArr::k50: saName = "50"; break;
|
||||
case SpeakerArr::k51: saName = "51"; break;
|
||||
case SpeakerArr::k60Cine: saName = "60Cine"; break;
|
||||
case SpeakerArr::k60Music: saName = "60Music"; break;
|
||||
case SpeakerArr::k61Cine: saName = "61Cine"; break;
|
||||
case SpeakerArr::k61Music: saName = "61Music"; break;
|
||||
case SpeakerArr::k70Cine: saName = "70Cine"; break;
|
||||
case SpeakerArr::k70Music: saName = "70Music"; break;
|
||||
case SpeakerArr::k71Cine: saName = "71Cine"; break;
|
||||
case SpeakerArr::k71Music: saName = "71Music"; break;
|
||||
case SpeakerArr::k80Cine: saName = "80Cine"; break;
|
||||
case SpeakerArr::k80Music: saName = "80Music"; break;
|
||||
case SpeakerArr::k81Cine: saName = "81Cine"; break;
|
||||
case SpeakerArr::k81Music: saName = "81Music"; break;
|
||||
case SpeakerArr::k102: saName = "102"; break;
|
||||
case SpeakerArr::k122: saName = "122"; break;
|
||||
case SpeakerArr::k80Cube: saName = "80Cube"; break;
|
||||
case SpeakerArr::k90: saName = "9.0"; break;
|
||||
case SpeakerArr::k91: saName = "9.1"; break;
|
||||
case SpeakerArr::k100: saName = "10.0"; break;
|
||||
case SpeakerArr::k101: saName = "10.1"; break;
|
||||
case SpeakerArr::k110: saName = "11.0"; break;
|
||||
case SpeakerArr::k111: saName = "11.1"; break;
|
||||
case SpeakerArr::k130: saName = "13.0"; break;
|
||||
case SpeakerArr::k131: saName = "13.1"; break;
|
||||
case SpeakerArr::k222: saName = "22.2"; break;
|
||||
case SpeakerArr::kEmpty: saName = "Empty"; break;
|
||||
default: saName = "Unknown"; break;
|
||||
}
|
||||
return saName;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
const char* SpeakerArrangementTest::getName () const
|
||||
{
|
||||
const auto inSaName = getSpeakerArrangementName (inSpArr);
|
||||
const auto outSaName = getSpeakerArrangementName (outSpArr);
|
||||
if (inSaName && outSaName)
|
||||
{
|
||||
static std::string str;
|
||||
str = "In: ";
|
||||
str += inSaName;
|
||||
str += ": ";
|
||||
str += std::to_string (SpeakerArr::getChannelCount (inSpArr));
|
||||
str += " Channels, Out: ";
|
||||
str += outSaName;
|
||||
str += ": ";
|
||||
str += std::to_string (SpeakerArr::getChannelCount (outSpArr));
|
||||
str += " Channels";
|
||||
return str.data ();
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool SpeakerArrangementTest::prepareProcessing ()
|
||||
{
|
||||
if (!vstPlug || !audioEffect)
|
||||
return false;
|
||||
|
||||
bool ret = true;
|
||||
int32 is = vstPlug->getBusCount (kAudio, kInput);
|
||||
auto* inSpArrs = new SpeakerArrangement[is];
|
||||
for (int32 i = 0; i < is; ++i)
|
||||
inSpArrs[i] = inSpArr;
|
||||
|
||||
int32 os = vstPlug->getBusCount (kAudio, kOutput);
|
||||
auto* outSpArrs = new SpeakerArrangement[os];
|
||||
for (int32 o = 0; o < os; o++)
|
||||
outSpArrs[o] = outSpArr;
|
||||
|
||||
if (audioEffect->setBusArrangements (inSpArrs, is, outSpArrs, os) != kResultTrue)
|
||||
ret = false;
|
||||
|
||||
// activate only the extra IO (index > 0), the main ones (index 0) were already activated in
|
||||
// TestBase::setup ()
|
||||
for (int32 i = 1; i < is; i++)
|
||||
vstPlug->activateBus (kAudio, kInput, i, true);
|
||||
|
||||
for (int32 i = 1; i < os; i++)
|
||||
vstPlug->activateBus (kAudio, kOutput, i, true);
|
||||
|
||||
ret &= ProcessTest::prepareProcessing ();
|
||||
|
||||
delete[] inSpArrs;
|
||||
delete[] outSpArrs;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool SpeakerArrangementTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult || !audioEffect || !vstPlug)
|
||||
return false;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
SpeakerArrangement spArr = SpeakerArr::kEmpty;
|
||||
SpeakerArrangement compareSpArr = SpeakerArr::kEmpty;
|
||||
BusDirections bd = kInput;
|
||||
BusInfo busInfo = {};
|
||||
int32 count = 0;
|
||||
do
|
||||
{
|
||||
count++;
|
||||
int32 numBusses = 0;
|
||||
if (bd == kInput)
|
||||
{
|
||||
numBusses = processData.numInputs;
|
||||
compareSpArr = inSpArr;
|
||||
}
|
||||
else
|
||||
{
|
||||
numBusses = processData.numOutputs;
|
||||
compareSpArr = outSpArr;
|
||||
}
|
||||
for (int32 i = 0; i < numBusses; ++i)
|
||||
{
|
||||
if (audioEffect->getBusArrangement (bd, i, spArr) != kResultTrue)
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
STR ("IAudioProcessor::getBusArrangement (..) failed."));
|
||||
return false;
|
||||
}
|
||||
if (spArr != compareSpArr)
|
||||
{
|
||||
addMessage (
|
||||
testResult,
|
||||
printf (" %s %sSpeakerArrangement is not supported. Plug-in suggests: %s.",
|
||||
getSpeakerArrangementName (compareSpArr),
|
||||
bd == kInput ? "Input-" : "Output-",
|
||||
getSpeakerArrangementName (spArr)));
|
||||
}
|
||||
if (vstPlug->getBusInfo (kAudio, bd, i, busInfo) != kResultTrue)
|
||||
{
|
||||
addErrorMessage (testResult, STR ("IComponent::getBusInfo (..) failed."));
|
||||
return false;
|
||||
}
|
||||
if (spArr == compareSpArr &&
|
||||
SpeakerArr::getChannelCount (spArr) != busInfo.channelCount)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
STR ("SpeakerArrangement mismatch (BusInfo::channelCount inconsistency)."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bd = kOutput;
|
||||
} while (count < 2);
|
||||
|
||||
bool ret = true;
|
||||
|
||||
// not a Pb ret &= verifySA (processData.numInputs, processData.inputs, inSpArr, testResult);
|
||||
// not a Pb ret &= verifySA (processData.numOutputs, processData.outputs, outSpArr, testResult);
|
||||
ret &= ProcessTest::run (testResult);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool SpeakerArrangementTest::verifySA (int32 numBusses, AudioBusBuffers* buses,
|
||||
SpeakerArrangement spArr, ITestResult* testResult)
|
||||
{
|
||||
if (!testResult || !buses)
|
||||
return false;
|
||||
for (int32 i = 0; i < numBusses; ++i)
|
||||
{
|
||||
if (buses[i].numChannels != SpeakerArr::getChannelCount (spArr))
|
||||
{
|
||||
addErrorMessage (testResult, STR ("ChannelCount is not matching SpeakerArrangement."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/speakerarrangement.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/processing/process.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Speaker Arrangement.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class SpeakerArrangementTest : public ProcessTest
|
||||
{
|
||||
public:
|
||||
SpeakerArrangementTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl,
|
||||
SpeakerArrangement inSpArr, SpeakerArrangement outSpArr);
|
||||
|
||||
const char* getName () const SMTG_OVERRIDE;
|
||||
static const char* getSpeakerArrangementName (SpeakerArrangement spArr);
|
||||
|
||||
// ITest
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
protected:
|
||||
bool prepareProcessing () SMTG_OVERRIDE;
|
||||
bool verifySA (int32 numBusses, AudioBusBuffers* buses, SpeakerArrangement spArr,
|
||||
ITestResult* testResult);
|
||||
|
||||
private:
|
||||
SpeakerArrangement inSpArr;
|
||||
SpeakerArrangement outSpArr;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/variableblocksize.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/processing/variableblocksize.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// VariableBlockSizeTest
|
||||
//------------------------------------------------------------------------
|
||||
VariableBlockSizeTest::VariableBlockSizeTest (ITestPlugProvider* plugProvider,
|
||||
ProcessSampleSize sampl)
|
||||
: ProcessTest (plugProvider, sampl)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool PLUGIN_API VariableBlockSizeTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!vstPlug || !testResult || !audioEffect)
|
||||
return false;
|
||||
|
||||
if (!canProcessSampleSize (testResult))
|
||||
return true;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
audioEffect->setProcessing (true);
|
||||
|
||||
for (int32 i = 0; i <= TestDefaults::instance ().numIterations; ++i)
|
||||
{
|
||||
int32 sampleFrames = rand () % processSetup.maxSamplesPerBlock;
|
||||
processData.numSamples = sampleFrames;
|
||||
if (i == 0)
|
||||
processData.numSamples = 0;
|
||||
#if defined(TOUGHTESTS) && TOUGHTESTS
|
||||
else if (i == 1)
|
||||
processData.numSamples = -50000;
|
||||
else if (i == 2)
|
||||
processData.numSamples = processSetup.maxSamplesPerBlock * 2;
|
||||
#endif // TOUGHTESTS
|
||||
|
||||
tresult result = audioEffect->process (processData);
|
||||
if ((result != kResultOk)
|
||||
#if defined(TOUGHTESTS) && TOUGHTESTS
|
||||
&& (i > 1)
|
||||
#else
|
||||
&& (i > 0)
|
||||
#endif // TOUGHTESTS
|
||||
)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
printf ("The component failed to process an audioblock of size %i", sampleFrames));
|
||||
audioEffect->setProcessing (false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
audioEffect->setProcessing (false);
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/processing/variableblocksize.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/processing/process.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Variable Block Size.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class VariableBlockSizeTest : public ProcessTest
|
||||
{
|
||||
public:
|
||||
VariableBlockSizeTest (ITestPlugProvider* plugProvider, ProcessSampleSize sampl);
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
|
||||
DECLARE_VSTTEST ("Variable Block Size")
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
Reference in New Issue
Block a user