Signed-off-by: falkTX <falktx@falktx.com>v6.0.8-distrho
| @@ -78,14 +78,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4458) | |||
| namespace Vst2 | |||
| { | |||
| // If the following files cannot be found then you are probably trying to build | |||
| // a VST2 plug-in or a VST2-compatible VST3 plug-in. To do this you must have a | |||
| // VST2 SDK in your header search paths or use the "VST (Legacy) SDK Folder" | |||
| // field in the Projucer. The VST2 SDK can be obtained from the | |||
| // vstsdk3610_11_06_2018_build_37 (or older) VST3 SDK or JUCE version 5.3.2. You | |||
| // also need a VST2 license from Steinberg to distribute VST2 plug-ins. | |||
| #include "pluginterfaces/vst2.x/aeffect.h" | |||
| #include "pluginterfaces/vst2.x/aeffectx.h" | |||
| #include "../../juce_audio_processors/format_types/juce_VSTInterface.h" | |||
| } | |||
| JUCE_END_IGNORE_WARNINGS_MSVC | |||
| @@ -96,7 +89,6 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE | |||
| #pragma pack (push, 8) | |||
| #endif | |||
| #define JUCE_VSTINTERFACE_H_INCLUDED 1 | |||
| #define JUCE_GUI_BASICS_INCLUDE_XHEADERS 1 | |||
| #include "../utility/juce_IncludeModuleHeaders.h" | |||
| @@ -288,7 +280,7 @@ private: | |||
| public: | |||
| //============================================================================== | |||
| JuceVSTWrapper (Vst2::audioMasterCallback cb, AudioProcessor* af) | |||
| JuceVSTWrapper (Vst2::VstHostCallback cb, AudioProcessor* af) | |||
| : hostCallback (cb), | |||
| processor (af) | |||
| { | |||
| @@ -319,41 +311,41 @@ public: | |||
| juceParameters.update (*processor, false); | |||
| memset (&vstEffect, 0, sizeof (vstEffect)); | |||
| vstEffect.magic = 0x56737450 /* 'VstP' */; | |||
| vstEffect.dispatcher = (Vst2::AEffectDispatcherProc) dispatcherCB; | |||
| vstEffect.process = nullptr; | |||
| vstEffect.setParameter = (Vst2::AEffectSetParameterProc) setParameterCB; | |||
| vstEffect.getParameter = (Vst2::AEffectGetParameterProc) getParameterCB; | |||
| vstEffect.interfaceIdentifier = Vst2::juceVstInterfaceIdentifier; | |||
| vstEffect.dispatchFunction = dispatcherCB; | |||
| vstEffect.processAudioFunction = nullptr; | |||
| vstEffect.setParameterValueFunction = setParameterCB; | |||
| vstEffect.getParameterValueFunction = getParameterCB; | |||
| vstEffect.numPrograms = jmax (1, af->getNumPrograms()); | |||
| vstEffect.numParams = juceParameters.getNumParameters(); | |||
| vstEffect.numInputs = maxNumInChannels; | |||
| vstEffect.numOutputs = maxNumOutChannels; | |||
| vstEffect.initialDelay = processor->getLatencySamples(); | |||
| vstEffect.object = this; | |||
| vstEffect.uniqueID = JucePlugin_VSTUniqueID; | |||
| vstEffect.numParameters = juceParameters.getNumParameters(); | |||
| vstEffect.numInputChannels = maxNumInChannels; | |||
| vstEffect.numOutputChannels = maxNumOutChannels; | |||
| vstEffect.latency = processor->getLatencySamples(); | |||
| vstEffect.effectPointer = this; | |||
| vstEffect.plugInIdentifier = JucePlugin_VSTUniqueID; | |||
| #ifdef JucePlugin_VSTChunkStructureVersion | |||
| vstEffect.version = JucePlugin_VSTChunkStructureVersion; | |||
| vstEffect.plugInVersion = JucePlugin_VSTChunkStructureVersion; | |||
| #else | |||
| vstEffect.version = JucePlugin_VersionCode; | |||
| vstEffect.plugInVersion = JucePlugin_VersionCode; | |||
| #endif | |||
| vstEffect.processReplacing = (Vst2::AEffectProcessProc) processReplacingCB; | |||
| vstEffect.processDoubleReplacing = (Vst2::AEffectProcessDoubleProc) processDoubleReplacingCB; | |||
| vstEffect.processAudioInplaceFunction = processReplacingCB; | |||
| vstEffect.processDoubleAudioInplaceFunction = processDoubleReplacingCB; | |||
| vstEffect.flags |= Vst2::effFlagsHasEditor; | |||
| vstEffect.flags |= Vst2::vstEffectFlagHasEditor; | |||
| vstEffect.flags |= Vst2::effFlagsCanReplacing; | |||
| vstEffect.flags |= Vst2::vstEffectFlagInplaceAudio; | |||
| if (processor->supportsDoublePrecisionProcessing()) | |||
| vstEffect.flags |= Vst2::effFlagsCanDoubleReplacing; | |||
| vstEffect.flags |= Vst2::vstEffectFlagInplaceDoubleAudio; | |||
| vstEffect.flags |= Vst2::effFlagsProgramChunks; | |||
| vstEffect.flags |= Vst2::vstEffectFlagDataInChunks; | |||
| #if JucePlugin_IsSynth | |||
| vstEffect.flags |= Vst2::effFlagsIsSynth; | |||
| vstEffect.flags |= Vst2::vstEffectFlagIsSynth; | |||
| #else | |||
| if (processor->getTailLengthSeconds() == 0.0) | |||
| vstEffect.flags |= Vst2::effFlagsNoSoundInStop; | |||
| vstEffect.flags |= 512; | |||
| #endif | |||
| activePlugins.add (this); | |||
| @@ -397,7 +389,7 @@ public: | |||
| } | |||
| } | |||
| Vst2::AEffect* getAEffect() noexcept { return &vstEffect; } | |||
| Vst2::VstEffectInterface* getAEffect() noexcept { return &vstEffect; } | |||
| template <typename FloatType> | |||
| void internalProcessReplacing (FloatType** inputs, FloatType** outputs, | |||
| @@ -532,7 +524,7 @@ public: | |||
| // Send VST events to the host. | |||
| if (hostCallback != nullptr) | |||
| hostCallback (&vstEffect, Vst2::audioMasterProcessEvents, 0, 0, outgoingEvents.events, 0); | |||
| hostCallback (&vstEffect, Vst2::hostOpcodePreAudioProcessingEvents, 0, 0, outgoingEvents.events, 0); | |||
| #elif JUCE_DEBUG | |||
| /* This assertion is caused when you've added some events to the | |||
| midiMessages array in your processBlock() method, which usually means | |||
| @@ -561,7 +553,7 @@ public: | |||
| internalProcessReplacing (inputs, outputs, sampleFrames, floatTempBuffers); | |||
| } | |||
| static void processReplacingCB (Vst2::AEffect* vstInterface, float** inputs, float** outputs, int32 sampleFrames) | |||
| static void processReplacingCB (Vst2::VstEffectInterface* vstInterface, float** inputs, float** outputs, int32 sampleFrames) | |||
| { | |||
| getWrapper (vstInterface)->processReplacing (inputs, outputs, sampleFrames); | |||
| } | |||
| @@ -572,7 +564,7 @@ public: | |||
| internalProcessReplacing (inputs, outputs, sampleFrames, doubleTempBuffers); | |||
| } | |||
| static void processDoubleReplacingCB (Vst2::AEffect* vstInterface, double** inputs, double** outputs, int32 sampleFrames) | |||
| static void processDoubleReplacingCB (Vst2::VstEffectInterface* vstInterface, double** inputs, double** outputs, int32 sampleFrames) | |||
| { | |||
| getWrapper (vstInterface)->processDoubleReplacing (inputs, outputs, sampleFrames); | |||
| } | |||
| @@ -584,7 +576,7 @@ public: | |||
| { | |||
| isProcessing = true; | |||
| auto numInAndOutChannels = static_cast<size_t> (vstEffect.numInputs + vstEffect.numOutputs); | |||
| auto numInAndOutChannels = static_cast<size_t> (vstEffect.numInputChannels + vstEffect.numOutputChannels); | |||
| floatTempBuffers .channels.calloc (numInAndOutChannels); | |||
| doubleTempBuffers.channels.calloc (numInAndOutChannels); | |||
| @@ -603,16 +595,16 @@ public: | |||
| midiEvents.ensureSize (2048); | |||
| midiEvents.clear(); | |||
| vstEffect.initialDelay = processor->getLatencySamples(); | |||
| vstEffect.latency = processor->getLatencySamples(); | |||
| /** If this plug-in is a synth or it can receive midi events we need to tell the | |||
| host that we want midi. In the SDK this method is marked as deprecated, but | |||
| some hosts rely on this behaviour. | |||
| */ | |||
| if (vstEffect.flags & Vst2::effFlagsIsSynth || JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect) | |||
| if (vstEffect.flags & Vst2::vstEffectFlagIsSynth || JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect) | |||
| { | |||
| if (hostCallback != nullptr) | |||
| hostCallback (&vstEffect, Vst2::audioMasterWantMidi, 0, 1, nullptr, 0); | |||
| hostCallback (&vstEffect, Vst2::hostOpcodePlugInWantsMidi, 0, 1, nullptr, 0); | |||
| } | |||
| if (getHostType().isAbletonLive() | |||
| @@ -626,7 +618,7 @@ public: | |||
| hostCmd.commandSize = sizeof (int); | |||
| hostCmd.flags = AbletonLiveHostSpecific::KCantBeSuspended; | |||
| hostCallback (&vstEffect, Vst2::audioMasterVendorSpecific, 0, 0, &hostCmd, 0.0f); | |||
| hostCallback (&vstEffect, Vst2::hostOpcodeManufacturerSpecific, 0, 0, &hostCmd, 0.0f); | |||
| } | |||
| #if JucePlugin_ProducesMidiOutput || JucePlugin_IsMidiEffect | |||
| @@ -653,28 +645,28 @@ public: | |||
| //============================================================================== | |||
| bool getCurrentPosition (AudioPlayHead::CurrentPositionInfo& info) override | |||
| { | |||
| const Vst2::VstTimeInfo* ti = nullptr; | |||
| const Vst2::VstTimingInformation* ti = nullptr; | |||
| if (hostCallback != nullptr) | |||
| { | |||
| int32 flags = Vst2::kVstPpqPosValid | Vst2::kVstTempoValid | |||
| | Vst2::kVstBarsValid | Vst2::kVstCyclePosValid | |||
| | Vst2::kVstTimeSigValid | Vst2::kVstSmpteValid | |||
| | Vst2::kVstClockValid; | |||
| int32 flags = Vst2::vstTimingInfoFlagMusicalPositionValid | Vst2::vstTimingInfoFlagTempoValid | |||
| | Vst2::vstTimingInfoFlagLastBarPositionValid | Vst2::vstTimingInfoFlagLoopPositionValid | |||
| | Vst2::vstTimingInfoFlagTimeSignatureValid | Vst2::vstTimingInfoFlagSmpteValid | |||
| | Vst2::vstTimingInfoFlagNearestClockValid; | |||
| auto result = hostCallback (&vstEffect, Vst2::audioMasterGetTime, 0, flags, nullptr, 0); | |||
| ti = reinterpret_cast<Vst2::VstTimeInfo*> (result); | |||
| auto result = hostCallback (&vstEffect, Vst2::hostOpcodeGetTimingInfo, 0, flags, nullptr, 0); | |||
| ti = reinterpret_cast<Vst2::VstTimingInformation*> (result); | |||
| } | |||
| if (ti == nullptr || ti->sampleRate <= 0) | |||
| return false; | |||
| info.bpm = (ti->flags & Vst2::kVstTempoValid) != 0 ? ti->tempo : 0.0; | |||
| info.bpm = (ti->flags & Vst2::vstTimingInfoFlagTempoValid) != 0 ? ti->tempoBPM : 0.0; | |||
| if ((ti->flags & Vst2::kVstTimeSigValid) != 0) | |||
| if ((ti->flags & Vst2::vstTimingInfoFlagTimeSignatureValid) != 0) | |||
| { | |||
| info.timeSigNumerator = ti->timeSigNumerator; | |||
| info.timeSigDenominator = ti->timeSigDenominator; | |||
| info.timeSigNumerator = ti->timeSignatureNumerator; | |||
| info.timeSigDenominator = ti->timeSignatureDenominator; | |||
| } | |||
| else | |||
| { | |||
| @@ -682,34 +674,34 @@ public: | |||
| info.timeSigDenominator = 4; | |||
| } | |||
| info.timeInSamples = (int64) (ti->samplePos + 0.5); | |||
| info.timeInSeconds = ti->samplePos / ti->sampleRate; | |||
| info.ppqPosition = (ti->flags & Vst2::kVstPpqPosValid) != 0 ? ti->ppqPos : 0.0; | |||
| info.ppqPositionOfLastBarStart = (ti->flags & Vst2::kVstBarsValid) != 0 ? ti->barStartPos : 0.0; | |||
| info.timeInSamples = (int64) (ti->samplePosition + 0.5); | |||
| info.timeInSeconds = ti->samplePosition / ti->sampleRate; | |||
| info.ppqPosition = (ti->flags & Vst2::vstTimingInfoFlagMusicalPositionValid) != 0 ? ti->musicalPosition : 0.0; | |||
| info.ppqPositionOfLastBarStart = (ti->flags & Vst2::vstTimingInfoFlagLastBarPositionValid) != 0 ? ti->lastBarPosition : 0.0; | |||
| if ((ti->flags & Vst2::kVstSmpteValid) != 0) | |||
| if ((ti->flags & Vst2::vstTimingInfoFlagSmpteValid) != 0) | |||
| { | |||
| AudioPlayHead::FrameRateType rate = AudioPlayHead::fpsUnknown; | |||
| double fps = 1.0; | |||
| switch (ti->smpteFrameRate) | |||
| switch (ti->smpteRate) | |||
| { | |||
| case Vst2::kVstSmpte239fps: rate = AudioPlayHead::fps23976; fps = 24.0 * 1000.0 / 1001.0; break; | |||
| case Vst2::kVstSmpte24fps: rate = AudioPlayHead::fps24; fps = 24.0; break; | |||
| case Vst2::kVstSmpte25fps: rate = AudioPlayHead::fps25; fps = 25.0; break; | |||
| case Vst2::kVstSmpte2997fps: rate = AudioPlayHead::fps2997; fps = 30.0 * 1000.0 / 1001.0; break; | |||
| case Vst2::kVstSmpte30fps: rate = AudioPlayHead::fps30; fps = 30.0; break; | |||
| case Vst2::kVstSmpte2997dfps: rate = AudioPlayHead::fps2997drop; fps = 30.0 * 1000.0 / 1001.0; break; | |||
| case Vst2::kVstSmpte30dfps: rate = AudioPlayHead::fps30drop; fps = 30.0; break; | |||
| case Vst2::kVstSmpteFilm16mm: | |||
| case Vst2::kVstSmpteFilm35mm: fps = 24.0; break; | |||
| case Vst2::kVstSmpte249fps: fps = 25.0 * 1000.0 / 1001.0; break; | |||
| case Vst2::kVstSmpte599fps: fps = 60.0 * 1000.0 / 1001.0; break; | |||
| case Vst2::kVstSmpte60fps: fps = 60; break; | |||
| default: jassertfalse; // unknown frame-rate.. | |||
| case Vst2::vstSmpteRateFps239: rate = AudioPlayHead::fps23976; fps = 24.0 * 1000.0 / 1001.0; break; | |||
| case Vst2::vstSmpteRateFps24: rate = AudioPlayHead::fps24; fps = 24.0; break; | |||
| case Vst2::vstSmpteRateFps25: rate = AudioPlayHead::fps25; fps = 25.0; break; | |||
| case Vst2::vstSmpteRateFps2997: rate = AudioPlayHead::fps2997; fps = 30.0 * 1000.0 / 1001.0; break; | |||
| case Vst2::vstSmpteRateFps30: rate = AudioPlayHead::fps30; fps = 30.0; break; | |||
| case Vst2::vstSmpteRateFps2997drop: rate = AudioPlayHead::fps2997drop; fps = 30.0 * 1000.0 / 1001.0; break; | |||
| case Vst2::vstSmpteRateFps30drop: rate = AudioPlayHead::fps30drop; fps = 30.0; break; | |||
| case Vst2::vstSmpteRate16mmFilm: | |||
| case Vst2::vstSmpteRate35mmFilm: fps = 24.0; break; | |||
| case Vst2::vstSmpteRateFps249: fps = 25.0 * 1000.0 / 1001.0; break; | |||
| case Vst2::vstSmpteRateFps599: fps = 60.0 * 1000.0 / 1001.0; break; | |||
| case Vst2::vstSmpteRateFps60: fps = 60; break; | |||
| default: jassertfalse; // unknown frame-rate.. | |||
| } | |||
| info.frameRate = rate; | |||
| @@ -721,14 +713,14 @@ public: | |||
| info.editOriginTime = 0; | |||
| } | |||
| info.isRecording = (ti->flags & Vst2::kVstTransportRecording) != 0; | |||
| info.isPlaying = (ti->flags & (Vst2::kVstTransportRecording | Vst2::kVstTransportPlaying)) != 0; | |||
| info.isLooping = (ti->flags & Vst2::kVstTransportCycleActive) != 0; | |||
| info.isRecording = (ti->flags & Vst2::vstTimingInfoFlagCurrentlyRecording) != 0; | |||
| info.isPlaying = (ti->flags & (Vst2::vstTimingInfoFlagCurrentlyRecording | Vst2::vstTimingInfoFlagCurrentlyPlaying)) != 0; | |||
| info.isLooping = (ti->flags & Vst2::vstTimingInfoFlagLoopActive) != 0; | |||
| if ((ti->flags & Vst2::kVstCyclePosValid) != 0) | |||
| if ((ti->flags & Vst2::vstTimingInfoFlagLoopPositionValid) != 0) | |||
| { | |||
| info.ppqLoopStart = ti->cycleStartPos; | |||
| info.ppqLoopEnd = ti->cycleEndPos; | |||
| info.ppqLoopStart = ti->loopStartPosition; | |||
| info.ppqLoopEnd = ti->loopEndPosition; | |||
| } | |||
| else | |||
| { | |||
| @@ -748,7 +740,7 @@ public: | |||
| return 0.0f; | |||
| } | |||
| static float getParameterCB (Vst2::AEffect* vstInterface, int32 index) | |||
| static float getParameterCB (Vst2::VstEffectInterface* vstInterface, int32 index) | |||
| { | |||
| return getWrapper (vstInterface)->getParameter (index); | |||
| } | |||
| @@ -764,7 +756,7 @@ public: | |||
| } | |||
| } | |||
| static void setParameterCB (Vst2::AEffect* vstInterface, int32 index, float value) | |||
| static void setParameterCB (Vst2::VstEffectInterface* vstInterface, int32 index, float value) | |||
| { | |||
| getWrapper (vstInterface)->setParameter (index, value); | |||
| } | |||
| @@ -778,19 +770,19 @@ public: | |||
| } | |||
| if (hostCallback != nullptr) | |||
| hostCallback (&vstEffect, Vst2::audioMasterAutomate, index, 0, nullptr, newValue); | |||
| hostCallback (&vstEffect, Vst2::hostOpcodeParameterChanged, index, 0, nullptr, newValue); | |||
| } | |||
| void audioProcessorParameterChangeGestureBegin (AudioProcessor*, int index) override | |||
| { | |||
| if (hostCallback != nullptr) | |||
| hostCallback (&vstEffect, Vst2::audioMasterBeginEdit, index, 0, nullptr, 0); | |||
| hostCallback (&vstEffect, Vst2::hostOpcodeParameterChangeGestureBegin, index, 0, nullptr, 0); | |||
| } | |||
| void audioProcessorParameterChangeGestureEnd (AudioProcessor*, int index) override | |||
| { | |||
| if (hostCallback != nullptr) | |||
| hostCallback (&vstEffect, Vst2::audioMasterEndEdit, index, 0, nullptr, 0); | |||
| hostCallback (&vstEffect, Vst2::hostOpcodeParameterChangeGestureEnd, index, 0, nullptr, 0); | |||
| } | |||
| void parameterValueChanged (int, float newValue) override | |||
| @@ -806,7 +798,7 @@ public: | |||
| hostChangeUpdater.update (details); | |||
| } | |||
| bool getPinProperties (Vst2::VstPinProperties& properties, bool direction, int index) const | |||
| bool getPinProperties (Vst2::VstPinInfo& properties, bool direction, int index) const | |||
| { | |||
| if (processor->isMidiEffect()) | |||
| return false; | |||
| @@ -815,9 +807,9 @@ public: | |||
| // fill with default | |||
| properties.flags = 0; | |||
| properties.label[0] = 0; | |||
| properties.shortLabel[0] = 0; | |||
| properties.arrangementType = Vst2::kSpeakerArrEmpty; | |||
| properties.text[0] = 0; | |||
| properties.shortText[0] = 0; | |||
| properties.configurationType = Vst2::vstSpeakerConfigTypeEmpty; | |||
| if ((channelIdx = processor->getOffsetInBusBufferForAbsoluteChannelIndex (direction, index, busIdx)) >= 0) | |||
| { | |||
| @@ -825,8 +817,8 @@ public: | |||
| auto& channelSet = bus.getCurrentLayout(); | |||
| auto channelType = channelSet.getTypeOfChannel (channelIdx); | |||
| properties.flags = Vst2::kVstPinIsActive | Vst2::kVstPinUseSpeaker; | |||
| properties.arrangementType = SpeakerMappings::channelSetToVstArrangementType (channelSet); | |||
| properties.flags = Vst2::vstPinInfoFlagIsActive | Vst2::vstPinInfoFlagValid; | |||
| properties.configurationType = SpeakerMappings::channelSetToVstArrangementType (channelSet); | |||
| String label = bus.getName(); | |||
| #ifdef JucePlugin_PreferredChannelConfigurations | |||
| @@ -836,8 +828,8 @@ public: | |||
| label += " " + AudioChannelSet::getAbbreviatedChannelTypeName (channelType); | |||
| #endif | |||
| label.copyToUTF8 (properties.label, (size_t) (Vst2::kVstMaxLabelLen + 1)); | |||
| label.copyToUTF8 (properties.shortLabel, (size_t) (Vst2::kVstMaxShortLabelLen + 1)); | |||
| label.copyToUTF8 (properties.text, (size_t) (Vst2::vstMaxParameterOrPinLabelLength + 1)); | |||
| label.copyToUTF8 (properties.shortText, (size_t) (Vst2::vstMaxParameterOrPinShortLabelLength + 1)); | |||
| if (channelType == AudioChannelSet::left | |||
| || channelType == AudioChannelSet::leftSurround | |||
| @@ -847,7 +839,7 @@ public: | |||
| || channelType == AudioChannelSet::topRearLeft | |||
| || channelType == AudioChannelSet::leftSurroundRear | |||
| || channelType == AudioChannelSet::wideLeft) | |||
| properties.flags |= Vst2::kVstPinIsStereo; | |||
| properties.flags |= Vst2::vstPinInfoFlagIsStereo; | |||
| return true; | |||
| } | |||
| @@ -882,15 +874,15 @@ public: | |||
| void setHasEditorFlag (bool shouldSetHasEditor) | |||
| { | |||
| auto hasEditor = (vstEffect.flags & Vst2::effFlagsHasEditor) != 0; | |||
| auto hasEditor = (vstEffect.flags & Vst2::vstEffectFlagHasEditor) != 0; | |||
| if (shouldSetHasEditor == hasEditor) | |||
| return; | |||
| if (shouldSetHasEditor) | |||
| vstEffect.flags |= Vst2::effFlagsHasEditor; | |||
| vstEffect.flags |= Vst2::vstEffectFlagHasEditor; | |||
| else | |||
| vstEffect.flags &= ~Vst2::effFlagsHasEditor; | |||
| vstEffect.flags &= ~Vst2::vstEffectFlagHasEditor; | |||
| } | |||
| void createEditorComp() | |||
| @@ -957,59 +949,59 @@ public: | |||
| switch (opCode) | |||
| { | |||
| case Vst2::effOpen: return handleOpen (args); | |||
| case Vst2::effClose: return handleClose (args); | |||
| case Vst2::effSetProgram: return handleSetCurrentProgram (args); | |||
| case Vst2::effGetProgram: return handleGetCurrentProgram (args); | |||
| case Vst2::effSetProgramName: return handleSetCurrentProgramName (args); | |||
| case Vst2::effGetProgramName: return handleGetCurrentProgramName (args); | |||
| case Vst2::effGetParamLabel: return handleGetParameterLabel (args); | |||
| case Vst2::effGetParamDisplay: return handleGetParameterText (args); | |||
| case Vst2::effGetParamName: return handleGetParameterName (args); | |||
| case Vst2::effSetSampleRate: return handleSetSampleRate (args); | |||
| case Vst2::effSetBlockSize: return handleSetBlockSize (args); | |||
| case Vst2::effMainsChanged: return handleResumeSuspend (args); | |||
| case Vst2::effEditGetRect: return handleGetEditorBounds (args); | |||
| case Vst2::effEditOpen: return handleOpenEditor (args); | |||
| case Vst2::effEditClose: return handleCloseEditor (args); | |||
| case Vst2::effIdentify: return (pointer_sized_int) ByteOrder::bigEndianInt ("NvEf"); | |||
| case Vst2::effGetChunk: return handleGetData (args); | |||
| case Vst2::effSetChunk: return handleSetData (args); | |||
| case Vst2::effProcessEvents: return handlePreAudioProcessingEvents (args); | |||
| case Vst2::effCanBeAutomated: return handleIsParameterAutomatable (args); | |||
| case Vst2::effString2Parameter: return handleParameterValueForText (args); | |||
| case Vst2::effGetProgramNameIndexed: return handleGetProgramName (args); | |||
| case Vst2::effGetInputProperties: return handleGetInputPinProperties (args); | |||
| case Vst2::effGetOutputProperties: return handleGetOutputPinProperties (args); | |||
| case Vst2::effGetPlugCategory: return handleGetPlugInCategory (args); | |||
| case Vst2::effSetSpeakerArrangement: return handleSetSpeakerConfiguration (args); | |||
| case Vst2::effSetBypass: return handleSetBypass (args); | |||
| case Vst2::effGetEffectName: return handleGetPlugInName (args); | |||
| case Vst2::effGetProductString: return handleGetPlugInName (args); | |||
| case Vst2::effGetVendorString: return handleGetManufacturerName (args); | |||
| case Vst2::effGetVendorVersion: return handleGetManufacturerVersion (args); | |||
| case Vst2::effVendorSpecific: return handleManufacturerSpecific (args); | |||
| case Vst2::effCanDo: return handleCanPlugInDo (args); | |||
| case Vst2::effGetTailSize: return handleGetTailSize (args); | |||
| case Vst2::effKeysRequired: return handleKeyboardFocusRequired (args); | |||
| case Vst2::effGetVstVersion: return handleGetVstInterfaceVersion (args); | |||
| case Vst2::effGetCurrentMidiProgram: return handleGetCurrentMidiProgram (args); | |||
| case Vst2::effGetSpeakerArrangement: return handleGetSpeakerConfiguration (args); | |||
| case Vst2::effSetTotalSampleToProcess: return handleSetNumberOfSamplesToProcess (args); | |||
| case Vst2::effSetProcessPrecision: return handleSetSampleFloatType (args); | |||
| case Vst2::effGetNumMidiInputChannels: return handleGetNumMidiInputChannels(); | |||
| case Vst2::effGetNumMidiOutputChannels: return handleGetNumMidiOutputChannels(); | |||
| default: return 0; | |||
| } | |||
| } | |||
| static pointer_sized_int dispatcherCB (Vst2::AEffect* vstInterface, int32 opCode, int32 index, | |||
| case Vst2::plugInOpcodeOpen: return handleOpen (args); | |||
| case Vst2::plugInOpcodeClose: return handleClose (args); | |||
| case Vst2::plugInOpcodeSetCurrentProgram: return handleSetCurrentProgram (args); | |||
| case Vst2::plugInOpcodeGetCurrentProgram: return handleGetCurrentProgram (args); | |||
| case Vst2::plugInOpcodeSetCurrentProgramName: return handleSetCurrentProgramName (args); | |||
| case Vst2::plugInOpcodeGetCurrentProgramName: return handleGetCurrentProgramName (args); | |||
| case Vst2::plugInOpcodeGetParameterLabel: return handleGetParameterLabel (args); | |||
| case Vst2::plugInOpcodeGetParameterText: return handleGetParameterText (args); | |||
| case Vst2::plugInOpcodeGetParameterName: return handleGetParameterName (args); | |||
| case Vst2::plugInOpcodeSetSampleRate: return handleSetSampleRate (args); | |||
| case Vst2::plugInOpcodeSetBlockSize: return handleSetBlockSize (args); | |||
| case Vst2::plugInOpcodeResumeSuspend: return handleResumeSuspend (args); | |||
| case Vst2::plugInOpcodeGetEditorBounds: return handleGetEditorBounds (args); | |||
| case Vst2::plugInOpcodeOpenEditor: return handleOpenEditor (args); | |||
| case Vst2::plugInOpcodeCloseEditor: return handleCloseEditor (args); | |||
| case Vst2::plugInOpcodeIdentify: return (pointer_sized_int) ByteOrder::bigEndianInt ("NvEf"); | |||
| case Vst2::plugInOpcodeGetData: return handleGetData (args); | |||
| case Vst2::plugInOpcodeSetData: return handleSetData (args); | |||
| case Vst2::plugInOpcodePreAudioProcessingEvents: return handlePreAudioProcessingEvents (args); | |||
| case Vst2::plugInOpcodeIsParameterAutomatable: return handleIsParameterAutomatable (args); | |||
| case Vst2::plugInOpcodeParameterValueForText: return handleParameterValueForText (args); | |||
| case Vst2::plugInOpcodeGetProgramName: return handleGetProgramName (args); | |||
| case Vst2::plugInOpcodeGetInputPinProperties: return handleGetInputPinProperties (args); | |||
| case Vst2::plugInOpcodeGetOutputPinProperties: return handleGetOutputPinProperties (args); | |||
| case Vst2::plugInOpcodeGetPlugInCategory: return handleGetPlugInCategory (args); | |||
| case Vst2::plugInOpcodeSetSpeakerConfiguration: return handleSetSpeakerConfiguration (args); | |||
| case Vst2::plugInOpcodeSetBypass: return handleSetBypass (args); | |||
| case Vst2::plugInOpcodeGetPlugInName: return handleGetPlugInName (args); | |||
| case Vst2::plugInOpcodeGetManufacturerProductName: return handleGetPlugInName (args); | |||
| case Vst2::plugInOpcodeGetManufacturerName: return handleGetManufacturerName (args); | |||
| case Vst2::plugInOpcodeGetManufacturerVersion: return handleGetManufacturerVersion (args); | |||
| case Vst2::plugInOpcodeManufacturerSpecific: return handleManufacturerSpecific (args); | |||
| case Vst2::plugInOpcodeCanPlugInDo: return handleCanPlugInDo (args); | |||
| case Vst2::plugInOpcodeGetTailSize: return handleGetTailSize (args); | |||
| case Vst2::plugInOpcodeKeyboardFocusRequired: return handleKeyboardFocusRequired (args); | |||
| case Vst2::plugInOpcodeGetVstInterfaceVersion: return handleGetVstInterfaceVersion (args); | |||
| case Vst2::plugInOpcodeGetCurrentMidiProgram: return handleGetCurrentMidiProgram (args); | |||
| case Vst2::plugInOpcodeGetSpeakerArrangement: return handleGetSpeakerConfiguration (args); | |||
| case Vst2::plugInOpcodeSetNumberOfSamplesToProcess: return handleSetNumberOfSamplesToProcess (args); | |||
| case Vst2::plugInOpcodeSetSampleFloatType: return handleSetSampleFloatType (args); | |||
| case Vst2::pluginOpcodeGetNumMidiInputChannels: return handleGetNumMidiInputChannels(); | |||
| case Vst2::pluginOpcodeGetNumMidiOutputChannels: return handleGetNumMidiOutputChannels(); | |||
| default: return 0; | |||
| } | |||
| } | |||
| static pointer_sized_int dispatcherCB (Vst2::VstEffectInterface* vstInterface, int32 opCode, int32 index, | |||
| pointer_sized_int value, void* ptr, float opt) | |||
| { | |||
| auto* wrapper = getWrapper (vstInterface); | |||
| VstOpCodeArguments args = { index, value, ptr, opt }; | |||
| if (opCode == Vst2::effClose) | |||
| if (opCode == Vst2::plugInOpcodeClose) | |||
| { | |||
| wrapper->dispatcher (opCode, args); | |||
| delete wrapper; | |||
| @@ -1056,7 +1048,7 @@ public: | |||
| g.fillAll (Colours::black); | |||
| } | |||
| void getEditorBounds (Vst2::ERect& bounds) | |||
| void getEditorBounds (Vst2::VstEditorBounds& bounds) | |||
| { | |||
| auto editorBounds = getSizeToContainChild(); | |||
| bounds = convertToHostBounds ({ 0, 0, (int16) editorBounds.getHeight(), (int16) editorBounds.getWidth() }); | |||
| @@ -1178,8 +1170,8 @@ public: | |||
| auto rect = convertToHostBounds ({ 0, 0, (int16) editorBounds.getHeight(), (int16) editorBounds.getWidth() }); | |||
| X11Symbols::getInstance()->xResizeWindow (display, (Window) getWindowHandle(), | |||
| static_cast<unsigned int> (rect.right - rect.left), | |||
| static_cast<unsigned int> (rect.bottom - rect.top)); | |||
| static_cast<unsigned int> (rect.rightmost - rect.leftmost), | |||
| static_cast<unsigned int> (rect.lower - rect.upper)); | |||
| #else | |||
| setSize (editorBounds.getWidth(), editorBounds.getHeight()); | |||
| #endif | |||
| @@ -1194,20 +1186,20 @@ public: | |||
| void resizeHostWindow (int newWidth, int newHeight) | |||
| { | |||
| auto rect = convertToHostBounds ({ 0, 0, (int16) newHeight, (int16) newWidth }); | |||
| newWidth = rect.right - rect.left; | |||
| newHeight = rect.bottom - rect.top; | |||
| newWidth = rect.rightmost - rect.leftmost; | |||
| newHeight = rect.lower - rect.upper; | |||
| bool sizeWasSuccessful = false; | |||
| if (auto host = wrapper.hostCallback) | |||
| { | |||
| auto status = host (wrapper.getAEffect(), Vst2::audioMasterCanDo, 0, 0, const_cast<char*> ("sizeWindow"), 0); | |||
| auto status = host (wrapper.getAEffect(), Vst2::hostOpcodeCanHostDo, 0, 0, const_cast<char*> ("sizeWindow"), 0); | |||
| if (status == (pointer_sized_int) 1 || getHostType().isAbletonLive()) | |||
| { | |||
| const ScopedValueSetter<bool> resizingParentSetter (resizingParent, true); | |||
| sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::audioMasterSizeWindow, | |||
| sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::hostOpcodeWindowSize, | |||
| newWidth, newHeight, nullptr, 0) != 0); | |||
| } | |||
| } | |||
| @@ -1334,17 +1326,17 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| static Vst2::ERect convertToHostBounds (const Vst2::ERect& rect) | |||
| static Vst2::VstEditorBounds convertToHostBounds (const Vst2::VstEditorBounds& rect) | |||
| { | |||
| auto desktopScale = Desktop::getInstance().getGlobalScaleFactor(); | |||
| if (approximatelyEqual (desktopScale, 1.0f)) | |||
| return rect; | |||
| return { (int16) roundToInt (rect.top * desktopScale), | |||
| (int16) roundToInt (rect.left * desktopScale), | |||
| (int16) roundToInt (rect.bottom * desktopScale), | |||
| (int16) roundToInt (rect.right * desktopScale) }; | |||
| return { (int16) roundToInt (rect.upper * desktopScale), | |||
| (int16) roundToInt (rect.leftmost * desktopScale), | |||
| (int16) roundToInt (rect.lower * desktopScale), | |||
| (int16) roundToInt (rect.rightmost * desktopScale)}; | |||
| } | |||
| //============================================================================== | |||
| @@ -1380,7 +1372,7 @@ private: | |||
| void update (const ChangeDetails& details) | |||
| { | |||
| if (details.latencyChanged) | |||
| owner.vstEffect.initialDelay = owner.processor->getLatencySamples(); | |||
| owner.vstEffect.latency = owner.processor->getLatencySamples(); | |||
| if (details.parameterInfoChanged || details.programChanged) | |||
| triggerAsyncUpdate(); | |||
| @@ -1391,20 +1383,20 @@ private: | |||
| { | |||
| if (auto* callback = owner.hostCallback) | |||
| { | |||
| callback (&owner.vstEffect, Vst2::audioMasterUpdateDisplay, 0, 0, nullptr, 0); | |||
| callback (&owner.vstEffect, Vst2::audioMasterIOChanged, 0, 0, nullptr, 0); | |||
| callback (&owner.vstEffect, Vst2::hostOpcodeUpdateView, 0, 0, nullptr, 0); | |||
| callback (&owner.vstEffect, Vst2::hostOpcodeIOModified, 0, 0, nullptr, 0); | |||
| } | |||
| } | |||
| JuceVSTWrapper& owner; | |||
| }; | |||
| static JuceVSTWrapper* getWrapper (Vst2::AEffect* v) noexcept { return static_cast<JuceVSTWrapper*> (v->object); } | |||
| static JuceVSTWrapper* getWrapper (Vst2::VstEffectInterface* v) noexcept { return static_cast<JuceVSTWrapper*> (v->effectPointer); } | |||
| bool isProcessLevelOffline() | |||
| { | |||
| return hostCallback != nullptr | |||
| && (int32) hostCallback (&vstEffect, Vst2::audioMasterGetCurrentProcessLevel, 0, 0, nullptr, 0) == 4; | |||
| && (int32) hostCallback (&vstEffect, Vst2::hostOpcodeGetCurrentAudioProcessingLevel, 0, 0, nullptr, 0) == 4; | |||
| } | |||
| static int32 convertHexVersionToDecimal (const unsigned int hexVersion) | |||
| @@ -1472,8 +1464,8 @@ private: | |||
| tmpBuffers.release(); | |||
| if (processor != nullptr) | |||
| tmpBuffers.tempChannels.insertMultiple (0, nullptr, vstEffect.numInputs | |||
| + vstEffect.numOutputs); | |||
| tmpBuffers.tempChannels.insertMultiple (0, nullptr, vstEffect.numInputChannels | |||
| + vstEffect.numOutputChannels); | |||
| } | |||
| void deleteTempChannels() | |||
| @@ -1633,7 +1625,7 @@ private: | |||
| if (editorComp != nullptr) | |||
| { | |||
| editorComp->getEditorBounds (editorRect); | |||
| *((Vst2::ERect**) args.ptr) = &editorRect; | |||
| *((Vst2::VstEditorBounds**) args.ptr) = &editorRect; | |||
| return (pointer_sized_int) &editorRect; | |||
| } | |||
| @@ -1723,7 +1715,7 @@ private: | |||
| pointer_sized_int handlePreAudioProcessingEvents (VstOpCodeArguments args) | |||
| { | |||
| #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect | |||
| VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEvents*) args.ptr, midiEvents); | |||
| VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEventBlock*) args.ptr, midiEvents); | |||
| return 1; | |||
| #else | |||
| ignoreUnused (args); | |||
| @@ -1774,12 +1766,12 @@ private: | |||
| pointer_sized_int handleGetInputPinProperties (VstOpCodeArguments args) | |||
| { | |||
| return (processor != nullptr && getPinProperties (*(Vst2::VstPinProperties*) args.ptr, true, args.index)) ? 1 : 0; | |||
| return (processor != nullptr && getPinProperties (*(Vst2::VstPinInfo*) args.ptr, true, args.index)) ? 1 : 0; | |||
| } | |||
| pointer_sized_int handleGetOutputPinProperties (VstOpCodeArguments args) | |||
| { | |||
| return (processor != nullptr && getPinProperties (*(Vst2::VstPinProperties*) args.ptr, false, args.index)) ? 1 : 0; | |||
| return (processor != nullptr && getPinProperties (*(Vst2::VstPinInfo*) args.ptr, false, args.index)) ? 1 : 0; | |||
| } | |||
| pointer_sized_int handleGetPlugInCategory (VstOpCodeArguments) | |||
| @@ -1789,8 +1781,8 @@ private: | |||
| pointer_sized_int handleSetSpeakerConfiguration (VstOpCodeArguments args) | |||
| { | |||
| auto* pluginInput = reinterpret_cast<Vst2::VstSpeakerArrangement*> (args.value); | |||
| auto* pluginOutput = reinterpret_cast<Vst2::VstSpeakerArrangement*> (args.ptr); | |||
| auto* pluginInput = reinterpret_cast<Vst2::VstSpeakerConfiguration*> (args.value); | |||
| auto* pluginOutput = reinterpret_cast<Vst2::VstSpeakerConfiguration*> (args.ptr); | |||
| if (processor->isMidiEffect()) | |||
| return 0; | |||
| @@ -1801,29 +1793,29 @@ private: | |||
| if (pluginInput != nullptr && pluginInput->type >= 0) | |||
| { | |||
| // inconsistent request? | |||
| if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput).size() != pluginInput->numChannels) | |||
| if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput).size() != pluginInput->numberOfChannels) | |||
| return 0; | |||
| } | |||
| if (pluginOutput != nullptr && pluginOutput->type >= 0) | |||
| { | |||
| // inconsistent request? | |||
| if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput).size() != pluginOutput->numChannels) | |||
| if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput).size() != pluginOutput->numberOfChannels) | |||
| return 0; | |||
| } | |||
| if (pluginInput != nullptr && pluginInput->numChannels > 0 && numIns == 0) | |||
| if (pluginInput != nullptr && pluginInput->numberOfChannels > 0 && numIns == 0) | |||
| return 0; | |||
| if (pluginOutput != nullptr && pluginOutput->numChannels > 0 && numOuts == 0) | |||
| if (pluginOutput != nullptr && pluginOutput->numberOfChannels > 0 && numOuts == 0) | |||
| return 0; | |||
| auto layouts = processor->getBusesLayout(); | |||
| if (pluginInput != nullptr && pluginInput-> numChannels >= 0 && numIns > 0) | |||
| if (pluginInput != nullptr && pluginInput-> numberOfChannels >= 0 && numIns > 0) | |||
| layouts.getChannelSet (true, 0) = SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput); | |||
| if (pluginOutput != nullptr && pluginOutput->numChannels >= 0 && numOuts > 0) | |||
| if (pluginOutput != nullptr && pluginOutput->numberOfChannels >= 0 && numOuts > 0) | |||
| layouts.getChannelSet (false, 0) = SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput); | |||
| #ifdef JucePlugin_PreferredChannelConfigurations | |||
| @@ -1871,7 +1863,7 @@ private: | |||
| && args.value == (int32) ByteOrder::bigEndianInt ("AeCs")) | |||
| return handleSetContentScaleFactor (args.opt); | |||
| if (args.index == Vst2::effGetParamDisplay) | |||
| if (args.index == Vst2::plugInOpcodeGetParameterText) | |||
| return handleCockosGetParameterText (args.value, args.ptr, args.opt); | |||
| if (auto callbackHandler = dynamic_cast<VSTCallbackHandler*> (processor)) | |||
| @@ -1966,7 +1958,7 @@ private: | |||
| pointer_sized_int handleGetVstInterfaceVersion (VstOpCodeArguments) | |||
| { | |||
| return kVstVersion; | |||
| return Vst2::juceVstInterfaceVersion; | |||
| } | |||
| pointer_sized_int handleGetCurrentMidiProgram (VstOpCodeArguments) | |||
| @@ -1976,8 +1968,8 @@ private: | |||
| pointer_sized_int handleGetSpeakerConfiguration (VstOpCodeArguments args) | |||
| { | |||
| auto** pluginInput = reinterpret_cast<Vst2::VstSpeakerArrangement**> (args.value); | |||
| auto** pluginOutput = reinterpret_cast<Vst2::VstSpeakerArrangement**> (args.ptr); | |||
| auto** pluginInput = reinterpret_cast<Vst2::VstSpeakerConfiguration**> (args.value); | |||
| auto** pluginOutput = reinterpret_cast<Vst2::VstSpeakerConfiguration**> (args.ptr); | |||
| if (pluginHasSidechainsOrAuxs() || processor->isMidiEffect()) | |||
| return false; | |||
| @@ -1985,10 +1977,10 @@ private: | |||
| auto inputLayout = processor->getChannelLayoutOfBus (true, 0); | |||
| auto outputLayout = processor->getChannelLayoutOfBus (false, 0); | |||
| auto speakerBaseSize = sizeof (Vst2::VstSpeakerArrangement) - (sizeof (Vst2::VstSpeakerProperties) * 8); | |||
| auto speakerBaseSize = sizeof (Vst2::VstSpeakerConfiguration) - (sizeof (Vst2::VstIndividualSpeakerInfo) * 8); | |||
| cachedInArrangement .malloc (speakerBaseSize + (static_cast<std::size_t> (inputLayout. size()) * sizeof (Vst2::VstSpeakerArrangement)), 1); | |||
| cachedOutArrangement.malloc (speakerBaseSize + (static_cast<std::size_t> (outputLayout.size()) * sizeof (Vst2::VstSpeakerArrangement)), 1); | |||
| cachedInArrangement .malloc (speakerBaseSize + (static_cast<std::size_t> (inputLayout. size()) * sizeof (Vst2::VstSpeakerConfiguration)), 1); | |||
| cachedOutArrangement.malloc (speakerBaseSize + (static_cast<std::size_t> (outputLayout.size()) * sizeof (Vst2::VstSpeakerConfiguration)), 1); | |||
| *pluginInput = cachedInArrangement. getData(); | |||
| *pluginOutput = cachedOutArrangement.getData(); | |||
| @@ -2010,7 +2002,7 @@ private: | |||
| { | |||
| if (processor != nullptr) | |||
| { | |||
| processor->setProcessingPrecision ((args.value == Vst2::kVstProcessPrecision64 | |||
| processor->setProcessingPrecision ((args.value == Vst2::vstProcessingSampleTypeDouble | |||
| && processor->supportsDoublePrecisionProcessing()) | |||
| ? AudioProcessor::doublePrecision | |||
| : AudioProcessor::singlePrecision); | |||
| @@ -2084,16 +2076,16 @@ private: | |||
| } | |||
| //============================================================================== | |||
| Vst2::audioMasterCallback hostCallback; | |||
| Vst2::VstHostCallback hostCallback; | |||
| AudioProcessor* processor = {}; | |||
| double sampleRate = 44100.0; | |||
| int32 blockSize = 1024; | |||
| Vst2::AEffect vstEffect; | |||
| Vst2::VstEffectInterface vstEffect; | |||
| CriticalSection stateInformationLock; | |||
| juce::MemoryBlock chunkMemory; | |||
| uint32 chunkMemoryTime = 0; | |||
| std::unique_ptr<EditorCompWrapper> editorComp; | |||
| Vst2::ERect editorRect; | |||
| Vst2::VstEditorBounds editorRect; | |||
| MidiBuffer midiEvents; | |||
| VSTMidiEventList outgoingEvents; | |||
| @@ -2118,7 +2110,7 @@ private: | |||
| VstTempBuffers<double> doubleTempBuffers; | |||
| int maxNumInChannels = 0, maxNumOutChannels = 0; | |||
| HeapBlock<Vst2::VstSpeakerArrangement> cachedInArrangement, cachedOutArrangement; | |||
| HeapBlock<Vst2::VstSpeakerConfiguration> cachedInArrangement, cachedOutArrangement; | |||
| ThreadLocalValue<bool> inParameterChangedCallback; | |||
| @@ -2132,7 +2124,7 @@ private: | |||
| //============================================================================== | |||
| namespace | |||
| { | |||
| Vst2::AEffect* pluginEntryPoint (Vst2::audioMasterCallback audioMaster) | |||
| Vst2::VstEffectInterface* pluginEntryPoint (Vst2::VstHostCallback audioMaster) | |||
| { | |||
| JUCE_AUTORELEASEPOOL | |||
| { | |||
| @@ -2140,7 +2132,7 @@ namespace | |||
| try | |||
| { | |||
| if (audioMaster (nullptr, Vst2::audioMasterVersion, 0, 0, nullptr, 0) != 0) | |||
| if (audioMaster (nullptr, Vst2::hostOpcodeVstVersion, 0, 0, nullptr, 0) != 0) | |||
| { | |||
| #if JUCE_LINUX | |||
| MessageManagerLock mmLock; | |||
| @@ -2177,8 +2169,8 @@ namespace | |||
| // Mac startup code.. | |||
| #if JUCE_MAC | |||
| JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster); | |||
| JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) | |||
| JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster); | |||
| JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster) | |||
| { | |||
| PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; | |||
| @@ -2186,8 +2178,8 @@ namespace | |||
| return pluginEntryPoint (audioMaster); | |||
| } | |||
| JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster); | |||
| JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster) | |||
| JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_macho (Vst2::VstHostCallback audioMaster); | |||
| JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_macho (Vst2::VstHostCallback audioMaster) | |||
| { | |||
| PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; | |||
| @@ -2199,8 +2191,8 @@ namespace | |||
| // Linux startup code.. | |||
| #elif JUCE_LINUX | |||
| JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster); | |||
| JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) | |||
| JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster); | |||
| JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster) | |||
| { | |||
| PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; | |||
| @@ -2208,8 +2200,8 @@ namespace | |||
| return pluginEntryPoint (audioMaster); | |||
| } | |||
| JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster) asm ("main"); | |||
| JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster) | |||
| JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_plugin (Vst2::VstHostCallback audioMaster) asm ("main"); | |||
| JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_plugin (Vst2::VstHostCallback audioMaster) | |||
| { | |||
| PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; | |||
| @@ -2224,7 +2216,7 @@ namespace | |||
| // Win32 startup code.. | |||
| #else | |||
| extern "C" __declspec (dllexport) Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) | |||
| extern "C" __declspec (dllexport) Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster) | |||
| { | |||
| PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; | |||
| @@ -2232,7 +2224,7 @@ namespace | |||
| } | |||
| #if ! defined (JUCE_64BIT) && JUCE_MSVC // (can't compile this on win64, but it's not needed anyway with VST2.4) | |||
| extern "C" __declspec (dllexport) int main (Vst2::audioMasterCallback audioMaster) | |||
| extern "C" __declspec (dllexport) int main (Vst2::VstHostCallback audioMaster) | |||
| { | |||
| PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; | |||
| @@ -61,10 +61,7 @@ | |||
| #define __cdecl | |||
| #endif | |||
| namespace Vst2 | |||
| { | |||
| #include "pluginterfaces/vst2.x/vstfxstore.h" | |||
| } | |||
| #include <juce_audio_processors/format_types/juce_VSTInterface.h> | |||
| #endif | |||
| @@ -2054,16 +2051,16 @@ public: | |||
| bool loadVST2CcnKBlock (const char* data, int size) | |||
| { | |||
| auto* bank = reinterpret_cast<const Vst2::fxBank*> (data); | |||
| auto* bank = reinterpret_cast<const vst2FxBank*> (data); | |||
| jassert (ByteOrder::bigEndianInt ("CcnK") == htonl ((uint32) bank->chunkMagic)); | |||
| jassert (ByteOrder::bigEndianInt ("FBCh") == htonl ((uint32) bank->fxMagic)); | |||
| jassert (htonl ((uint32) bank->version) == 1 || htonl ((uint32) bank->version) == 2); | |||
| jassert (ByteOrder::bigEndianInt ("CcnK") == htonl ((uint32) bank->magic1)); | |||
| jassert (ByteOrder::bigEndianInt ("FBCh") == htonl ((uint32) bank->magic2)); | |||
| jassert (htonl ((uint32) bank->version1) == 1 || htonl ((uint32) bank->version1) == 2); | |||
| jassert (JucePlugin_VSTUniqueID == htonl ((uint32) bank->fxID)); | |||
| setStateInformation (bank->content.data.chunk, | |||
| jmin ((int) (size - (bank->content.data.chunk - data)), | |||
| (int) htonl ((uint32) bank->content.data.size))); | |||
| setStateInformation (bank->chunk, | |||
| jmin ((int) (size - (bank->chunk - data)), | |||
| (int) htonl ((uint32) bank->chunkSize))); | |||
| return true; | |||
| } | |||
| @@ -2259,16 +2256,16 @@ public: | |||
| return status; | |||
| const int bankBlockSize = 160; | |||
| Vst2::fxBank bank; | |||
| vst2FxBank bank; | |||
| zerostruct (bank); | |||
| bank.chunkMagic = (int32) htonl (ByteOrder::bigEndianInt ("CcnK")); | |||
| bank.byteSize = (int32) htonl (bankBlockSize - 8 + (unsigned int) mem.getSize()); | |||
| bank.fxMagic = (int32) htonl (ByteOrder::bigEndianInt ("FBCh")); | |||
| bank.version = (int32) htonl (2); | |||
| bank.fxID = (int32) htonl (JucePlugin_VSTUniqueID); | |||
| bank.fxVersion = (int32) htonl (JucePlugin_VersionCode); | |||
| bank.content.data.size = (int32) htonl ((unsigned int) mem.getSize()); | |||
| bank.magic1 = (int32) htonl (ByteOrder::bigEndianInt ("CcnK")); | |||
| bank.size = (int32) htonl (bankBlockSize - 8 + (unsigned int) mem.getSize()); | |||
| bank.magic2 = (int32) htonl (ByteOrder::bigEndianInt ("FBCh")); | |||
| bank.version1 = (int32) htonl (2); | |||
| bank.fxID = (int32) htonl (JucePlugin_VSTUniqueID); | |||
| bank.version2 = (int32) htonl (JucePlugin_VersionCode); | |||
| bank.chunkSize = (int32) htonl ((unsigned int) mem.getSize()); | |||
| status = state->write (&bank, bankBlockSize); | |||
| @@ -58,25 +58,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e | |||
| static AudioChannelSet vstArrangementTypeToChannelSet (int32 arr, int fallbackNumChannels) | |||
| { | |||
| if (arr == Vst2::kSpeakerArrEmpty) return AudioChannelSet::disabled(); | |||
| else if (arr == Vst2::kSpeakerArrMono) return AudioChannelSet::mono(); | |||
| else if (arr == Vst2::kSpeakerArrStereo) return AudioChannelSet::stereo(); | |||
| else if (arr == Vst2::kSpeakerArr30Cine) return AudioChannelSet::createLCR(); | |||
| else if (arr == Vst2::kSpeakerArr30Music) return AudioChannelSet::createLRS(); | |||
| else if (arr == Vst2::kSpeakerArr40Cine) return AudioChannelSet::createLCRS(); | |||
| else if (arr == Vst2::kSpeakerArr50) return AudioChannelSet::create5point0(); | |||
| else if (arr == Vst2::kSpeakerArr51) return AudioChannelSet::create5point1(); | |||
| else if (arr == Vst2::kSpeakerArr60Cine) return AudioChannelSet::create6point0(); | |||
| else if (arr == Vst2::kSpeakerArr61Cine) return AudioChannelSet::create6point1(); | |||
| else if (arr == Vst2::kSpeakerArr60Music) return AudioChannelSet::create6point0Music(); | |||
| else if (arr == Vst2::kSpeakerArr61Music) return AudioChannelSet::create6point1Music(); | |||
| else if (arr == Vst2::kSpeakerArr70Music) return AudioChannelSet::create7point0(); | |||
| else if (arr == Vst2::kSpeakerArr70Cine) return AudioChannelSet::create7point0SDDS(); | |||
| else if (arr == Vst2::kSpeakerArr71Music) return AudioChannelSet::create7point1(); | |||
| else if (arr == Vst2::kSpeakerArr71Cine) return AudioChannelSet::create7point1SDDS(); | |||
| else if (arr == Vst2::kSpeakerArr40Music) return AudioChannelSet::quadraphonic(); | |||
| for (const Mapping* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m) | |||
| if (arr == Vst2::vstSpeakerConfigTypeEmpty) return AudioChannelSet::disabled(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeMono) return AudioChannelSet::mono(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLR) return AudioChannelSet::stereo(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRC) return AudioChannelSet::createLCR(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRS) return AudioChannelSet::createLRS(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRCS) return AudioChannelSet::createLCRS(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRs) return AudioChannelSet::create5point0(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRs) return AudioChannelSet::create5point1(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsCs) return AudioChannelSet::create6point0(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs) return AudioChannelSet::create6point1(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRLsRsSlSr) return AudioChannelSet::create6point0Music(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr) return AudioChannelSet::create6point1Music(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsSlSr) return AudioChannelSet::create7point0(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsLcRc) return AudioChannelSet::create7point0SDDS(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr) return AudioChannelSet::create7point1(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc) return AudioChannelSet::create7point1SDDS(); | |||
| else if (arr == Vst2::vstSpeakerConfigTypeLRLsRs) return AudioChannelSet::quadraphonic(); | |||
| for (const Mapping* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m) | |||
| { | |||
| if (m->vst2 == arr) | |||
| { | |||
| @@ -92,53 +92,53 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e | |||
| return AudioChannelSet::discreteChannels (fallbackNumChannels); | |||
| } | |||
| static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerArrangement& arr) | |||
| static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerConfiguration& arr) | |||
| { | |||
| return vstArrangementTypeToChannelSet (arr.type, arr.numChannels); | |||
| return vstArrangementTypeToChannelSet (arr.type, arr.numberOfChannels); | |||
| } | |||
| static int32 channelSetToVstArrangementType (AudioChannelSet channels) | |||
| { | |||
| if (channels == AudioChannelSet::disabled()) return Vst2::kSpeakerArrEmpty; | |||
| else if (channels == AudioChannelSet::mono()) return Vst2::kSpeakerArrMono; | |||
| else if (channels == AudioChannelSet::stereo()) return Vst2::kSpeakerArrStereo; | |||
| else if (channels == AudioChannelSet::createLCR()) return Vst2::kSpeakerArr30Cine; | |||
| else if (channels == AudioChannelSet::createLRS()) return Vst2::kSpeakerArr30Music; | |||
| else if (channels == AudioChannelSet::createLCRS()) return Vst2::kSpeakerArr40Cine; | |||
| else if (channels == AudioChannelSet::create5point0()) return Vst2::kSpeakerArr50; | |||
| else if (channels == AudioChannelSet::create5point1()) return Vst2::kSpeakerArr51; | |||
| else if (channels == AudioChannelSet::create6point0()) return Vst2::kSpeakerArr60Cine; | |||
| else if (channels == AudioChannelSet::create6point1()) return Vst2::kSpeakerArr61Cine; | |||
| else if (channels == AudioChannelSet::create6point0Music()) return Vst2::kSpeakerArr60Music; | |||
| else if (channels == AudioChannelSet::create6point1Music()) return Vst2::kSpeakerArr61Music; | |||
| else if (channels == AudioChannelSet::create7point0()) return Vst2::kSpeakerArr70Music; | |||
| else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::kSpeakerArr70Cine; | |||
| else if (channels == AudioChannelSet::create7point1()) return Vst2::kSpeakerArr71Music; | |||
| else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::kSpeakerArr71Cine; | |||
| else if (channels == AudioChannelSet::quadraphonic()) return Vst2::kSpeakerArr40Music; | |||
| if (channels == AudioChannelSet::disabled()) return Vst2::vstSpeakerConfigTypeEmpty; | |||
| else if (channels == AudioChannelSet::mono()) return Vst2::vstSpeakerConfigTypeMono; | |||
| else if (channels == AudioChannelSet::stereo()) return Vst2::vstSpeakerConfigTypeLR; | |||
| else if (channels == AudioChannelSet::createLCR()) return Vst2::vstSpeakerConfigTypeLRC; | |||
| else if (channels == AudioChannelSet::createLRS()) return Vst2::vstSpeakerConfigTypeLRS; | |||
| else if (channels == AudioChannelSet::createLCRS()) return Vst2::vstSpeakerConfigTypeLRCS; | |||
| else if (channels == AudioChannelSet::create5point0()) return Vst2::vstSpeakerConfigTypeLRCLsRs; | |||
| else if (channels == AudioChannelSet::create5point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRs; | |||
| else if (channels == AudioChannelSet::create6point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsCs; | |||
| else if (channels == AudioChannelSet::create6point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs; | |||
| else if (channels == AudioChannelSet::create6point0Music()) return Vst2::vstSpeakerConfigTypeLRLsRsSlSr; | |||
| else if (channels == AudioChannelSet::create6point1Music()) return Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr; | |||
| else if (channels == AudioChannelSet::create7point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsSlSr; | |||
| else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::vstSpeakerConfigTypeLRCLsRsLcRc; | |||
| else if (channels == AudioChannelSet::create7point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr; | |||
| else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc; | |||
| else if (channels == AudioChannelSet::quadraphonic()) return Vst2::vstSpeakerConfigTypeLRLsRs; | |||
| if (channels == AudioChannelSet::disabled()) | |||
| return Vst2::kSpeakerArrEmpty; | |||
| return Vst2::vstSpeakerConfigTypeEmpty; | |||
| auto chans = channels.getChannelTypes(); | |||
| for (auto* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m) | |||
| for (auto* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m) | |||
| if (m->matches (chans)) | |||
| return m->vst2; | |||
| return Vst2::kSpeakerArrUserDefined; | |||
| return Vst2::vstSpeakerConfigTypeUser; | |||
| } | |||
| static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerArrangement& result) | |||
| static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerConfiguration& result) | |||
| { | |||
| result.type = channelSetToVstArrangementType (channels); | |||
| result.numChannels = channels.size(); | |||
| result.numberOfChannels = channels.size(); | |||
| for (int i = 0; i < result.numChannels; ++i) | |||
| for (int i = 0; i < result.numberOfChannels; ++i) | |||
| { | |||
| auto& speaker = result.speakers[i]; | |||
| zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties)); | |||
| zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo)); | |||
| speaker.type = getSpeakerType (channels.getTypeOfChannel (i)); | |||
| } | |||
| } | |||
| @@ -152,7 +152,7 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e | |||
| clear(); | |||
| } | |||
| VstSpeakerConfigurationHolder (const Vst2::VstSpeakerArrangement& vstConfig) | |||
| VstSpeakerConfigurationHolder (const Vst2::VstSpeakerConfiguration& vstConfig) | |||
| { | |||
| operator= (vstConfig); | |||
| } | |||
| @@ -171,29 +171,29 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e | |||
| VstSpeakerConfigurationHolder (const AudioChannelSet& channels) | |||
| { | |||
| auto numberOfChannels = channels.size(); | |||
| Vst2::VstSpeakerArrangement& dst = *allocate (numberOfChannels); | |||
| Vst2::VstSpeakerConfiguration& dst = *allocate (numberOfChannels); | |||
| dst.type = channelSetToVstArrangementType (channels); | |||
| dst.numChannels = numberOfChannels; | |||
| dst.numberOfChannels = numberOfChannels; | |||
| for (int i = 0; i < dst.numChannels; ++i) | |||
| for (int i = 0; i < dst.numberOfChannels; ++i) | |||
| { | |||
| Vst2::VstSpeakerProperties& speaker = dst.speakers[i]; | |||
| Vst2::VstIndividualSpeakerInfo& speaker = dst.speakers[i]; | |||
| zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties)); | |||
| zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo)); | |||
| speaker.type = getSpeakerType (channels.getTypeOfChannel (i)); | |||
| } | |||
| } | |||
| VstSpeakerConfigurationHolder& operator= (const VstSpeakerConfigurationHolder& vstConfig) { return operator=(vstConfig.get()); } | |||
| VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerArrangement& vstConfig) | |||
| VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerConfiguration& vstConfig) | |||
| { | |||
| Vst2::VstSpeakerArrangement& dst = *allocate (vstConfig.numChannels); | |||
| Vst2::VstSpeakerConfiguration& dst = *allocate (vstConfig.numberOfChannels); | |||
| dst.type = vstConfig.type; | |||
| dst.numChannels = vstConfig.numChannels; | |||
| dst.numberOfChannels = vstConfig.numberOfChannels; | |||
| for (int i = 0; i < dst.numChannels; ++i) | |||
| for (int i = 0; i < dst.numberOfChannels; ++i) | |||
| dst.speakers[i] = vstConfig.speakers[i]; | |||
| return *this; | |||
| @@ -207,17 +207,17 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e | |||
| return *this; | |||
| } | |||
| const Vst2::VstSpeakerArrangement& get() const { return *storage.get(); } | |||
| const Vst2::VstSpeakerConfiguration& get() const { return *storage.get(); } | |||
| private: | |||
| JUCE_LEAK_DETECTOR (VstSpeakerConfigurationHolder) | |||
| HeapBlock<Vst2::VstSpeakerArrangement> storage; | |||
| HeapBlock<Vst2::VstSpeakerConfiguration> storage; | |||
| Vst2::VstSpeakerArrangement* allocate (int numChannels) | |||
| Vst2::VstSpeakerConfiguration* allocate (int numChannels) | |||
| { | |||
| auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstSpeakerProperties) | |||
| + sizeof (Vst2::VstSpeakerArrangement); | |||
| auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstIndividualSpeakerInfo) | |||
| + sizeof (Vst2::VstSpeakerConfiguration); | |||
| storage.malloc (1, arrangementSize); | |||
| return storage.get(); | |||
| @@ -225,10 +225,10 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e | |||
| void clear() | |||
| { | |||
| Vst2::VstSpeakerArrangement& dst = *allocate (0); | |||
| Vst2::VstSpeakerConfiguration& dst = *allocate (0); | |||
| dst.type = Vst2::kSpeakerArrEmpty; | |||
| dst.numChannels = 0; | |||
| dst.type = Vst2::vstSpeakerConfigTypeEmpty; | |||
| dst.numberOfChannels = 0; | |||
| } | |||
| }; | |||
| @@ -236,36 +236,36 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e | |||
| { | |||
| static const Mapping mappings[] = | |||
| { | |||
| { Vst2::kSpeakerArrMono, { centre, unknown } }, | |||
| { Vst2::kSpeakerArrStereo, { left, right, unknown } }, | |||
| { Vst2::kSpeakerArrStereoSurround, { leftSurround, rightSurround, unknown } }, | |||
| { Vst2::kSpeakerArrStereoCenter, { leftCentre, rightCentre, unknown } }, | |||
| { Vst2::kSpeakerArrStereoSide, { leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::kSpeakerArrStereoCLfe, { centre, LFE, unknown } }, | |||
| { Vst2::kSpeakerArr30Cine, { left, right, centre, unknown } }, | |||
| { Vst2::kSpeakerArr30Music, { left, right, surround, unknown } }, | |||
| { Vst2::kSpeakerArr31Cine, { left, right, centre, LFE, unknown } }, | |||
| { Vst2::kSpeakerArr31Music, { left, right, LFE, surround, unknown } }, | |||
| { Vst2::kSpeakerArr40Cine, { left, right, centre, surround, unknown } }, | |||
| { Vst2::kSpeakerArr40Music, { left, right, leftSurround, rightSurround, unknown } }, | |||
| { Vst2::kSpeakerArr41Cine, { left, right, centre, LFE, surround, unknown } }, | |||
| { Vst2::kSpeakerArr41Music, { left, right, LFE, leftSurround, rightSurround, unknown } }, | |||
| { Vst2::kSpeakerArr50, { left, right, centre, leftSurround, rightSurround, unknown } }, | |||
| { Vst2::kSpeakerArr51, { left, right, centre, LFE, leftSurround, rightSurround, unknown } }, | |||
| { Vst2::kSpeakerArr60Cine, { left, right, centre, leftSurround, rightSurround, surround, unknown } }, | |||
| { Vst2::kSpeakerArr60Music, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::kSpeakerArr61Cine, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } }, | |||
| { Vst2::kSpeakerArr61Music, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::kSpeakerArr70Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, | |||
| { Vst2::kSpeakerArr70Music, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::kSpeakerArr71Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, | |||
| { Vst2::kSpeakerArr71Music, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::kSpeakerArr80Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, | |||
| { Vst2::kSpeakerArr80Music, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::kSpeakerArr81Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, | |||
| { Vst2::kSpeakerArr81Music, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::kSpeakerArr102, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } }, | |||
| { Vst2::kSpeakerArrEmpty, { unknown } } | |||
| { Vst2::vstSpeakerConfigTypeMono, { centre, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLR, { left, right, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLsRs, { leftSurround, rightSurround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLcRc, { leftCentre, rightCentre, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeSlSr, { leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeCLfe, { centre, LFE, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRC, { left, right, centre, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRS, { left, right, surround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLfe, { left, right, centre, LFE, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRLfeS, { left, right, LFE, surround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCS, { left, right, centre, surround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRLsRs, { left, right, leftSurround, rightSurround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLfeS, { left, right, centre, LFE, surround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRLfeLsRs, { left, right, LFE, leftSurround, rightSurround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLsRs, { left, right, centre, leftSurround, rightSurround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLfeLsRs, { left, right, centre, LFE, leftSurround, rightSurround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLsRsCs, { left, right, centre, leftSurround, rightSurround, surround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRLsRsSlSr, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLsRsLcRc, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLsRsSlSr, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLsRsLcRcCs, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLsRsCsSlSr, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRcCs, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } }, | |||
| { Vst2::vstSpeakerConfigTypeEmpty, { unknown } } | |||
| }; | |||
| return mappings; | |||
| @@ -275,25 +275,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e | |||
| { | |||
| static const std::map<AudioChannelSet::ChannelType, int32> speakerTypeMap = | |||
| { | |||
| { AudioChannelSet::left, Vst2::kSpeakerL }, | |||
| { AudioChannelSet::right, Vst2::kSpeakerR }, | |||
| { AudioChannelSet::centre, Vst2::kSpeakerC }, | |||
| { AudioChannelSet::LFE, Vst2::kSpeakerLfe }, | |||
| { AudioChannelSet::leftSurround, Vst2::kSpeakerLs }, | |||
| { AudioChannelSet::rightSurround, Vst2::kSpeakerRs }, | |||
| { AudioChannelSet::leftCentre, Vst2::kSpeakerLc }, | |||
| { AudioChannelSet::rightCentre, Vst2::kSpeakerRc }, | |||
| { AudioChannelSet::surround, Vst2::kSpeakerS }, | |||
| { AudioChannelSet::leftSurroundRear, Vst2::kSpeakerSl }, | |||
| { AudioChannelSet::rightSurroundRear, Vst2::kSpeakerSr }, | |||
| { AudioChannelSet::topMiddle, Vst2::kSpeakerTm }, | |||
| { AudioChannelSet::topFrontLeft, Vst2::kSpeakerTfl }, | |||
| { AudioChannelSet::topFrontCentre, Vst2::kSpeakerTfc }, | |||
| { AudioChannelSet::topFrontRight, Vst2::kSpeakerTfr }, | |||
| { AudioChannelSet::topRearLeft, Vst2::kSpeakerTrl }, | |||
| { AudioChannelSet::topRearCentre, Vst2::kSpeakerTrc }, | |||
| { AudioChannelSet::topRearRight, Vst2::kSpeakerTrr }, | |||
| { AudioChannelSet::LFE2, Vst2::kSpeakerLfe2 } | |||
| { AudioChannelSet::left, Vst2::vstIndividualSpeakerTypeLeft }, | |||
| { AudioChannelSet::right, Vst2::vstIndividualSpeakerTypeRight }, | |||
| { AudioChannelSet::centre, Vst2::vstIndividualSpeakerTypeCentre }, | |||
| { AudioChannelSet::LFE, Vst2::vstIndividualSpeakerTypeLFE }, | |||
| { AudioChannelSet::leftSurround, Vst2::vstIndividualSpeakerTypeLeftSurround }, | |||
| { AudioChannelSet::rightSurround, Vst2::vstIndividualSpeakerTypeRightSurround }, | |||
| { AudioChannelSet::leftCentre, Vst2::vstIndividualSpeakerTypeLeftCentre }, | |||
| { AudioChannelSet::rightCentre, Vst2::vstIndividualSpeakerTypeRightCentre }, | |||
| { AudioChannelSet::surround, Vst2::vstIndividualSpeakerTypeSurround }, | |||
| { AudioChannelSet::leftSurroundRear, Vst2::vstIndividualSpeakerTypeLeftRearSurround }, | |||
| { AudioChannelSet::rightSurroundRear, Vst2::vstIndividualSpeakerTypeRightRearSurround }, | |||
| { AudioChannelSet::topMiddle, Vst2::vstIndividualSpeakerTypeTopMiddle }, | |||
| { AudioChannelSet::topFrontLeft, Vst2::vstIndividualSpeakerTypeTopFrontLeft }, | |||
| { AudioChannelSet::topFrontCentre, Vst2::vstIndividualSpeakerTypeTopFrontCentre }, | |||
| { AudioChannelSet::topFrontRight, Vst2::vstIndividualSpeakerTypeTopFrontRight }, | |||
| { AudioChannelSet::topRearLeft, Vst2::vstIndividualSpeakerTypeTopRearLeft }, | |||
| { AudioChannelSet::topRearCentre, Vst2::vstIndividualSpeakerTypeTopRearCentre }, | |||
| { AudioChannelSet::topRearRight, Vst2::vstIndividualSpeakerTypeTopRearRight }, | |||
| { AudioChannelSet::LFE2, Vst2::vstIndividualSpeakerTypeLFE2 } | |||
| }; | |||
| if (speakerTypeMap.find (type) == speakerTypeMap.end()) | |||
| @@ -306,25 +306,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e | |||
| { | |||
| switch (type) | |||
| { | |||
| case Vst2::kSpeakerL: return AudioChannelSet::left; | |||
| case Vst2::kSpeakerR: return AudioChannelSet::right; | |||
| case Vst2::kSpeakerC: return AudioChannelSet::centre; | |||
| case Vst2::kSpeakerLfe: return AudioChannelSet::LFE; | |||
| case Vst2::kSpeakerLs: return AudioChannelSet::leftSurround; | |||
| case Vst2::kSpeakerRs: return AudioChannelSet::rightSurround; | |||
| case Vst2::kSpeakerLc: return AudioChannelSet::leftCentre; | |||
| case Vst2::kSpeakerRc: return AudioChannelSet::rightCentre; | |||
| case Vst2::kSpeakerS: return AudioChannelSet::surround; | |||
| case Vst2::kSpeakerSl: return AudioChannelSet::leftSurroundRear; | |||
| case Vst2::kSpeakerSr: return AudioChannelSet::rightSurroundRear; | |||
| case Vst2::kSpeakerTm: return AudioChannelSet::topMiddle; | |||
| case Vst2::kSpeakerTfl: return AudioChannelSet::topFrontLeft; | |||
| case Vst2::kSpeakerTfc: return AudioChannelSet::topFrontCentre; | |||
| case Vst2::kSpeakerTfr: return AudioChannelSet::topFrontRight; | |||
| case Vst2::kSpeakerTrl: return AudioChannelSet::topRearLeft; | |||
| case Vst2::kSpeakerTrc: return AudioChannelSet::topRearCentre; | |||
| case Vst2::kSpeakerTrr: return AudioChannelSet::topRearRight; | |||
| case Vst2::kSpeakerLfe2: return AudioChannelSet::LFE2; | |||
| case Vst2::vstIndividualSpeakerTypeLeft: return AudioChannelSet::left; | |||
| case Vst2::vstIndividualSpeakerTypeRight: return AudioChannelSet::right; | |||
| case Vst2::vstIndividualSpeakerTypeCentre: return AudioChannelSet::centre; | |||
| case Vst2::vstIndividualSpeakerTypeLFE: return AudioChannelSet::LFE; | |||
| case Vst2::vstIndividualSpeakerTypeLeftSurround: return AudioChannelSet::leftSurround; | |||
| case Vst2::vstIndividualSpeakerTypeRightSurround: return AudioChannelSet::rightSurround; | |||
| case Vst2::vstIndividualSpeakerTypeLeftCentre: return AudioChannelSet::leftCentre; | |||
| case Vst2::vstIndividualSpeakerTypeRightCentre: return AudioChannelSet::rightCentre; | |||
| case Vst2::vstIndividualSpeakerTypeSurround: return AudioChannelSet::surround; | |||
| case Vst2::vstIndividualSpeakerTypeLeftRearSurround: return AudioChannelSet::leftSurroundRear; | |||
| case Vst2::vstIndividualSpeakerTypeRightRearSurround: return AudioChannelSet::rightSurroundRear; | |||
| case Vst2::vstIndividualSpeakerTypeTopMiddle: return AudioChannelSet::topMiddle; | |||
| case Vst2::vstIndividualSpeakerTypeTopFrontLeft: return AudioChannelSet::topFrontLeft; | |||
| case Vst2::vstIndividualSpeakerTypeTopFrontCentre: return AudioChannelSet::topFrontCentre; | |||
| case Vst2::vstIndividualSpeakerTypeTopFrontRight: return AudioChannelSet::topFrontRight; | |||
| case Vst2::vstIndividualSpeakerTypeTopRearLeft: return AudioChannelSet::topRearLeft; | |||
| case Vst2::vstIndividualSpeakerTypeTopRearCentre: return AudioChannelSet::topRearCentre; | |||
| case Vst2::vstIndividualSpeakerTypeTopRearRight: return AudioChannelSet::topRearRight; | |||
| case Vst2::vstIndividualSpeakerTypeLFE2: return AudioChannelSet::LFE2; | |||
| default: break; | |||
| } | |||
| @@ -0,0 +1,532 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library. | |||
| Copyright (c) 2017 - ROLI Ltd. | |||
| JUCE is an open source library subject to commercial or open-source | |||
| licensing. | |||
| By using JUCE, you agree to the terms of both the JUCE 5 End-User License | |||
| Agreement and JUCE 5 Privacy Policy (both updated and effective as of the | |||
| 27th April 2017). | |||
| End User License Agreement: www.juce.com/juce-5-licence | |||
| Privacy Policy: www.juce.com/juce-5-privacy-policy | |||
| Or: You may also use this code under the terms of the GPL v3 (see | |||
| www.gnu.org/licenses). | |||
| JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
| EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
| DISCLAIMED. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef JUCE_VSTINTERFACE_H_INCLUDED | |||
| #define JUCE_VSTINTERFACE_H_INCLUDED | |||
| using namespace juce; | |||
| #if JUCE_MSVC | |||
| #define VSTINTERFACECALL __cdecl | |||
| #pragma pack(push) | |||
| #pragma pack(8) | |||
| #elif JUCE_MAC || JUCE_IOS | |||
| #define VSTINTERFACECALL | |||
| #if JUCE_64BIT | |||
| #pragma options align=power | |||
| #else | |||
| #pragma options align=mac68k | |||
| #endif | |||
| #else | |||
| #define VSTINTERFACECALL | |||
| #pragma pack(push, 8) | |||
| #endif | |||
| const int32 juceVstInterfaceVersion = 2400; | |||
| const int32 juceVstInterfaceIdentifier = 0x56737450; // The "magic" identifier in the SDK is 'VstP'. | |||
| //============================================================================== | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct VstEffectInterface | |||
| { | |||
| int32 interfaceIdentifier; | |||
| pointer_sized_int (VSTINTERFACECALL* dispatchFunction) (VstEffectInterface*, int32 op, int32 index, pointer_sized_int value, void* ptr, float opt); | |||
| void (VSTINTERFACECALL* processAudioFunction) (VstEffectInterface*, float** inputs, float** outputs, int32 numSamples); | |||
| void (VSTINTERFACECALL* setParameterValueFunction) (VstEffectInterface*, int32 parameterIndex, float value); | |||
| float (VSTINTERFACECALL* getParameterValueFunction) (VstEffectInterface*, int32 parameterIndex); | |||
| int32 numPrograms; | |||
| int32 numParameters; | |||
| int32 numInputChannels; | |||
| int32 numOutputChannels; | |||
| int32 flags; | |||
| pointer_sized_int hostSpace1; | |||
| pointer_sized_int hostSpace2; | |||
| int32 latency; | |||
| int32 deprecated1; | |||
| int32 deprecated2; | |||
| float deprecated3; | |||
| void* effectPointer; | |||
| void* userPointer; | |||
| int32 plugInIdentifier; | |||
| int32 plugInVersion; | |||
| void (VSTINTERFACECALL* processAudioInplaceFunction) (VstEffectInterface*, float** inputs, float** outputs, int32 numSamples); | |||
| void (VSTINTERFACECALL* processDoubleAudioInplaceFunction) (VstEffectInterface*, double** inputs, double** outputs, int32 numSamples); | |||
| char emptySpace[56]; | |||
| }; | |||
| typedef pointer_sized_int (VSTINTERFACECALL* VstHostCallback) (VstEffectInterface*, int32 op, int32 index, pointer_sized_int value, void* ptr, float opt); | |||
| enum VstEffectInterfaceFlags | |||
| { | |||
| vstEffectFlagHasEditor = 1, | |||
| vstEffectFlagInplaceAudio = 16, | |||
| vstEffectFlagDataInChunks = 32, | |||
| vstEffectFlagIsSynth = 256, | |||
| vstEffectFlagInplaceDoubleAudio = 4096 | |||
| }; | |||
| //============================================================================== | |||
| enum VstHostToPlugInOpcodes | |||
| { | |||
| plugInOpcodeOpen, | |||
| plugInOpcodeClose, | |||
| plugInOpcodeSetCurrentProgram, | |||
| plugInOpcodeGetCurrentProgram, | |||
| plugInOpcodeSetCurrentProgramName, | |||
| plugInOpcodeGetCurrentProgramName, | |||
| plugInOpcodeGetParameterLabel, | |||
| plugInOpcodeGetParameterText, | |||
| plugInOpcodeGetParameterName, | |||
| plugInOpcodeSetSampleRate = plugInOpcodeGetParameterName + 2, | |||
| plugInOpcodeSetBlockSize, | |||
| plugInOpcodeResumeSuspend, | |||
| plugInOpcodeGetEditorBounds, | |||
| plugInOpcodeOpenEditor, | |||
| plugInOpcodeCloseEditor, | |||
| plugInOpcodeDrawEditor, | |||
| plugInOpcodeGetMouse, | |||
| plugInOpcodeEditorIdle = plugInOpcodeGetMouse + 2, | |||
| plugInOpcodeeffEditorTop, | |||
| plugInOpcodeSleepEditor, | |||
| plugInOpcodeIdentify, | |||
| plugInOpcodeGetData, | |||
| plugInOpcodeSetData, | |||
| plugInOpcodePreAudioProcessingEvents, | |||
| plugInOpcodeIsParameterAutomatable, | |||
| plugInOpcodeParameterValueForText, | |||
| plugInOpcodeGetProgramName = plugInOpcodeParameterValueForText + 2, | |||
| plugInOpcodeConnectInput = plugInOpcodeGetProgramName + 2, | |||
| plugInOpcodeConnectOutput, | |||
| plugInOpcodeGetInputPinProperties, | |||
| plugInOpcodeGetOutputPinProperties, | |||
| plugInOpcodeGetPlugInCategory, | |||
| plugInOpcodeSetSpeakerConfiguration = plugInOpcodeGetPlugInCategory + 7, | |||
| plugInOpcodeSetBypass = plugInOpcodeSetSpeakerConfiguration + 2, | |||
| plugInOpcodeGetPlugInName, | |||
| plugInOpcodeGetManufacturerName = plugInOpcodeGetPlugInName + 2, | |||
| plugInOpcodeGetManufacturerProductName, | |||
| plugInOpcodeGetManufacturerVersion, | |||
| plugInOpcodeManufacturerSpecific, | |||
| plugInOpcodeCanPlugInDo, | |||
| plugInOpcodeGetTailSize, | |||
| plugInOpcodeIdle, | |||
| plugInOpcodeKeyboardFocusRequired = plugInOpcodeIdle + 4, | |||
| plugInOpcodeGetVstInterfaceVersion, | |||
| plugInOpcodeGetCurrentMidiProgram = plugInOpcodeGetVstInterfaceVersion + 5, | |||
| plugInOpcodeGetSpeakerArrangement = plugInOpcodeGetCurrentMidiProgram + 6, | |||
| plugInOpcodeNextPlugInUniqueID, | |||
| plugInOpcodeStartProcess, | |||
| plugInOpcodeStopProcess, | |||
| plugInOpcodeSetNumberOfSamplesToProcess, | |||
| plugInOpcodeSetSampleFloatType = plugInOpcodeSetNumberOfSamplesToProcess + 4, | |||
| pluginOpcodeGetNumMidiInputChannels, | |||
| pluginOpcodeGetNumMidiOutputChannels, | |||
| plugInOpcodeMaximum = pluginOpcodeGetNumMidiOutputChannels | |||
| }; | |||
| enum VstPlugInToHostOpcodes | |||
| { | |||
| hostOpcodeParameterChanged, | |||
| hostOpcodeVstVersion, | |||
| hostOpcodeCurrentId, | |||
| hostOpcodeIdle, | |||
| hostOpcodePinConnected, | |||
| hostOpcodePlugInWantsMidi = hostOpcodePinConnected + 2, | |||
| hostOpcodeGetTimingInfo, | |||
| hostOpcodePreAudioProcessingEvents, | |||
| hostOpcodeSetTime, | |||
| hostOpcodeTempoAt, | |||
| hostOpcodeGetNumberOfAutomatableParameters, | |||
| hostOpcodeGetParameterInterval, | |||
| hostOpcodeIOModified, | |||
| hostOpcodeNeedsIdle, | |||
| hostOpcodeWindowSize, | |||
| hostOpcodeGetSampleRate, | |||
| hostOpcodeGetBlockSize, | |||
| hostOpcodeGetInputLatency, | |||
| hostOpcodeGetOutputLatency, | |||
| hostOpcodeGetPreviousPlugIn, | |||
| hostOpcodeGetNextPlugIn, | |||
| hostOpcodeWillReplace, | |||
| hostOpcodeGetCurrentAudioProcessingLevel, | |||
| hostOpcodeGetAutomationState, | |||
| hostOpcodeOfflineStart, | |||
| hostOpcodeOfflineReadSource, | |||
| hostOpcodeOfflineWrite, | |||
| hostOpcodeOfflineGetCurrentPass, | |||
| hostOpcodeOfflineGetCurrentMetaPass, | |||
| hostOpcodeSetOutputSampleRate, | |||
| hostOpcodeGetOutputSpeakerConfiguration, | |||
| hostOpcodeGetManufacturerName, | |||
| hostOpcodeGetProductName, | |||
| hostOpcodeGetManufacturerVersion, | |||
| hostOpcodeManufacturerSpecific, | |||
| hostOpcodeSetIcon, | |||
| hostOpcodeCanHostDo, | |||
| hostOpcodeGetLanguage, | |||
| hostOpcodeOpenEditorWindow, | |||
| hostOpcodeCloseEditorWindow, | |||
| hostOpcodeGetDirectory, | |||
| hostOpcodeUpdateView, | |||
| hostOpcodeParameterChangeGestureBegin, | |||
| hostOpcodeParameterChangeGestureEnd, | |||
| }; | |||
| //============================================================================== | |||
| enum VstProcessingSampleType | |||
| { | |||
| vstProcessingSampleTypeFloat, | |||
| vstProcessingSampleTypeDouble | |||
| }; | |||
| //============================================================================== | |||
| // These names must be identical to the Steinberg SDK so JUCE users can set | |||
| // exactly what they want. | |||
| enum VstPlugInCategory | |||
| { | |||
| kPlugCategUnknown, | |||
| kPlugCategEffect, | |||
| kPlugCategSynth, | |||
| kPlugCategAnalysis, | |||
| kPlugCategMastering, | |||
| kPlugCategSpacializer, | |||
| kPlugCategRoomFx, | |||
| kPlugSurroundFx, | |||
| kPlugCategRestoration, | |||
| kPlugCategOfflineProcess, | |||
| kPlugCategShell, | |||
| kPlugCategGenerator | |||
| }; | |||
| //============================================================================== | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct VstEditorBounds | |||
| { | |||
| int16 upper; | |||
| int16 leftmost; | |||
| int16 lower; | |||
| int16 rightmost; | |||
| }; | |||
| //============================================================================== | |||
| enum VstMaxStringLengths | |||
| { | |||
| vstMaxNameLength = 64, | |||
| vstMaxParameterOrPinLabelLength = 64, | |||
| vstMaxParameterOrPinShortLabelLength = 8, | |||
| vstMaxCategoryLength = 24, | |||
| vstMaxManufacturerStringLength = 64, | |||
| vstMaxPlugInNameStringLength = 64 | |||
| }; | |||
| //============================================================================== | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct VstPinInfo | |||
| { | |||
| char text[vstMaxParameterOrPinLabelLength]; | |||
| int32 flags; | |||
| int32 configurationType; | |||
| char shortText[vstMaxParameterOrPinShortLabelLength]; | |||
| char unused[48]; | |||
| }; | |||
| enum VstPinInfoFlags | |||
| { | |||
| vstPinInfoFlagIsActive = 1, | |||
| vstPinInfoFlagIsStereo = 2, | |||
| vstPinInfoFlagValid = 4 | |||
| }; | |||
| //============================================================================== | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct VstEvent | |||
| { | |||
| int32 type; | |||
| int32 size; | |||
| int32 sampleOffset; | |||
| int32 flags; | |||
| char content[16]; | |||
| }; | |||
| enum VstEventTypes | |||
| { | |||
| vstMidiEventType = 1, | |||
| vstSysExEventType = 6 | |||
| }; | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct VstEventBlock | |||
| { | |||
| int32 numberOfEvents; | |||
| pointer_sized_int future; | |||
| VstEvent* events[2]; | |||
| }; | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct VstMidiEvent | |||
| { | |||
| int32 type; | |||
| int32 size; | |||
| int32 sampleOffset; | |||
| int32 flags; | |||
| int32 noteSampleLength; | |||
| int32 noteSampleOffset; | |||
| char midiData[4]; | |||
| char tuning; | |||
| char noteVelocityOff; | |||
| char future1; | |||
| char future2; | |||
| }; | |||
| enum VstMidiEventFlags | |||
| { | |||
| vstMidiEventIsRealtime = 1 | |||
| }; | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct VstSysExEvent | |||
| { | |||
| int32 type; | |||
| int32 size; | |||
| int32 offsetSamples; | |||
| int32 flags; | |||
| int32 sysExDumpSize; | |||
| pointer_sized_int future1; | |||
| char* sysExDump; | |||
| pointer_sized_int future2; | |||
| }; | |||
| //============================================================================== | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct VstTimingInformation | |||
| { | |||
| double samplePosition; | |||
| double sampleRate; | |||
| double systemTimeNanoseconds; | |||
| double musicalPosition; | |||
| double tempoBPM; | |||
| double lastBarPosition; | |||
| double loopStartPosition; | |||
| double loopEndPosition; | |||
| int32 timeSignatureNumerator; | |||
| int32 timeSignatureDenominator; | |||
| int32 smpteOffset; | |||
| int32 smpteRate; | |||
| int32 samplesToNearestClock; | |||
| int32 flags; | |||
| }; | |||
| enum VstTimingInformationFlags | |||
| { | |||
| vstTimingInfoFlagTransportChanged = 1, | |||
| vstTimingInfoFlagCurrentlyPlaying = 2, | |||
| vstTimingInfoFlagLoopActive = 4, | |||
| vstTimingInfoFlagCurrentlyRecording = 8, | |||
| vstTimingInfoFlagAutomationWriteModeActive = 64, | |||
| vstTimingInfoFlagAutomationReadModeActive = 128, | |||
| vstTimingInfoFlagNanosecondsValid = 256, | |||
| vstTimingInfoFlagMusicalPositionValid = 512, | |||
| vstTimingInfoFlagTempoValid = 1024, | |||
| vstTimingInfoFlagLastBarPositionValid = 2048, | |||
| vstTimingInfoFlagLoopPositionValid = 4096, | |||
| vstTimingInfoFlagTimeSignatureValid = 8192, | |||
| vstTimingInfoFlagSmpteValid = 16384, | |||
| vstTimingInfoFlagNearestClockValid = 32768 | |||
| }; | |||
| //============================================================================== | |||
| enum VstSmpteRates | |||
| { | |||
| vstSmpteRateFps24, | |||
| vstSmpteRateFps25, | |||
| vstSmpteRateFps2997, | |||
| vstSmpteRateFps30, | |||
| vstSmpteRateFps2997drop, | |||
| vstSmpteRateFps30drop, | |||
| vstSmpteRate16mmFilm, | |||
| vstSmpteRate35mmFilm, | |||
| vstSmpteRateFps239 = vstSmpteRate35mmFilm + 3, | |||
| vstSmpteRateFps249 , | |||
| vstSmpteRateFps599, | |||
| vstSmpteRateFps60 | |||
| }; | |||
| //============================================================================== | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct VstIndividualSpeakerInfo | |||
| { | |||
| float azimuthalAngle; | |||
| float elevationAngle; | |||
| float radius; | |||
| float reserved; | |||
| char label[vstMaxNameLength]; | |||
| int32 type; | |||
| char unused[28]; | |||
| }; | |||
| enum VstIndividualSpeakerType | |||
| { | |||
| vstIndividualSpeakerTypeUndefined = 0x7fffffff, | |||
| vstIndividualSpeakerTypeMono = 0, | |||
| vstIndividualSpeakerTypeLeft, | |||
| vstIndividualSpeakerTypeRight, | |||
| vstIndividualSpeakerTypeCentre, | |||
| vstIndividualSpeakerTypeLFE, | |||
| vstIndividualSpeakerTypeLeftSurround, | |||
| vstIndividualSpeakerTypeRightSurround, | |||
| vstIndividualSpeakerTypeLeftCentre, | |||
| vstIndividualSpeakerTypeRightCentre, | |||
| vstIndividualSpeakerTypeSurround, | |||
| vstIndividualSpeakerTypeCentreSurround = vstIndividualSpeakerTypeSurround, | |||
| vstIndividualSpeakerTypeLeftRearSurround, | |||
| vstIndividualSpeakerTypeRightRearSurround, | |||
| vstIndividualSpeakerTypeTopMiddle, | |||
| vstIndividualSpeakerTypeTopFrontLeft, | |||
| vstIndividualSpeakerTypeTopFrontCentre, | |||
| vstIndividualSpeakerTypeTopFrontRight, | |||
| vstIndividualSpeakerTypeTopRearLeft, | |||
| vstIndividualSpeakerTypeTopRearCentre, | |||
| vstIndividualSpeakerTypeTopRearRight, | |||
| vstIndividualSpeakerTypeLFE2 | |||
| }; | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct VstSpeakerConfiguration | |||
| { | |||
| int32 type; | |||
| int32 numberOfChannels; | |||
| VstIndividualSpeakerInfo speakers[8]; | |||
| }; | |||
| enum VstSpeakerConfigurationType | |||
| { | |||
| vstSpeakerConfigTypeUser = -2, | |||
| vstSpeakerConfigTypeEmpty = -1, | |||
| vstSpeakerConfigTypeMono = 0, | |||
| vstSpeakerConfigTypeLR, | |||
| vstSpeakerConfigTypeLsRs, | |||
| vstSpeakerConfigTypeLcRc, | |||
| vstSpeakerConfigTypeSlSr, | |||
| vstSpeakerConfigTypeCLfe, | |||
| vstSpeakerConfigTypeLRC, | |||
| vstSpeakerConfigTypeLRS, | |||
| vstSpeakerConfigTypeLRCLfe, | |||
| vstSpeakerConfigTypeLRLfeS, | |||
| vstSpeakerConfigTypeLRCS, | |||
| vstSpeakerConfigTypeLRLsRs, | |||
| vstSpeakerConfigTypeLRCLfeS, | |||
| vstSpeakerConfigTypeLRLfeLsRs, | |||
| vstSpeakerConfigTypeLRCLsRs, | |||
| vstSpeakerConfigTypeLRCLfeLsRs, | |||
| vstSpeakerConfigTypeLRCLsRsCs, | |||
| vstSpeakerConfigTypeLRLsRsSlSr, | |||
| vstSpeakerConfigTypeLRCLfeLsRsCs, | |||
| vstSpeakerConfigTypeLRLfeLsRsSlSr, | |||
| vstSpeakerConfigTypeLRCLsRsLcRc, | |||
| vstSpeakerConfigTypeLRCLsRsSlSr, | |||
| vstSpeakerConfigTypeLRCLfeLsRsLcRc, | |||
| vstSpeakerConfigTypeLRCLfeLsRsSlSr, | |||
| vstSpeakerConfigTypeLRCLsRsLcRcCs, | |||
| vstSpeakerConfigTypeLRCLsRsCsSlSr, | |||
| vstSpeakerConfigTypeLRCLfeLsRsLcRcCs, | |||
| vstSpeakerConfigTypeLRCLfeLsRsCsSlSr, | |||
| vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2 | |||
| }; | |||
| #if JUCE_BIG_ENDIAN | |||
| #define JUCE_MULTICHAR_CONSTANT(a, b, c, d) (a | (((uint32) b) << 8) | (((uint32) c) << 16) | (((uint32) d) << 24)) | |||
| #else | |||
| #define JUCE_MULTICHAR_CONSTANT(a, b, c, d) (d | (((uint32) c) << 8) | (((uint32) b) << 16) | (((uint32) a) << 24)) | |||
| #endif | |||
| enum PresonusExtensionConstants | |||
| { | |||
| presonusVendorID = JUCE_MULTICHAR_CONSTANT ('P', 'r', 'e', 'S'), | |||
| presonusSetContentScaleFactor = JUCE_MULTICHAR_CONSTANT ('A', 'e', 'C', 's') | |||
| }; | |||
| //============================================================================== | |||
| /** Structure used for VSTs | |||
| @tags{Audio} | |||
| */ | |||
| struct vst2FxBank | |||
| { | |||
| int32 magic1; | |||
| int32 size; | |||
| int32 magic2; | |||
| int32 version1; | |||
| int32 fxID; | |||
| int32 version2; | |||
| int32 elements; | |||
| int32 current; | |||
| char shouldBeZero[124]; | |||
| int32 chunkSize; | |||
| char chunk[1]; | |||
| }; | |||
| #if JUCE_MSVC | |||
| #pragma pack(pop) | |||
| #elif JUCE_MAC || JUCE_IOS | |||
| #pragma options align=reset | |||
| #else | |||
| #pragma pack(pop) | |||
| #endif | |||
| #endif // JUCE_VSTINTERFACE_H_INCLUDED | |||
| @@ -57,7 +57,7 @@ public: | |||
| numEventsUsed = 0; | |||
| if (events != nullptr) | |||
| events->numEvents = 0; | |||
| events->numberOfEvents = 0; | |||
| } | |||
| void addEvent (const void* const midiData, int numBytes, int frameOffset) | |||
| @@ -66,50 +66,50 @@ public: | |||
| void* const ptr = (Vst2::VstMidiEvent*) (events->events [numEventsUsed]); | |||
| auto* const e = (Vst2::VstMidiEvent*) ptr; | |||
| events->numEvents = ++numEventsUsed; | |||
| events->numberOfEvents = ++numEventsUsed; | |||
| if (numBytes <= 4) | |||
| { | |||
| if (e->type == Vst2::kVstSysExType) | |||
| if (e->type == Vst2::vstSysExEventType) | |||
| { | |||
| delete[] (((Vst2::VstMidiSysexEvent*) ptr)->sysexDump); | |||
| e->type = Vst2::kVstMidiType; | |||
| e->byteSize = sizeof (Vst2::VstMidiEvent); | |||
| e->noteLength = 0; | |||
| e->noteOffset = 0; | |||
| e->detune = 0; | |||
| e->noteOffVelocity = 0; | |||
| delete[] (((Vst2::VstSysExEvent*) ptr)->sysExDump); | |||
| e->type = Vst2::vstMidiEventType; | |||
| e->size = sizeof (Vst2::VstMidiEvent); | |||
| e->noteSampleLength = 0; | |||
| e->noteSampleOffset = 0; | |||
| e->tuning = 0; | |||
| e->noteVelocityOff = 0; | |||
| } | |||
| e->deltaFrames = frameOffset; | |||
| e->sampleOffset = frameOffset; | |||
| memcpy (e->midiData, midiData, (size_t) numBytes); | |||
| } | |||
| else | |||
| { | |||
| auto* const se = (Vst2::VstMidiSysexEvent*) ptr; | |||
| auto* const se = (Vst2::VstSysExEvent*) ptr; | |||
| if (se->type == Vst2::kVstSysExType) | |||
| delete[] se->sysexDump; | |||
| if (se->type == Vst2::vstSysExEventType) | |||
| delete[] se->sysExDump; | |||
| se->sysexDump = new char [(size_t) numBytes]; | |||
| memcpy (se->sysexDump, midiData, (size_t) numBytes); | |||
| se->sysExDump = new char [(size_t) numBytes]; | |||
| memcpy (se->sysExDump, midiData, (size_t) numBytes); | |||
| se->type = Vst2::kVstSysExType; | |||
| se->byteSize = sizeof (Vst2::VstMidiSysexEvent); | |||
| se->deltaFrames = frameOffset; | |||
| se->type = Vst2::vstSysExEventType; | |||
| se->size = sizeof (Vst2::VstSysExEvent); | |||
| se->offsetSamples = frameOffset; | |||
| se->flags = 0; | |||
| se->dumpBytes = numBytes; | |||
| se->resvd1 = 0; | |||
| se->resvd2 = 0; | |||
| se->sysExDumpSize = numBytes; | |||
| se->future1 = 0; | |||
| se->future2 = 0; | |||
| } | |||
| } | |||
| //============================================================================== | |||
| // Handy method to pull the events out of an event buffer supplied by the host | |||
| // or plugin. | |||
| static void addEventsToMidiBuffer (const Vst2::VstEvents* events, MidiBuffer& dest) | |||
| static void addEventsToMidiBuffer (const Vst2::VstEventBlock* events, MidiBuffer& dest) | |||
| { | |||
| for (int i = 0; i < events->numEvents; ++i) | |||
| for (int i = 0; i < events->numberOfEvents; ++i) | |||
| { | |||
| const Vst2::VstEvent* const e = events->events[i]; | |||
| @@ -117,17 +117,17 @@ public: | |||
| { | |||
| const void* const ptr = events->events[i]; | |||
| if (e->type == Vst2::kVstMidiType) | |||
| if (e->type == Vst2::vstMidiEventType) | |||
| { | |||
| dest.addEvent ((const juce::uint8*) ((const Vst2::VstMidiEvent*) ptr)->midiData, | |||
| 4, e->deltaFrames); | |||
| 4, e->sampleOffset); | |||
| } | |||
| else if (e->type == Vst2::kVstSysExType) | |||
| else if (e->type == Vst2::vstSysExEventType) | |||
| { | |||
| const auto* se = (const Vst2::VstMidiSysexEvent*) ptr; | |||
| dest.addEvent ((const juce::uint8*) se->sysexDump, | |||
| (int) se->dumpBytes, | |||
| e->deltaFrames); | |||
| const auto* se = (const Vst2::VstSysExEvent*) ptr; | |||
| dest.addEvent ((const juce::uint8*) se->sysExDump, | |||
| (int) se->sysExDumpSize, | |||
| e->sampleOffset); | |||
| } | |||
| } | |||
| } | |||
| @@ -168,25 +168,25 @@ public: | |||
| } | |||
| //============================================================================== | |||
| HeapBlock<Vst2::VstEvents> events; | |||
| HeapBlock<Vst2::VstEventBlock> events; | |||
| private: | |||
| int numEventsUsed, numEventsAllocated; | |||
| static Vst2::VstEvent* allocateVSTEvent() | |||
| { | |||
| auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstMidiSysexEvent) ? sizeof (Vst2::VstMidiEvent) | |||
| : sizeof (Vst2::VstMidiSysexEvent)); | |||
| e->type = Vst2::kVstMidiType; | |||
| e->byteSize = sizeof (Vst2::VstMidiEvent); | |||
| auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstSysExEvent) ? sizeof (Vst2::VstMidiEvent) | |||
| : sizeof (Vst2::VstSysExEvent)); | |||
| e->type = Vst2::vstMidiEventType; | |||
| e->size = sizeof (Vst2::VstMidiEvent); | |||
| return e; | |||
| } | |||
| static void freeVSTEvent (Vst2::VstEvent* e) | |||
| { | |||
| if (e->type == Vst2::kVstSysExType) | |||
| if (e->type == Vst2::vstSysExEventType) | |||
| { | |||
| delete[] (reinterpret_cast<Vst2::VstMidiSysexEvent*> (e)->sysexDump); | |||
| delete[] (reinterpret_cast<Vst2::VstSysExEvent*> (e)->sysExDump); | |||
| } | |||
| std::free (e); | |||