mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-05 22:28:57 +02:00
More version checks for opcodes added at or above VST 2
This commit is contained in:
parent
6a95aae8b3
commit
7414b000c2
@ -1697,10 +1697,13 @@ wxArrayString VSTEffect::GetFactoryPresets()
|
|||||||
// Some plugins, like Guitar Rig 5, only report 128 programs while they have hundreds. While
|
// Some plugins, like Guitar Rig 5, only report 128 programs while they have hundreds. While
|
||||||
// I was able to come up with a hack in the Guitar Rig case to gather all of the program names
|
// I was able to come up with a hack in the Guitar Rig case to gather all of the program names
|
||||||
// it would not let me set a program outside of the first 128.
|
// it would not let me set a program outside of the first 128.
|
||||||
|
if (mVstVersion >= 2)
|
||||||
|
{
|
||||||
for (int i = 0; i < mAEffect->numPrograms; i++)
|
for (int i = 0; i < mAEffect->numPrograms; i++)
|
||||||
{
|
{
|
||||||
progs.Add(GetString(effGetProgramNameIndexed, i));
|
progs.Add(GetString(effGetProgramNameIndexed, i));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return progs;
|
return progs;
|
||||||
}
|
}
|
||||||
@ -2192,19 +2195,26 @@ bool VSTEffect::Load()
|
|||||||
if (mAEffect->magic == kEffectMagic &&
|
if (mAEffect->magic == kEffectMagic &&
|
||||||
!(mAEffect->flags & effFlagsIsSynth) &&
|
!(mAEffect->flags & effFlagsIsSynth) &&
|
||||||
mAEffect->flags & effFlagsCanReplacing)
|
mAEffect->flags & effFlagsCanReplacing)
|
||||||
|
{
|
||||||
|
if (mVstVersion >= 2)
|
||||||
{
|
{
|
||||||
mName = GetString(effGetEffectName);
|
mName = GetString(effGetEffectName);
|
||||||
if (mName.length() == 0)
|
if (mName.length() == 0)
|
||||||
{
|
{
|
||||||
mName = GetString(effGetProductString);
|
mName = GetString(effGetProductString);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (mName.length() == 0)
|
if (mName.length() == 0)
|
||||||
{
|
{
|
||||||
wxFileName f(realPath);
|
wxFileName f(realPath);
|
||||||
mName = f.GetName();
|
mName = f.GetName();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (mVstVersion >= 2)
|
||||||
|
{
|
||||||
mVendor = GetString(effGetVendorString);
|
mVendor = GetString(effGetVendorString);
|
||||||
mVersion = wxINT32_SWAP_ON_LE(callDispatcher(effGetVendorVersion, 0, 0, NULL, 0));
|
mVersion = wxINT32_SWAP_ON_LE(callDispatcher(effGetVendorVersion, 0, 0, NULL, 0));
|
||||||
|
}
|
||||||
if (mVersion == 0)
|
if (mVersion == 0)
|
||||||
{
|
{
|
||||||
mVersion = wxINT32_SWAP_ON_LE(mAEffect->version);
|
mVersion = wxINT32_SWAP_ON_LE(mAEffect->version);
|
||||||
@ -2314,7 +2324,7 @@ wxArrayInt VSTEffect::GetEffectIDs()
|
|||||||
wxArrayInt effectIDs;
|
wxArrayInt effectIDs;
|
||||||
|
|
||||||
// Are we a shell?
|
// Are we a shell?
|
||||||
if ((VstPlugCategory) callDispatcher(effGetPlugCategory, 0, 0, NULL, 0) == kPlugCategShell)
|
if (mVstVersion >= 2 && (VstPlugCategory) callDispatcher(effGetPlugCategory, 0, 0, NULL, 0) == kPlugCategShell)
|
||||||
{
|
{
|
||||||
char name[64];
|
char name[64];
|
||||||
int effectID;
|
int effectID;
|
||||||
@ -2419,7 +2429,7 @@ void VSTEffect::OnTimer()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWantsIdle)
|
if (mVstVersion >= 2 && mWantsIdle)
|
||||||
{
|
{
|
||||||
int ret = callDispatcher(effIdle, 0, 0, NULL, 0.0);
|
int ret = callDispatcher(effIdle, 0, 0, NULL, 0.0);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
@ -2470,7 +2480,10 @@ void VSTEffect::PowerOn()
|
|||||||
callDispatcher(effMainsChanged, 0, 1, NULL, 0.0);
|
callDispatcher(effMainsChanged, 0, 1, NULL, 0.0);
|
||||||
|
|
||||||
// Tell the effect we're going to start processing
|
// Tell the effect we're going to start processing
|
||||||
|
if (mVstVersion >= 2)
|
||||||
|
{
|
||||||
callDispatcher(effStartProcess, 0, 0, NULL, 0.0);
|
callDispatcher(effStartProcess, 0, 0, NULL, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
// Set state
|
// Set state
|
||||||
mHasPower = true;
|
mHasPower = true;
|
||||||
@ -2482,7 +2495,10 @@ void VSTEffect::PowerOff()
|
|||||||
if (mHasPower)
|
if (mHasPower)
|
||||||
{
|
{
|
||||||
// Tell the effect we're going to stop processing
|
// Tell the effect we're going to stop processing
|
||||||
|
if (mVstVersion >= 2)
|
||||||
|
{
|
||||||
callDispatcher(effStopProcess, 0, 0, NULL, 0.0);
|
callDispatcher(effStopProcess, 0, 0, NULL, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
// Turn the power off
|
// Turn the power off
|
||||||
callDispatcher(effMainsChanged, 0, 0, NULL, 0.0);
|
callDispatcher(effMainsChanged, 0, 0, NULL, 0.0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user