Skip to content

Commit

Permalink
BREAKING: PLUG_DOES_MIDI -> PLUG_DOES_MIDI_IN & PLUG_DOES_MIDI_OUT
Browse files Browse the repository at this point in the history
  • Loading branch information
olilarkin committed Dec 14, 2018
1 parent f9a185f commit 2e5d868
Show file tree
Hide file tree
Showing 29 changed files with 71 additions and 55 deletions.
2 changes: 1 addition & 1 deletion Examples/IPlugControls/scripts/prepare_resources-ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main():
COMPONENT_TYPE = kAudioUnitType_MusicDevice
elif config['PLUG_IS_MFX']:
COMPONENT_TYPE = kAudioUnitType_MIDIProcessor
elif config['PLUG_DOES_MIDI']:
elif config['PLUG_DOES_MIDI_IN']:
COMPONENT_TYPE = kAudioUnitType_MusicEffect
else:
COMPONENT_TYPE = kAudioUnitType_Effect
Expand Down
2 changes: 1 addition & 1 deletion Examples/IPlugControls/scripts/prepare_resources-mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def main():
COMPONENT_TYPE = kAudioUnitType_MusicDevice
elif config['PLUG_IS_MFX']:
COMPONENT_TYPE = kAudioUnitType_MIDIProcessor
elif config['PLUG_DOES_MIDI']:
elif config['PLUG_DOES_MIDI_IN']:
COMPONENT_TYPE = kAudioUnitType_MusicEffect
else:
COMPONENT_TYPE = kAudioUnitType_Effect
Expand Down
4 changes: 2 additions & 2 deletions Examples/IPlugControls/scripts/validate_audiounit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ PMID=${PMID//\'}
PII=`echo | grep PLUG_IS_INST ../config.h`
PII=${PII//\#define PLUG_IS_INST }

PDM=`echo | grep PLUG_DOES_MIDI ../config.h`
PDM=${PDM//\#define PLUG_DOES_MIDI }
PDM=`echo | grep PLUG_DOES_MIDI_IN ../config.h`
PDM=${PDM//\#define PLUG_DOES_MIDI_IN }

TYPE=aufx

Expand Down
3 changes: 2 additions & 1 deletion Examples/IPlugEffect/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#define PLUG_LATENCY 0
#define PLUG_IS_INSTRUMENT 0
#define PLUG_IS_MFX 0
#define PLUG_DOES_MIDI 1
#define PLUG_DOES_MIDI_IN 1
#define PLUG_DOES_MIDI_OUT 0
#define PLUG_DOES_STATE_CHUNKS 0
#define PLUG_HAS_UI 1
#define PLUG_WIDTH 600
Expand Down
2 changes: 1 addition & 1 deletion Examples/IPlugEffect/config/IPlugEffect-mac.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ EXTRA_PLUGIN_DEFS = //SWELL_NO_POSTMESSAGE
//------------------------------
// PREPROCESSOR MACROS

EXTRA_ALL_DEFS = OBJC_PREFIX=vIPlugEffect SWELL_APP_PREFIX=Swell_vIPlugEffect IGRAPHICS_NANOVG IGRAPHICS_GL2
EXTRA_ALL_DEFS = OBJC_PREFIX=vIPlugEffect SWELL_APP_PREFIX=Swell_vIPlugEffect IGRAPHICS_NANOVG IGRAPHICS_METAL
//EXTRA_DEBUG_DEFS =
//EXTRA_RELEASE_DEFS =
//EXTRA_TRACER_DEFS =
Expand Down
2 changes: 1 addition & 1 deletion Examples/IPlugEffect/scripts/prepare_resources-ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main():
COMPONENT_TYPE = kAudioUnitType_MusicDevice
elif config['PLUG_IS_MFX']:
COMPONENT_TYPE = kAudioUnitType_MIDIProcessor
elif config['PLUG_DOES_MIDI']:
elif config['PLUG_DOES_MIDI_IN']:
COMPONENT_TYPE = kAudioUnitType_MusicEffect
else:
COMPONENT_TYPE = kAudioUnitType_Effect
Expand Down
2 changes: 1 addition & 1 deletion Examples/IPlugEffect/scripts/prepare_resources-mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def main():
COMPONENT_TYPE = kAudioUnitType_MusicDevice
elif config['PLUG_IS_MFX']:
COMPONENT_TYPE = kAudioUnitType_MIDIProcessor
elif config['PLUG_DOES_MIDI']:
elif config['PLUG_DOES_MIDI_IN']:
COMPONENT_TYPE = kAudioUnitType_MusicEffect
else:
COMPONENT_TYPE = kAudioUnitType_Effect
Expand Down
4 changes: 2 additions & 2 deletions Examples/IPlugEffect/scripts/validate_audiounit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ PMID=${PMID//\'}
PII=`echo | grep PLUG_IS_INST ../config.h`
PII=${PII//\#define PLUG_IS_INST }

PDM=`echo | grep PLUG_DOES_MIDI ../config.h`
PDM=${PDM//\#define PLUG_DOES_MIDI }
PDM=`echo | grep PLUG_DOES_MIDI_IN ../config.h`
PDM=${PDM//\#define PLUG_DOES_MIDI_IN }

TYPE=aufx

Expand Down
3 changes: 2 additions & 1 deletion Examples/IPlugFaustDSP/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#define PLUG_LATENCY 0
#define PLUG_IS_INSTRUMENT 0
#define PLUG_IS_MFX 0
#define PLUG_DOES_MIDI 1
#define PLUG_DOES_MIDI_IN 1
#define PLUG_DOES_MIDI_OUT 0
#define PLUG_DOES_STATE_CHUNKS 0
#define PLUG_HAS_UI 1
#define PLUG_WIDTH 600
Expand Down
2 changes: 1 addition & 1 deletion Examples/IPlugFaustDSP/scripts/prepare_resources-ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main():
COMPONENT_TYPE = kAudioUnitType_MusicDevice
elif config['PLUG_IS_MFX']:
COMPONENT_TYPE = kAudioUnitType_MIDIProcessor
elif config['PLUG_DOES_MIDI']:
elif config['PLUG_DOES_MIDI_IN']:
COMPONENT_TYPE = kAudioUnitType_MusicEffect
else:
COMPONENT_TYPE = kAudioUnitType_Effect
Expand Down
2 changes: 1 addition & 1 deletion Examples/IPlugFaustDSP/scripts/prepare_resources-mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def main():
COMPONENT_TYPE = kAudioUnitType_MusicDevice
elif config['PLUG_IS_MFX']:
COMPONENT_TYPE = kAudioUnitType_MIDIProcessor
elif config['PLUG_DOES_MIDI']:
elif config['PLUG_DOES_MIDI_IN']:
COMPONENT_TYPE = kAudioUnitType_MusicEffect
else:
COMPONENT_TYPE = kAudioUnitType_Effect
Expand Down
4 changes: 2 additions & 2 deletions Examples/IPlugFaustDSP/scripts/validate_audiounit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ PMID=${PMID//\'}
PII=`echo | grep PLUG_IS_INST ../config.h`
PII=${PII//\#define PLUG_IS_INST }

PDM=`echo | grep PLUG_DOES_MIDI ../config.h`
PDM=${PDM//\#define PLUG_DOES_MIDI }
PDM=`echo | grep PLUG_DOES_MIDI_IN ../config.h`
PDM=${PDM//\#define PLUG_DOES_MIDI_IN }

TYPE=aufx

Expand Down
2 changes: 1 addition & 1 deletion IPlug/AAX/IPlugAAX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void IPlugAAX::RenderAudio(AAX_SIPlugRenderInfo* pRenderInfo)
Controller()->GetInputStemFormat(&inFormat);
Controller()->GetOutputStemFormat(&outFormat);

if (DoesMIDI())
if (DoesMIDIIn())
{
AAX_IMIDINode* pMidiIn = pRenderInfo->mInputNode;
AAX_CMidiStream* pMidiBuffer = pMidiIn->GetNodeBuffer();
Expand Down
4 changes: 2 additions & 2 deletions IPlug/AAX/IPlugAAX_Describe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ AAX_Result GetEffectDescriptions(AAX_ICollection* pC)
setupInfo.mAudioSuiteID = aaxTypeIDsAudioSuite[configIdx];
#endif
setupInfo.mCanBypass = true;
setupInfo.mNeedsInputMIDI = PLUG_DOES_MIDI;
setupInfo.mNeedsInputMIDI = PLUG_DOES_MIDI_IN;
setupInfo.mInputMIDINodeName = PLUG_NAME" Midi";
setupInfo.mInputMIDIChannelMask = 0x0001;

setupInfo.mNeedsOutputMIDI = PLUG_DOES_MIDI;
setupInfo.mNeedsOutputMIDI = PLUG_DOES_MIDI_OUT;
setupInfo.mOutputMIDINodeName = PLUG_NAME" Midi";
setupInfo.mOutputMIDIChannelMask = 0x0001;

Expand Down
4 changes: 2 additions & 2 deletions IPlug/APP/IPlugAPP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void IPlugAPP::ResizeGraphics(int viewWidth, int viewHeight, float scale)

bool IPlugAPP::SendMidiMsg(const IMidiMsg& msg)
{
if (DoesMIDI() && mAppHost->mMidiOut)
if (DoesMIDIOut() && mAppHost->mMidiOut)
{
//TODO: midi out channel
// uint8_t status;
Expand All @@ -79,7 +79,7 @@ bool IPlugAPP::SendMidiMsg(const IMidiMsg& msg)

bool IPlugAPP::SendSysEx(ISysEx& msg)
{
if (DoesMIDI() && mAppHost->mMidiOut)
if (DoesMIDIOut() && mAppHost->mMidiOut)
{
//TODO: midi out channel

Expand Down
4 changes: 2 additions & 2 deletions IPlug/AUv2/IPlugAU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2399,7 +2399,7 @@ OSStatus IPlugAU::DoReset(IPlugAU* _this)
//static
OSStatus IPlugAU::DoMIDIEvent(IPlugAU* _this, UInt32 inStatus, UInt32 inData1, UInt32 inData2, UInt32 inOffsetSampleFrame)
{
if(_this->DoesMIDI())
if(_this->DoesMIDIIn())
{
IMidiMsg msg;
msg.mStatus = inStatus;
Expand All @@ -2417,7 +2417,7 @@ OSStatus IPlugAU::DoMIDIEvent(IPlugAU* _this, UInt32 inStatus, UInt32 inData1, U
//static
OSStatus IPlugAU::DoSysEx(IPlugAU* _this, const UInt8* inData, UInt32 inLength)
{
if(_this->DoesMIDI())
if(_this->DoesMIDIIn())
{
ISysEx sysex;
sysex.mData = inData;
Expand Down
2 changes: 1 addition & 1 deletion IPlug/AUv2/IPlugAU.r
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ resource 'thng' (RES_ID, RES_NAME) {
kAudioUnitType_MusicDevice,
#elif PLUG_IS_MFX
'aumi',
#elif PLUG_DOES_MIDI
#elif PLUG_DOES_MIDI_IN
kAudioUnitType_MusicEffect,
#else
kAudioUnitType_Effect,
Expand Down
3 changes: 2 additions & 1 deletion IPlug/IPlugProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ template<typename T>
IPlugProcessor<T>::IPlugProcessor(IPlugConfig c, EAPI plugAPI)
: mLatency(c.latency)
, mIsInstrument(c.plugIsInstrument)
, mDoesMIDI(c.plugDoesMidi)
, mDoesMIDIIn(c.plugDoesMidiIn)
, mDoesMIDIOut(c.plugDoesMidiOut)
{
int totalNInBuses, totalNOutBuses;
int totalNInChans, totalNOutChans;
Expand Down
9 changes: 7 additions & 2 deletions IPlug/IPlugProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ class IPlugProcessor
bool IsInstrument() const { return mIsInstrument; }

/** @return \c true if the plug-in was configured to receive midi at compile time */
bool DoesMIDI() const { return mDoesMIDI; }
bool DoesMIDIIn() const { return mDoesMIDIIn; }

/** @return \c true if the plug-in was configured to receive midi at compile time */
bool DoesMIDIOut() const { return mDoesMIDIOut; }

/** This allows you to label input/output channels in supporting VST2 hosts.
* * For example a 4 channel plug-in that deals with FuMa BFormat first order ambisonic material, might label these channels
Expand Down Expand Up @@ -248,7 +251,9 @@ class IPlugProcessor
/** \c true if the plug-in is an instrument */
bool mIsInstrument;
/** \c true if the plug-in accepts MIDI input */
bool mDoesMIDI;
bool mDoesMIDIIn;
/** \c true if the plug-in produces MIDI output */
bool mDoesMIDIOut;
/** Plug-in latency (in samples) */
int mLatency;
/** Current sample rate (in Hz) */
Expand Down
9 changes: 6 additions & 3 deletions IPlug/IPlugStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ struct IPlugConfig
int uniqueID;
int mfrID;
int latency;
bool plugDoesMidi;
bool plugDoesMidiIn;
bool plugDoesMidiOut;
bool plugDoesChunks;
bool plugIsInstrument;
bool plugHasUI;
Expand All @@ -263,7 +264,8 @@ struct IPlugConfig
int uniqueID,
int mfrID,
int latency,
bool plugDoesMidi,
bool plugDoesMidiIn,
bool plugDoesMidiOut,
bool plugDoesChunks,
bool plugIsInstrument,
bool plugHasUI,
Expand All @@ -281,7 +283,8 @@ struct IPlugConfig
, uniqueID(uniqueID)
, mfrID(mfrID)
, latency(latency)
, plugDoesMidi(plugDoesMidi)
, plugDoesMidiIn(plugDoesMidiIn)
, plugDoesMidiOut(plugDoesMidiOut)
, plugDoesChunks(plugDoesChunks)
, plugIsInstrument(plugIsInstrument)
, plugHasUI(plugHasUI)
Expand Down
4 changes: 2 additions & 2 deletions IPlug/IPlug_include_in_plug_src.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class IPlugAUFactory
case kAudioUnitScheduleParametersSelect:return (AudioComponentMethod)IPlugAU::AUMethodScheduleParameters;
case kAudioUnitRenderSelect: return (AudioComponentMethod)IPlugAU::AUMethodRender;
case kAudioUnitResetSelect: return (AudioComponentMethod)IPlugAU::AUMethodReset;
#if PLUG_DOES_MIDI
#if PLUG_DOES_MIDI_IN
case kMusicDeviceMIDIEventSelect: return (AudioComponentMethod)IPlugAU::AUMethodMIDIEvent;
case kMusicDeviceSysExSelect: return (AudioComponentMethod)IPlugAU::AUMethodSysEx;
#endif
Expand Down Expand Up @@ -440,7 +440,7 @@ DWORD GetTickCount()
#define IPLUG_CTOR(nParams, nPresets, instanceInfo) \
IPlug(instanceInfo, IPlugConfig(nParams, nPresets, PLUG_CHANNEL_IO,\
PUBLIC_NAME, "", PLUG_MFR, PLUG_VERSION_HEX, PLUG_UNIQUE_ID, PLUG_MFR_ID, \
PLUG_LATENCY, PLUG_DOES_MIDI, PLUG_DOES_STATE_CHUNKS, PLUG_IS_INSTRUMENT, \
PLUG_LATENCY, PLUG_DOES_MIDI_IN, PLUG_DOES_MIDI_OUT, PLUG_DOES_STATE_CHUNKS, PLUG_IS_INSTRUMENT, \
PLUG_HAS_UI, PLUG_WIDTH, PLUG_HEIGHT, BUNDLE_ID))

#if !defined NO_IGRAPHICS && !defined VST3P_API
Expand Down
16 changes: 11 additions & 5 deletions IPlug/VST2/IPlugVST2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,12 +626,18 @@ VstIntPtr VSTCALLBACK IPlugVST2::VSTDispatcher(AEffect *pEffect, VstInt32 opCode
{
return 1;
}
if (_this->DoesMIDI())
if (_this->DoesMIDIIn())
{
if (!strcmp((char*) ptr, "receiveVstEvents") ||
!strcmp((char*) ptr, "receiveVstMidiEvent"))
{
return 1;
}
}
if (_this->DoesMIDIOut())
{
if (!strcmp((char*) ptr, "sendVstEvents") ||
!strcmp((char*) ptr, "sendVstMidiEvent") ||
!strcmp((char*) ptr, "receiveVstEvents") ||
!strcmp((char*) ptr, "receiveVstMidiEvent")) // ||
!strcmp((char*) ptr, "sendVstMidiEvent"))
{
return 1;
}
Expand Down Expand Up @@ -799,7 +805,7 @@ VstIntPtr VSTCALLBACK IPlugVST2::VSTDispatcher(AEffect *pEffect, VstInt32 opCode
template <class SAMPLETYPE>
void IPlugVST2::VSTPreProcess(SAMPLETYPE** inputs, SAMPLETYPE** outputs, VstInt32 nFrames)
{
if (DoesMIDI())
if (DoesMIDIIn())
mHostCallback(&mAEffect, __audioMasterWantMidiDeprecated, 0, 0, 0, 0.0f);

_AttachBuffers(ERoute::kInput, 0, MaxNChannels(ERoute::kInput), inputs, nFrames);
Expand Down
11 changes: 5 additions & 6 deletions IPlug/VST3/IPlugVST3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ tresult PLUGIN_API IPlugVST3::initialize(FUnknown* context)
// }


if(DoesMIDI())
{
if(DoesMIDIIn())
addEventInput(STR16("MIDI Input"), 1);

if(DoesMIDIOut())
addEventOutput(STR16("MIDI Output"), 1);
}

if (NPresets())
{
Expand Down Expand Up @@ -343,7 +343,7 @@ tresult PLUGIN_API IPlugVST3::process(ProcessData& data)
}
}

if(DoesMIDI())
if(DoesMIDIIn())
{
IMidiMsg msg;

Expand Down Expand Up @@ -493,8 +493,7 @@ tresult PLUGIN_API IPlugVST3::process(ProcessData& data)
_ProcessBuffers(0.0, data.numSamples); // process buffers double precision
}

// Midi Out
if (DoesMIDI())
if (DoesMIDIOut())
{
IEventList* outputEvents = data.outputEvents;

Expand Down
12 changes: 5 additions & 7 deletions IPlug/VST3/IPlugVST3_Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,11 @@ tresult PLUGIN_API IPlugVST3Processor::initialize(FUnknown* context)
// }


if(DoesMIDI())
{
if(DoesMIDIIn())
addEventInput(STR16("MIDI Input"), 1);
addEventOutput(STR16("MIDI Output"), 1);
}

if(DoesMIDIOut())
addEventOutput(STR16("MIDI Output"), 1);

OnHostIdentified();
}
Expand Down Expand Up @@ -278,7 +277,7 @@ tresult PLUGIN_API IPlugVST3Processor::process(ProcessData& data)
}
}

if(DoesMIDI())
if(DoesMIDIIn())
{
IMidiMsg msg;

Expand Down Expand Up @@ -429,8 +428,7 @@ tresult PLUGIN_API IPlugVST3Processor::process(ProcessData& data)
_ProcessBuffers(0.0, data.numSamples); // process buffers double precision
}

// Midi Out
if (DoesMIDI())
if (DoesMIDIOut())
{
IEventList* outputEvents = data.outputEvents;

Expand Down
3 changes: 2 additions & 1 deletion Scripts/parse_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
IntElements = {
"PLUG_IS_INSTRUMENT",
"PLUG_IS_MFX",
"PLUG_DOES_MIDI",
"PLUG_DOES_MIDI_IN",
"PLUG_DOES_MIDI_OUT",
"PLUG_HAS_UI",
"PLUG_SHARED_RESOURCES",
"PLUG_WIDTH",
Expand Down
3 changes: 2 additions & 1 deletion Tests/IGraphicsTest/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#define PLUG_LATENCY 0
#define PLUG_IS_INSTRUMENT 1
#define PLUG_IS_MFX 0
#define PLUG_DOES_MIDI 1
#define PLUG_DOES_MIDI_IN 1
#define PLUG_DOES_MIDI_OUT 0
#define PLUG_DOES_STATE_CHUNKS 0
#define PLUG_HAS_UI 1
#define PLUG_WIDTH 600
Expand Down
2 changes: 1 addition & 1 deletion Tests/IGraphicsTest/scripts/prepare_resources-ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main():
COMPONENT_TYPE = kAudioUnitType_MusicDevice
elif config['PLUG_IS_MFX']:
COMPONENT_TYPE = kAudioUnitType_MIDIProcessor
elif config['PLUG_DOES_MIDI']:
elif config['PLUG_DOES_MIDI_IN']:
COMPONENT_TYPE = kAudioUnitType_MusicEffect
else:
COMPONENT_TYPE = kAudioUnitType_Effect
Expand Down

0 comments on commit 2e5d868

Please sign in to comment.