Commit 8616751e authored by Benjamin Heisch's avatar Benjamin Heisch
Browse files

Added midi tests to vst2

parent aa18208e
Pipeline #19064 failed with stages
in 2 minutes and 12 seconds
......@@ -51,11 +51,11 @@ static intptr_t vst_dispatcher(AEffect* effect, int32_t opcode, int32_t index, i
break;*/
case effMainsChanged: ///< [value]: 0 means "turn off", 1 means "turn on" @see AudioEffect::suspend @see AudioEffect::resume
if (value == 0)
data->plug->activate();
else
data->plug->deactivate();
else
data->plug->activate();
break;
case effEditGetRect: ///< [ptr]: #ERect** receiving pointer to editor size @see ERect @see AEffEditor::getRect
/* case effEditGetRect: ///< [ptr]: #ERect** receiving pointer to editor size @see ERect @see AEffEditor::getRect
break;
case effEditOpen: ///< [ptr]: system dependent Window pointer, e.g. HWND on Windows @see AEffEditor::open
break;
......@@ -66,10 +66,10 @@ static intptr_t vst_dispatcher(AEffect* effect, int32_t opcode, int32_t index, i
case effGetChunk: ///< [ptr]: void** for chunk data address [index]: 0 for bank, 1 for program @see AudioEffect::getChunk
break;
case effSetChunk: ///< [ptr]: chunk data [value]: byte size [index]: 0 for bank, 1 for program @see AudioEffect::setChunk
break;
break;*/
/**************************EXTENDING OPCODES*******************************/
case effProcessEvents: ///< [ptr]: #VstEvents* @see AudioEffectX::processEvents = effSetChunk + 1 ///< [ptr]: #VstEvents* @see AudioEffectX::processEventsdes:
case effProcessEvents: ///< [ptr]: #VstEventsVstEvents* @see AudioEffectX::processEvents = effSetChunk + 1 ///< [ptr]: #VstEvents* @see AudioEffectX::processEventsdes:
if (data->plug->getFeatureComponent()->supportsFeature(Feature::MidiInput)) {
auto events = (VstEvents*)ptr;
if (events->numEvents == 0)
......
......@@ -2,12 +2,12 @@
#include "tools/LibLoading.hpp"
#include "vst_def.hpp"
using namespace XPlug;
typedef AEffect* (*VSTPluginMain)(audioMasterCallback );
typedef AEffect* (*VSTPluginMain)(audioMasterCallback);
class VST2TestSuite :public FormatTestSuiteBase {
public:
virtual std::string getFormatName() override
{
return "VST2";
......@@ -15,12 +15,12 @@ public:
virtual SucceedState run() override
{
size_t sampleSize =512;
size_t sampleSize = 512;
audioMasterCallback aMasterCallback = [](AEffect* effect, int32_t opCode, int32_t, intptr_t, void*, float)->intptr_t {
switch (opCode) {
case audioMasterProcessEvents:
break;
case audioMasterVersion :
case audioMasterVersion:
return 100;
}
return 0;
......@@ -28,18 +28,18 @@ public:
auto lib = LoadLib(data.pluginPath.c_str());
if (lib == nullptr) return false;
auto VSTPluginMain_fnc = LoadFunc<VSTPluginMain>(lib, "VSTPluginMain");
auto effect = VSTPluginMain_fnc(aMasterCallback);
test(1, effect != nullptr, "Error, couldnt create VST2 effect.");
effect->dispatcher(effect, effOpen, NULL, NULL, nullptr, NULL);// Open Effect
effect->dispatcher(effect, effMainsChanged, NULL, 1, nullptr, NULL); // Activate plugin (1 turn on , 0 turn off)
effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0);// Open Effect
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0); // Activate plugin (1 turn on , 0 turn off)
// Audio processing
float** inData = new float* [effect->numInputs];
float** outData = new float* [effect->numOutputs];
for (int i = 0; i < effect->numInputs; i++)
for (int i = 0; i < effect->numInputs; i++)
inData[i] = new float[sampleSize];
for (int i = 0; i < effect->numOutputs; i++)
for (int i = 0; i < effect->numOutputs; i++)
outData[i] = new float[sampleSize];
effect->processReplacing(effect, inData, outData, sampleSize);
//cleanup allocated arrays.
......@@ -50,9 +50,16 @@ public:
delete[] inData;
delete[] outData;
//MIDI TEST
//effect->dispatcher(effect,effCanDo,NULL, NULL, "receiveVstMidiEvent", NULL);
//effect->dispatcher(effect, effCanDo, NULL, NULL, "sendVstMidiEvent", NULL);
effect->dispatcher(effect, effClose, NULL, NULL, nullptr, NULL);// Close Effect
if (effect->dispatcher(effect, effCanDo, 0, 0, "receiveVstMidiEvent", 0) == 1){
VstMidiEvent mEvent{ kVstMidiType,sizeof(VstMidiEvent),0,0,0,0,{ 0x1,0x2,0x3,0x0 },0,0,0,0 };
VstEvent* mEventP = (VstEvent*)&mEvent;
VstEvents ev{ 1,nullptr,{ mEventP,NULL } };
effect->dispatcher(effect, effProcessEvents, 0, 0, &ev, 0);
}
effect->dispatcher(effect, effCanDo, 0, 0, "sendVstMidiEvent", 0);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0);
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0);// Close Effect
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment