Show VST parameter string (#5321)

This commit is contained in:
Ibuki authored and GitHub committed 2020-05-17 11:15:39 +09:00
1 parent 953a0b17c1
commit 1e8fcbdf2d
13 files changed
+232 -11

No files matched your search

+57
View File
@@ -70,6 +70,8 @@
#include <queue>
#include <string>
#include <iostream>
#include <string>
#include <cstring>
#include <aeffectx.h>
@@ -223,6 +225,10 @@ public:
// determine name of current program
const char * programName();
void getParameterDisplays();
void getParameterLabels();
// send name of current program back to host
void sendCurrentProgramName();
@@ -660,6 +666,14 @@ bool RemoteVstPlugin::processMessage( const message & _m )
//sendMessage( IdVstSetParameter );
break;
case IdVstParameterDisplays:
getParameterDisplays();
break;
case IdVstParameterLabels:
getParameterLabels();
break;
case IdVstIdleUpdate:
{
@@ -1068,6 +1082,49 @@ const char * RemoteVstPlugin::programName()
// join the ParameterDisplays (stringified values without units) and send them to host
void RemoteVstPlugin::getParameterDisplays()
{
std::string paramDisplays;
static char buf[9]; // buffer for getting string
for (int i=0; i< m_plugin->numParams; ++i)
{
memset( buf, 0, sizeof( buf ) ); // fill with '\0' because got string may not to be ended with '\0'
pluginDispatch( effGetParamDisplay, i, 0, buf );
buf[8] = 0;
// each field shaped like: [length:number][content:string]
paramDisplays += '0' + strlen(buf); // add length descriptor (length is up to 8)
paramDisplays += buf;
}
sendMessage( message( IdVstParameterDisplays ).addString( paramDisplays.c_str() ) );
}
// join the ParameterLabels (units) and send them to host
void RemoteVstPlugin::getParameterLabels()
{
std::string paramLabels;
static char buf[9]; // buffer for getting string
for (int i=0; i< m_plugin->numParams; ++i)
{
memset( buf, 0, sizeof( buf ) ); // fill with '\0' because got string may not to be ended with '\0'
pluginDispatch( effGetParamLabel, i, 0, buf );
buf[8] = 0;
// each field shaped like: [length:number][content:string]
paramLabels += '0' + strlen(buf); // add length descriptor (length is up to 8)
paramLabels += buf;
}
sendMessage( message( IdVstParameterLabels ).addString( paramLabels.c_str() ) );
}
void RemoteVstPlugin::sendCurrentProgramName()
{
char presName[64];