Browse Source

Cleanup some AU details, ensure "aumu" has dual IO

Signed-off-by: falkTX <falktx@falktx.com>
pull/452/head
falkTX 2 years ago
parent
commit
3af2221b4c
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 110 additions and 78 deletions
  1. +69
    -40
      distrho/src/DistrhoPluginAU.cpp
  2. +41
    -38
      distrho/src/DistrhoPluginChecks.h

+ 69
- 40
distrho/src/DistrhoPluginAU.cpp View File

@@ -218,18 +218,24 @@ typedef std::vector<RenderListener> RenderListeners;

// --------------------------------------------------------------------------------------------------------------------

#if DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS == 0
# define DPF_AU_NUM_BUFFERS 1
#elif DISTRHO_PLUGIN_NUM_INPUTS > DISTRHO_PLUGIN_NUM_OUTPUTS
# define DPF_AU_NUM_BUFFERS DISTRHO_PLUGIN_NUM_INPUTS
#if DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS != 0
# if DISTRHO_PLUGIN_NUM_INPUTS > DISTRHO_PLUGIN_NUM_OUTPUTS
# define DPF_AU_NUM_BUFFERS DISTRHO_PLUGIN_NUM_INPUTS
# else
# define DPF_AU_NUM_BUFFERS DISTRHO_PLUGIN_NUM_OUTPUTS
# endif
#else
# define DPF_AU_NUM_BUFFERS DISTRHO_PLUGIN_NUM_OUTPUTS
# define DPF_AU_NUM_BUFFERS 0
#endif

#if DPF_AU_NUM_BUFFERS != 0
typedef struct {
UInt32 mNumberBuffers;
AudioBuffer mBuffers[DPF_AU_NUM_BUFFERS];
} d_AudioBufferList;
#endif

// --------------------------------------------------------------------------------------------------------------------

typedef struct {
UInt32 numPackets;
@@ -264,12 +270,11 @@ public:
fLastRenderError(noErr),
fPropertyListeners(),
fRenderListeners(),
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
fSampleRateForInput(d_nextSampleRate),
#endif
#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
fSampleRateForOutput(d_nextSampleRate),
#endif
#if DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS == 0
fHasWorkingAudio(false),
#endif
fUsingRenderListeners(false),
fParameterCount(fPlugin.getParameterCount()),
@@ -304,10 +309,13 @@ public:
}
}

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
std::memset(&fInputRenderCallback, 0, sizeof(fInputRenderCallback));
fInputRenderCallback.inputProc = nullptr;
fInputRenderCallback.inputProcRefCon = nullptr;
#endif

#if DPF_AU_NUM_BUFFERS != 0
fAudioBufferList.mNumberBuffers = DPF_AU_NUM_BUFFERS;

for (uint16_t i=0; i<DPF_AU_NUM_BUFFERS; ++i)
@@ -316,6 +324,7 @@ public:
fAudioBufferList.mBuffers[i].mData = new float[bufferSize];
fAudioBufferList.mBuffers[i].mDataByteSize = sizeof(float) * bufferSize;
}
#endif

#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
std::memset(&fMidiEvents, 0, sizeof(fMidiEvents));
@@ -376,8 +385,10 @@ public:
delete[] fLastParameterValues;
CFRelease(fUserPresetData.presetName);

#if DPF_AU_NUM_BUFFERS != 0
for (uint16_t i=0; i<DPF_AU_NUM_BUFFERS; ++i)
delete[] static_cast<float*>(fAudioBufferList.mBuffers[i].mData);
#endif

#if DISTRHO_PLUGIN_WANT_PROGRAMS
for (uint32_t i=0; i<fProgramCount; ++i)
@@ -432,12 +443,14 @@ public:

case kAudioUnitProperty_SampleRate:
DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement);
if (inScope == kAudioUnitScope_Input)
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
if (inScope == kAudioUnitScope_Input && 0)
{
outDataSize = sizeof(Float64);
outWritable = true;
return noErr;
}
#endif
#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
if (inScope == kAudioUnitScope_Output)
{
@@ -471,12 +484,14 @@ public:

case kAudioUnitProperty_StreamFormat:
DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement);
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
if (inScope == kAudioUnitScope_Input)
{
outDataSize = sizeof(AudioStreamBasicDescription);
outWritable = true;
return noErr;
}
#endif
#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
if (inScope == kAudioUnitScope_Output)
{
@@ -539,9 +554,13 @@ public:
case kAudioUnitProperty_SetRenderCallback:
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input, inScope, kAudioUnitErr_InvalidScope);
DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement);
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
outDataSize = sizeof(AURenderCallbackStruct);
outWritable = true;
return noErr;
#else
return kAudioUnitErr_InvalidProperty;
#endif

