Hi, I’m trying to get my head around changing a vst’s parameters from the host but don’t really understand the examples provided in the audiohost sample.
right now i would just like to run a simple commandline app which loads a host, lists the parameters and their ID’s, then changes them and returns the parameter’s new value. no audio right now, no gui, just simple terminal stuff all run from a main.cpp
for reference heres my source code which currently does the first couple of steps.
#include <iostream>
#include <public.sdk/source/vst/hosting/plugprovider.h>
#include <public.sdk/source/vst/hosting/module.h>
#include <public.sdk/source/vst/hosting/hostclasses.h>
#include <public.sdk/source/vst/hosting/eventlist.h>
#include <public.sdk/source/vst/hosting/parameterchanges.h>
#include <public.sdk/source/vst/hosting/processdata.h>
#include <public.sdk/source/vst/utility/stringconvert.h>
#include "public.sdk/source/vst/utility/optional.h"
int main()
{
Steinberg::Vst::HostApplication pluginContext;
Steinberg::Vst::PluginContextFactory::instance().setPluginContext(&pluginContext);
std::string path = "/Library/Audio/Plug-Ins/VST3/Rysy.vst3";
std::string error;
VST3::Hosting::Module::Ptr module = VST3::Hosting::Module::create(path, error);
if (!module) {
std::cout << "failed to open vst: " << error << "\n";
return 1;
}
std::cout << "module->getName: " << module->getName() << std::endl;
std::cout << "module->getPath: " << module->getPath() << std::endl;
std::cout << std::endl;
auto factory = module->getFactory();
for(auto &checkModule : factory.classInfos()) {
std::cout << checkModule.category() << std::endl;
}
std::cout << factory.classInfos()[0].ID().toString() << std::endl;
std::cout << std::endl;
std::shared_ptr<Steinberg::Vst::PlugProvider> plugProvider;
VST3::Optional<VST3::UID> effectID;
for(auto &classInfo : factory.classInfos()) {
if(classInfo.category() == "Audio Module Class") {
if (effectID && *effectID != classInfo.ID()) {
continue;
}
plugProvider = std::shared_ptr<Steinberg::Vst::PlugProvider>(
new Steinberg::Vst::PlugProvider(factory, classInfo, true));
if(!plugProvider->initialize()) {
plugProvider = nullptr;
}
break;
}
}
auto controller = plugProvider->getController();
for (int i = 0; i < controller->getParameterCount(); i++) {
Steinberg::Vst::ParameterInfo paramInfo;
controller->getParameterInfo(i, paramInfo);
std::string str = VST3::StringConvert::convert(paramInfo.title);
std::cout << "p_Title: " << str << " ID: " << paramInfo.id << std::endl;
}
std::cout << std::endl;
return 0;
}