Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix VST3 validation errors #1503

Merged
merged 1 commit into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion src/vst3/SurgeVst3Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <cwchar>
#include <codecvt>
#include <string.h>
#include <cwchar>

using namespace Steinberg::Vst;

Expand Down Expand Up @@ -654,6 +655,19 @@ tresult PLUGIN_API SurgeVst3Processor::getParameterInfo(int32 paramIndex, Parame
info.unitId = 0; // meta.clump;

// FIXME - set the title
wchar_t nm[512];
auto im = paramIndex - midi_controller_0;
auto ich = im % 16;
auto icc = im / 16;

swprintf(nm, 512, L"MIDI CC %d Ch.%d", icc, ich );

#if MAC || LINUX
std::copy(nm, nm + 128, info.title);
#else
swprintf(reinterpret_cast<wchar_t *>(info.title), 128, L"%S", nm);
#endif

}
else
{
Expand Down Expand Up @@ -697,6 +711,12 @@ tresult PLUGIN_API SurgeVst3Processor::getParameterInfo(int32 paramIndex, Parame
info.defaultNormalizedValue = meta.fdefault;
info.unitId = 0; // meta.clump;
info.flags = ParameterInfo::kCanAutomate;

//char nm[512];
//surgeInstance->getParameterName( id, nm );
// std::cout << "gPID " << paramIndex << " " << " " << info.id << std::endl;


}
return kResultOk;
}
Expand Down Expand Up @@ -828,6 +848,10 @@ tresult PLUGIN_API SurgeVst3Processor::getMidiControllerAssignment(int32 busInde
CtrlNumber midiControllerNumber,
ParamID& id /*out*/)
{
// Why even ask me? But you do. So...
if( midiControllerNumber >= kCountCtrlNumber || midiControllerNumber < 0 )
return kResultFalse;

/*
** Alrighty dighty. What VST3 wants us to do here is, for the controller number,
** tell it a parameter to map to. We alas don't have a parameter to map to because
Expand All @@ -836,7 +860,6 @@ tresult PLUGIN_API SurgeVst3Processor::getMidiControllerAssignment(int32 busInde
*/

id = midi_controller_0 + midiControllerNumber * 16 + channel;
// std::cout << "getMidiControllerAssignment " << channel << " midiControllerNumber=" << midiControllerNumber << " id=" << id << std::endl;
return kResultTrue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vst3/SurgeVst3Processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class SurgeVst3Processor : public Steinberg::Vst::SingleComponentEffect,
FpuState _fpuState;

int midi_controller_0, midi_controller_max;
const int n_midi_controller_params = 16 * Steinberg::Vst::ControllerNumbers::kCountCtrlNumber;
const int n_midi_controller_params = 16 * (Steinberg::Vst::ControllerNumbers::kCountCtrlNumber);

public:
OBJ_METHODS(SurgeVst3Processor, Steinberg::Vst::SingleComponentEffect)
Expand Down