case kAudioUnitProperty_FactoryPresets:
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope);
@@ -568,9 +587,13 @@ public:
case kAudioUnitProperty_InPlaceProcessing:
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope);
DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement);
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
outDataSize = sizeof(UInt32);
outWritable = false;
return noErr;
#else
return kAudioUnitErr_InvalidProperty;
#endif

case kAudioUnitProperty_PresentPreset:
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope);
@@ -716,11 +739,13 @@ public:
return noErr;

case kAudioUnitProperty_SampleRate:
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
if (inScope == kAudioUnitScope_Input)
{
*static_cast<Float64*>(outData) = fSampleRateForInput;
}
else
#endif
#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
if (inScope == kAudioUnitScope_Output)
{
@@ -825,11 +850,13 @@ public:
if (inElement != 0)
return kAudioUnitErr_InvalidElement;

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
if (inScope == kAudioUnitScope_Input)
{
desc->mChannelsPerFrame = DISTRHO_PLUGIN_NUM_INPUTS;
}
else
#endif
#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
if (inScope == kAudioUnitScope_Output)
{
@@ -858,8 +885,7 @@ public:
*static_cast<UInt32*>(outData) = 1;
break;
case kAudioUnitScope_Input:
// FIXME seems to be mandatory for Logic Pro
*static_cast<UInt32*>(outData) = 1; // DISTRHO_PLUGIN_NUM_INPUTS != 0 ? 1 : 0;
*static_cast<UInt32*>(outData) = DISTRHO_PLUGIN_NUM_INPUTS != 0 ? 1 : 0;
break;
case kAudioUnitScope_Output:
*static_cast<UInt32*>(outData) = DISTRHO_PLUGIN_NUM_OUTPUTS != 0 ? 1 : 0;
@@ -893,9 +919,11 @@ public:
*static_cast<OSStatus*>(outData) = fPlugin.getParameterValue(fBypassParameterIndex) > 0.5f ? 1 : 0;
return noErr;

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
case kAudioUnitProperty_SetRenderCallback:
std::memcpy(outData, &fInputRenderCallback, sizeof(AURenderCallbackStruct));
return noErr;
#endif

#if DISTRHO_PLUGIN_WANT_PROGRAMS
case kAudioUnitProperty_FactoryPresets:
@@ -916,9 +944,11 @@ public:
return noErr;
#endif

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
case kAudioUnitProperty_InPlaceProcessing:
*static_cast<UInt32*>(outData) = 1;
return noErr;
#endif

case kAudioUnitProperty_PresentPreset:
#if DISTRHO_PLUGIN_WANT_PROGRAMS
@@ -1069,8 +1099,10 @@ public:
return noErr;

case kAudioUnitProperty_SampleRate:
#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
#if DISTRHO_PLUGIN_NUM_INPUTS != 0 && DISTRHO_PLUGIN_NUM_OUTPUTS != 0
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input || inScope == kAudioUnitScope_Output, inScope, kAudioUnitErr_InvalidScope);
#elif DISTRHO_PLUGIN_NUM_OUTPUTS != 0
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Output, inScope, kAudioUnitErr_InvalidScope);
#else
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input, inScope, kAudioUnitErr_InvalidScope);
#endif
@@ -1079,6 +1111,7 @@ public:
{
const Float64 sampleRate = *static_cast<const Float64*>(inData);

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
if (inScope == kAudioUnitScope_Input)
{
if (d_isNotEqual(fSampleRateForInput, sampleRate))
@@ -1097,6 +1130,7 @@ public:
}
return noErr;
}
#endif

#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
if (inScope == kAudioUnitScope_Output)
@@ -1106,7 +1140,9 @@ public:
fSampleRateForOutput = sampleRate;
d_nextSampleRate = sampleRate;

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
if (d_isEqual(fSampleRateForInput, sampleRate))
#endif
{
fPlugin.setSampleRate(sampleRate, true);
}
@@ -1120,8 +1156,10 @@ public:
return kAudioUnitErr_InvalidScope;

