update vst to use new classes
this compiles but it's untested
This commit is contained in:
parent
d590355896
commit
67c23a98e8
1 changed files with 26 additions and 41 deletions
|
@ -2,14 +2,14 @@
|
|||
#include "public.sdk/source/vst2.x/audioeffectx.h"
|
||||
|
||||
//#INCLUDE
|
||||
//#REDEFINE
|
||||
|
||||
// VST 2.4 by standard only holds 8 (+ 1 null) length strings,
|
||||
// but this is never the case in practice. I've seen up to 24.
|
||||
#define MAX_PARAM_LEN 24
|
||||
|
||||
class plugin : public AudioEffectX
|
||||
struct plugin : public AudioEffectX
|
||||
{
|
||||
public:
|
||||
plugin(audioMasterCallback audioMaster);
|
||||
~plugin();
|
||||
|
||||
|
@ -29,22 +29,17 @@ public:
|
|||
bool getProductString(char *);
|
||||
//VstInt32 getVendorVersion();
|
||||
|
||||
#if (PARAMETERS > 0)
|
||||
void setParameter(VstInt32, float);
|
||||
float getParameter(VstInt32);
|
||||
void getParameterName(VstInt32, char *); // eg. Gain
|
||||
void getParameterDisplay(VstInt32, char *); // eg. -3.3
|
||||
void getParameterLabel(VstInt32, char *); // eg. dB
|
||||
#endif
|
||||
|
||||
private:
|
||||
char programName[kVstMaxProgNameLen];
|
||||
|
||||
#if (PARAMETERS > 0)
|
||||
param params[PARAMETERS];
|
||||
#endif
|
||||
Param params[CrapPlug::parameters];
|
||||
|
||||
personal data;
|
||||
CrapPlug crap;
|
||||
};
|
||||
|
||||
AudioEffect *
|
||||
|
@ -54,29 +49,25 @@ createEffectInstance(audioMasterCallback audioMaster)
|
|||
}
|
||||
|
||||
plugin::plugin(audioMasterCallback audioMaster)
|
||||
: AudioEffectX(audioMaster, 1, PARAMETERS)
|
||||
: AudioEffectX(audioMaster, 1, CrapPlug::parameters)
|
||||
{
|
||||
setNumInputs(2);
|
||||
setNumOutputs(2);
|
||||
setUniqueID(ID);
|
||||
setUniqueID(CrapPlug::id);
|
||||
canProcessReplacing();
|
||||
canDoubleReplacing();
|
||||
vst_strncpy(programName, "Init", kVstMaxProgNameLen);
|
||||
#if (PARAMETERS > 0)
|
||||
::construct_params(params);
|
||||
#endif
|
||||
::construct(&data);
|
||||
CrapPlug::construct_params(params);
|
||||
}
|
||||
|
||||
plugin::~plugin()
|
||||
{
|
||||
::destruct(&data);
|
||||
}
|
||||
|
||||
void
|
||||
plugin::resume()
|
||||
{
|
||||
::resume(&data);
|
||||
crap.resume();
|
||||
AudioEffectX::resume();
|
||||
}
|
||||
|
||||
|
@ -84,14 +75,14 @@ void
|
|||
plugin::suspend()
|
||||
{
|
||||
AudioEffectX::suspend();
|
||||
::pause(&data);
|
||||
crap.pause();
|
||||
}
|
||||
|
||||
void
|
||||
plugin::processReplacing(
|
||||
float **inputs, float **outputs, VstInt32 count)
|
||||
{
|
||||
::process(&data,
|
||||
crap.process(
|
||||
inputs[0], inputs[1],
|
||||
outputs[0], outputs[1],
|
||||
count);
|
||||
|
@ -101,7 +92,7 @@ void
|
|||
plugin::processDoubleReplacing(
|
||||
double **inputs, double **outputs, VstInt32 count)
|
||||
{
|
||||
::process(&data,
|
||||
crap.process(
|
||||
inputs[0], inputs[1],
|
||||
outputs[0], outputs[1],
|
||||
count);
|
||||
|
@ -117,11 +108,7 @@ void
|
|||
plugin::setSampleRate(float fs)
|
||||
{
|
||||
AudioEffectX::setSampleRate(fs);
|
||||
#if (PARAMETERS > 0)
|
||||
::adjust(&data, params, (unsigned long) fs);
|
||||
#else
|
||||
::adjust(&data, (unsigned long) fs);
|
||||
#endif
|
||||
crap.adjust(params, (unsigned long) fs);
|
||||
#ifdef DELAY
|
||||
setInitialDelay(global_delay);
|
||||
#endif
|
||||
|
@ -130,21 +117,21 @@ plugin::setSampleRate(float fs)
|
|||
bool
|
||||
plugin::getEffectName(char *name)
|
||||
{
|
||||
vst_strncpy(name, LABEL, kVstMaxEffectNameLen);
|
||||
vst_strncpy(name, CrapPlug::label, kVstMaxEffectNameLen);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
plugin::getProductString(char *text)
|
||||
{
|
||||
vst_strncpy(text, NAME, kVstMaxProductStrLen);
|
||||
vst_strncpy(text, CrapPlug::name, kVstMaxProductStrLen);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
plugin::getVendorString(char *text)
|
||||
{
|
||||
vst_strncpy(text, AUTHOR, kVstMaxVendorStrLen);
|
||||
vst_strncpy(text, CrapPlug::author, kVstMaxVendorStrLen);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -168,35 +155,34 @@ plugin::getProgramNameIndexed(VstInt32 category, VstInt32 index, char *text)
|
|||
return true;
|
||||
}
|
||||
|
||||
#if (PARAMETERS > 0)
|
||||
void
|
||||
plugin::setParameter(VstInt32 index, float value)
|
||||
{
|
||||
if (index >= PARAMETERS) return;
|
||||
param_set(¶ms[index], value);
|
||||
::adjust_one(&data, params, index);
|
||||
if (index >= CrapPlug::parameters) return;
|
||||
params[index].set(value);
|
||||
crap.adjust_one(params, index);
|
||||
}
|
||||
|
||||
float
|
||||
plugin::getParameter(VstInt32 index)
|
||||
{
|
||||
if (index >= PARAMETERS) return 0;
|
||||
return param_get(¶ms[index]);
|
||||
if (index >= CrapPlug::parameters) return 0;
|
||||
return params[index].get();
|
||||
}
|
||||
|
||||
void
|
||||
plugin::getParameterName(VstInt32 index, char *text)
|
||||
{
|
||||
if (index >= PARAMETERS) return;
|
||||
if (index >= CrapPlug::parameters) return;
|
||||
vst_strncpy(text, params[index].name, MAX_PARAM_LEN);
|
||||
}
|
||||
|
||||
void
|
||||
plugin::getParameterDisplay(VstInt32 index, char *text)
|
||||
{
|
||||
if (index >= PARAMETERS) return;
|
||||
if (index >= CrapPlug::parameters) return;
|
||||
|
||||
param *p = ¶ms[index];
|
||||
Param *p = ¶ms[index];
|
||||
char display[MAX_PARAM_LEN];
|
||||
|
||||
switch (p->scale) {
|
||||
|
@ -210,7 +196,7 @@ plugin::getParameterDisplay(VstInt32 index, char *text)
|
|||
sprintf(display, "%i", (int) p->value);
|
||||
break;
|
||||
case SCALE_TOGGLE:
|
||||
sprintf(display, (param_get(p) < 0.5) ? "off" : "on");
|
||||
sprintf(display, (p->get() < 0.5) ? "off" : "on");
|
||||
break;
|
||||
default:
|
||||
sprintf(display, "error");
|
||||
|
@ -222,9 +208,9 @@ plugin::getParameterDisplay(VstInt32 index, char *text)
|
|||
void
|
||||
plugin::getParameterLabel(VstInt32 index, char *text)
|
||||
{
|
||||
if (index >= PARAMETERS) return;
|
||||
if (index >= CrapPlug::parameters) return;
|
||||
|
||||
param *p = ¶ms[index];
|
||||
Param *p = ¶ms[index];
|
||||
char display[MAX_PARAM_LEN];
|
||||
|
||||
switch (p->scale) {
|
||||
|
@ -243,4 +229,3 @@ plugin::getParameterLabel(VstInt32 index, char *text)
|
|||
|
||||
vst_strncpy(text, display, MAX_PARAM_LEN);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue