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