Browse Source

Correct checks in the previous commit

Signed-off-by: falkTX <falktx@falktx.com>
pull/330/head
falkTX 4 years ago
parent
commit
96dcfa87d7
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 21 additions and 22 deletions
  1. +19
    -5
      distrho/src/DistrhoPlugin.cpp
  2. +2
    -17
      distrho/src/DistrhoPluginInternal.hpp

+ 19
- 5
distrho/src/DistrhoPlugin.cpp View File

@@ -44,28 +44,42 @@ Plugin::Plugin(uint32_t parameterCount, uint32_t programCount, uint32_t stateCou
pData->audioPorts = new AudioPort[DISTRHO_PLUGIN_NUM_INPUTS+DISTRHO_PLUGIN_NUM_OUTPUTS];
#endif

#ifdef DPF_ABORT_ON_ERROR
# define DPF_ABORT abort();
#else
# define DPF_ABORT
#endif

if (parameterCount > 0)
{
pData->parameterCount = parameterCount;
pData->parameters = new Parameter[parameterCount];
}

#if DISTRHO_PLUGIN_WANT_PROGRAMS
if (programCount > 0)
{
#if DISTRHO_PLUGIN_WANT_PROGRAMS
pData->programCount = programCount;
pData->programNames = new String[programCount];
}
#else
d_stderr2("DPF warning: Plugins with programs must define `DISTRHO_PLUGIN_WANT_PROGRAMS` to 1");
DPF_ABORT
#endif
}

#if DISTRHO_PLUGIN_WANT_STATE
if (stateCount > 0)
{
#if DISTRHO_PLUGIN_WANT_STATE
pData->stateCount = stateCount;
pData->stateKeys = new String[stateCount];
pData->stateDefValues = new String[stateCount];
}
#else
d_stderr2("DPF warning: Plugins with state must define `DISTRHO_PLUGIN_WANT_STATE` to 1");
DPF_ABORT
#endif
}

#undef DPF_ABORT
}

Plugin::~Plugin()
@@ -156,7 +170,7 @@ void Plugin::initState(uint32_t, String&, String&) {}
#endif

#if DISTRHO_PLUGIN_WANT_STATEFILES
bool Plugin::isStateFile(uint32_t index) { return false; }
bool Plugin::isStateFile(uint32_t) { return false; }
#endif

/* ------------------------------------------------------------------------------------------------------------


+ 2
- 17
distrho/src/DistrhoPluginInternal.hpp View File

@@ -288,12 +288,6 @@ public:
DPF_ABORT
}
}
# else
if (fData->programCount != 0)
{
d_stderr2("DPF warning: Plugins with programs must define `DISTRHO_PLUGIN_WANT_PROGRAMS` to 1");
DPF_ABORT
}
# endif

# if DISTRHO_PLUGIN_WANT_STATE
@@ -311,12 +305,6 @@ public:
DPF_ABORT
}
}
# else
if (fData->stateCount != 0)
{
d_stderr2("DPF warning: Plugins with state must define `DISTRHO_PLUGIN_WANT_STATE` to 1");
DPF_ABORT
}
# endif

# if DISTRHO_PLUGIN_WANT_FULL_STATE
@@ -330,11 +318,8 @@ public:
}
else
{
if (fData->stateCount == 0)
{
d_stderr2("DPF warning: Plugins with full state must have at least 1 state");
DPF_ABORT
}
d_stderr2("DPF warning: Plugins with full state must have at least 1 state");
DPF_ABORT
}
# endif



Loading…
Cancel
Save