case kAudioUnitProperty_StreamFormat:
#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
#if DISTRHO_PLUGIN_NUM_INPUTS != 0 && DISTRHO_PLUGIN_NUM_OUTPUTS != 0
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input || inScope == kAudioUnitScope_Output, inScope, kAudioUnitErr_InvalidScope);
#elif DISTRHO_PLUGIN_NUM_OUTPUTS != 0
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Output, inScope, kAudioUnitErr_InvalidScope);
#else
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input, inScope, kAudioUnitErr_InvalidScope);
#endif
@@ -1140,20 +1178,13 @@ public:
return kAudioUnitErr_FormatNotSupported;
if (desc->mFramesPerPacket != 1)
return kAudioUnitErr_FormatNotSupported;

#if 1
// dont allow interleaved data
if (desc->mFormatFlags != (kAudioFormatFlagsNativeFloatPacked|kAudioFormatFlagIsNonInterleaved))
#else
// allow interleaved data
if ((desc->mFormatFlags & ~kAudioFormatFlagIsNonInterleaved) != kAudioFormatFlagsNativeFloatPacked)
#endif
return kAudioUnitErr_FormatNotSupported;

if (desc->mChannelsPerFrame != (inScope == kAudioUnitScope_Input ? DISTRHO_PLUGIN_NUM_INPUTS
: DISTRHO_PLUGIN_NUM_OUTPUTS))
return kAudioUnitErr_FormatNotSupported;

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
if (inScope == kAudioUnitScope_Input)
{
if (d_isNotEqual(fSampleRateForInput, desc->mSampleRate))
@@ -1170,11 +1201,9 @@ public:
notifyPropertyListeners(inProp, inScope, inElement);
notifyPropertyListeners(kAudioUnitProperty_SampleRate, inScope, inElement);
}
#if DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS == 0
fHasWorkingAudio = true;
#endif
return noErr;
}
#endif

#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
if (inScope == kAudioUnitScope_Output)
@@ -1183,7 +1212,9 @@ public:
{
fSampleRateForOutput = desc->mSampleRate;

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
if (d_isEqual(fSampleRateForInput, desc->mSampleRate))
#endif
{
fPlugin.setSampleRate(desc->mSampleRate, true);
}
@@ -1208,7 +1239,7 @@ public:
{
notifyPropertyListeners(inProp, inScope, inElement);

#if DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS != 0
#if DPF_AU_NUM_BUFFERS != 0
for (uint16_t i=0; i<DPF_AU_NUM_BUFFERS; ++i)
{
delete[] static_cast<float*>(fAudioBufferList.mBuffers[i].mData);
@@ -1238,12 +1269,14 @@ public:
}
return noErr;

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
case kAudioUnitProperty_SetRenderCallback:
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input, inScope, kAudioUnitErr_InvalidScope);
DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement);
DISTRHO_SAFE_ASSERT_UINT_RETURN(inDataSize == sizeof(AURenderCallbackStruct), inDataSize, kAudioUnitErr_InvalidPropertyValue);
std::memcpy(&fInputRenderCallback, inData, sizeof(AURenderCallbackStruct));
return noErr;
#endif

case kAudioUnitProperty_HostCallbacks:
DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope);
@@ -1622,6 +1655,7 @@ public:
return kAudioUnitErr_TooManyFramesToProcess;
}

#if DPF_AU_NUM_BUFFERS != 0
for (uint16_t i=0; i<DPF_AU_NUM_BUFFERS; ++i)
{
if (ioData->mBuffers[i].mDataByteSize != sizeof(float) * inFramesToProcess)
@@ -1630,6 +1664,7 @@ public:
return kAudio_ParamError;
}
}
#endif
}

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
@@ -1644,6 +1679,7 @@ public:
constexpr float** outputs = nullptr;
#endif

#if DISTRHO_PLUGIN_NUM_INPUTS != 0
if (fInputRenderCallback.inputProc != nullptr)
{
bool adjustDataByteSize, usingHostBuffer = true;
@@ -1697,10 +1733,8 @@ public:

if (usingHostBuffer)
{
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
for (uint16_t i=0; i<DISTRHO_PLUGIN_NUM_INPUTS; ++i)
inputs[i] = static_cast<const float*>(ioData->mBuffers[i].mData);
#endif

#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
for (uint16_t i=0; i<DISTRHO_PLUGIN_NUM_OUTPUTS; ++i)
@@ -1710,10 +1744,8 @@ public:
}
else
{
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
for (uint16_t i=0; i<DISTRHO_PLUGIN_NUM_INPUTS; ++i)
inputs[i] = static_cast<const float*>(fAudioBufferList.mBuffers[i].mData);
#endif

#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
for (uint16_t i=0; i<DISTRHO_PLUGIN_NUM_OUTPUTS; ++i)
@@ -1722,12 +1754,16 @@ public:
}
}
else
#endif
{
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
for (uint16_t i=0; i<DISTRHO_PLUGIN_NUM_INPUTS; ++i)
{
if (ioData->mBuffers[i].mData == nullptr)
{
ioData->mBuffers[i].mData = fAudioBufferList.mBuffers[i].mData;
std::memset(ioData->mBuffers[i].mData, 0, sizeof(float) * inFramesToProcess);
}

inputs[i] = static_cast<const float*>(ioData->mBuffers[i].mData);
}
@@ -1797,8 +1833,7 @@ public:

#if DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS == 0
// handle case of plugin having no working audio, simulate audio-side processing
if (! fHasWorkingAudio)
run(nullptr, nullptr, std::max(1u, inOffsetSampleFrame), nullptr);
run(nullptr, nullptr, std::max(1u, inOffsetSampleFrame), nullptr);
#endif

return noErr;
@@ -1826,8 +1861,7 @@ public:

#if DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS == 0
// handle case of plugin having no working audio, simulate audio-side processing
if (! fHasWorkingAudio)
run(nullptr, nullptr, 1, nullptr);
run(nullptr, nullptr, 1, nullptr);
#endif

return noErr;
@@ -1846,15 +1880,14 @@ private:
OSStatus fLastRenderError;
PropertyListeners fPropertyListeners;
RenderListeners fRenderListeners;
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
AURenderCallbackStruct fInputRenderCallback;
Float64 fSampleRateForInput;
#endif
#if DISTRHO_PLUGIN_NUM_OUTPUTS != 0
Float64 fSampleRateForOutput;
#endif
d_AudioBufferList fAudioBufferList;
#if DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS == 0
bool fHasWorkingAudio;
#endif
bool fUsingRenderListeners;

// Caching
@@ -2013,10 +2046,6 @@ private:

fPlugin.setTimePosition(fTimePosition);
}
else
{
d_stdout("no time");
}
#endif

#if DISTRHO_PLUGIN_WANT_MIDI_INPUT


+ 41
- 38
distrho/src/DistrhoPluginChecks.h View File

@@ -42,25 +42,6 @@
# error DISTRHO_PLUGIN_URI undefined!
#endif

// --------------------------------------------------------------------------------------------------------------------
// Check that symbol macros are well defined

#ifdef DISTRHO_PROPER_CPP11_SUPPORT

#ifdef DISTRHO_PLUGIN_AU_TYPE
static_assert(sizeof(STRINGIFY(DISTRHO_PLUGIN_AU_TYPE)) == 5, "The macro DISTRHO_PLUGIN_AU_TYPE has incorrect length");
#endif

#ifdef DISTRHO_PLUGIN_BRAND_ID
static_assert(sizeof(STRINGIFY(DISTRHO_PLUGIN_BRAND_ID)) == 5, "The macro DISTRHO_PLUGIN_BRAND_ID has incorrect length");
#endif

#ifdef DISTRHO_PLUGIN_UNIQUE_ID
static_assert(sizeof(STRINGIFY(DISTRHO_PLUGIN_UNIQUE_ID)) == 5, "The macro DISTRHO_PLUGIN_UNIQUE_ID has incorrect length");
#endif

#endif

// --------------------------------------------------------------------------------------------------------------------
// Define optional macros if not done yet

@@ -129,25 +110,6 @@ static_assert(sizeof(STRINGIFY(DISTRHO_PLUGIN_UNIQUE_ID)) == 5, "The macro DISTR
# define DISTRHO_UI_USE_NANOVG 0
#endif

// --------------------------------------------------------------------------------------------------------------------
// Define DISTRHO_PLUGIN_AU_TYPE if needed

#ifndef DISTRHO_PLUGIN_AU_TYPE
# if DISTRHO_PLUGIN_IS_SYNTH
# define DISTRHO_PLUGIN_AU_TYPE aumu /* kAudioUnitType_MusicDevice */
# elif (DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_MIDI_OUTPUT) && DISTRHO_PLUGIN_NUM_INPUTS != 0 && DISTRHO_PLUGIN_NUM_OUTPUTS != 0
# define DISTRHO_PLUGIN_AU_TYPE aumf /* kAudioUnitType_MusicEffect */
# elif (DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_MIDI_OUTPUT) && DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS != 0
# define DISTRHO_PLUGIN_AU_TYPE aumu /* kAudioUnitType_MusicDevice */
# elif DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
# define DISTRHO_PLUGIN_AU_TYPE aumi /* kAudioUnitType_MIDIProcessor */
# elif DISTRHO_PLUGIN_NUM_INPUTS == 0 && DISTRHO_PLUGIN_NUM_OUTPUTS != 0
# define DISTRHO_PLUGIN_AU_TYPE augn /* kAudioUnitType_Generator */
# else
# define DISTRHO_PLUGIN_AU_TYPE aufx /* kAudioUnitType_Effect */
# endif
#endif

// --------------------------------------------------------------------------------------------------------------------
// Define DISTRHO_PLUGIN_HAS_EMBED_UI if needed

@@ -247,6 +209,47 @@ static_assert(sizeof(STRINGIFY(DISTRHO_PLUGIN_UNIQUE_ID)) == 5, "The macro DISTR
# define DISTRHO_UI_USE_CUSTOM 0
#endif

// --------------------------------------------------------------------------------------------------------------------
// Define DISTRHO_PLUGIN_AU_TYPE if needed

#ifndef DISTRHO_PLUGIN_AU_TYPE
# if (DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_MIDI_OUTPUT) && DISTRHO_PLUGIN_NUM_INPUTS != 0 && DISTRHO_PLUGIN_NUM_OUTPUTS != 0
# define DISTRHO_PLUGIN_AU_TYPE aumf /* kAudioUnitType_MusicEffect */
# elif (DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_MIDI_OUTPUT) && DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS != 0
# define DISTRHO_PLUGIN_AU_TYPE aumu /* kAudioUnitType_MusicDevice */
# elif DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
# define DISTRHO_PLUGIN_AU_TYPE aumi /* kAudioUnitType_MIDIProcessor */
# elif DISTRHO_PLUGIN_NUM_INPUTS == 0 && DISTRHO_PLUGIN_NUM_OUTPUTS != 0
# define DISTRHO_PLUGIN_AU_TYPE augn /* kAudioUnitType_Generator */
# else
# define DISTRHO_PLUGIN_AU_TYPE aufx /* kAudioUnitType_Effect */
# endif
#endif

// --------------------------------------------------------------------------------------------------------------------
// Check that symbol macros are well defined

#ifdef DISTRHO_PROPER_CPP11_SUPPORT

#ifdef DISTRHO_PLUGIN_AU_TYPE
static_assert(sizeof(STRINGIFY(DISTRHO_PLUGIN_AU_TYPE)) == 5, "The macro DISTRHO_PLUGIN_AU_TYPE has incorrect length");
# if DISTRHO_PLUGIN_NUM_INPUTS == 0 || DISTRHO_PLUGIN_NUM_OUTPUTS == 0
static constexpr const char _aut[5] = STRINGIFY(DISTRHO_PLUGIN_AU_TYPE);
static_assert(_aut[0] != 'a' || _aut[0] != 'u' || _aut[0] != 'm' || _aut[0] != 'u',
"The 'aumu' type requires both audio input and output");
# endif
#endif

#ifdef DISTRHO_PLUGIN_BRAND_ID
static_assert(sizeof(STRINGIFY(DISTRHO_PLUGIN_BRAND_ID)) == 5, "The macro DISTRHO_PLUGIN_BRAND_ID has incorrect length");
#endif

#ifdef DISTRHO_PLUGIN_UNIQUE_ID
static_assert(sizeof(STRINGIFY(DISTRHO_PLUGIN_UNIQUE_ID)) == 5, "The macro DISTRHO_PLUGIN_UNIQUE_ID has incorrect length");
#endif

#endif

// --------------------------------------------------------------------------------------------------------------------
// Prevent users from messing about with DPF internals



Loading…
Cancel
Save