Initial release
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.25.0)
|
||||
|
||||
project(smtg-vst3-remapparamid
|
||||
VERSION ${vstsdk_VERSION}.0
|
||||
DESCRIPTION "Steinberg VST 3 Remap ParamID example"
|
||||
)
|
||||
|
||||
set(COMPATIBILITY_FILE resource/vst_compatibility.json)
|
||||
|
||||
smtg_add_vst3plugin(remap-paramid
|
||||
MODULEINFO_COMPATIBILITY
|
||||
${COMPATIBILITY_FILE}
|
||||
source/version.h
|
||||
source/remapparamidcids.h
|
||||
source/remapparamidprocessor.h
|
||||
source/remapparamidprocessor.cpp
|
||||
source/remapparamidcontroller.h
|
||||
source/remapparamidcontroller.cpp
|
||||
source/remapparamidentry.cpp
|
||||
README.md
|
||||
)
|
||||
|
||||
smtg_target_setup_as_vst3_example(remap-paramid)
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
# Test Remap ParamID
|
||||
|
||||
## Introduction
|
||||
|
||||
As part of the [VST 3 Plug-ins Examples](https://steinbergmedia.github.io/vst3_dev_portal/pages/What+is+the+VST+3+SDK/Plug-in+Examples.html), [Test Remap ParamID](https://steinbergmedia.github.io/vst3_dev_portal/pages/What+is+the+VST+3+SDK/Plug-in+Examples.html?#test-remap-paramid) is a simple FX plug-in that demonstrates how a **VST 3** Plug-in could replace another one.
|
||||
In this example, it could replace the [AGain](https://steinbergmedia.github.io/vst3_dev_portal/pages/What+is+the+VST+3+SDK/Plug-in+Examples.html?#again) plug-in when it is not available. It illustrates the use of the interface [IRemapParamID](https://steinbergmedia.github.io/vst3_dev_portal/pages/Technical+Documentation/Change+History/3.7.11/IRemapParamID.html) (for mapping [Test Remap ParamID](https://steinbergmedia.github.io/vst3_dev_portal/pages/What+is+the+VST+3+SDK/Plug-in+Examples.html?#test-remap-paramid) parameters to AGain plug-in parameters) and the [module info](https://steinbergmedia.github.io/vst3_dev_portal/pages/Technical+Documentation/VST+Module+Architecture/ModuleInfo-JSON.html) with its compatibility field.
|
||||
|
||||
> See also: [Online Documentation](https://steinbergmedia.github.io/vst3_dev_portal/pages/What+is+the+VST+3+SDK/Plug-in+Examples.html#test-remap-paramid).
|
||||
|
||||
## Getting Started
|
||||
|
||||
This plug-in is part of the VST 3 SDK package. It is created with the VST 3 SDK root project.
|
||||
|
||||
> See the top-level README of the VST 3 SDK: https://github.com/steinbergmedia/vst3sdk.git
|
||||
|
||||
## Getting Help
|
||||
|
||||
* Read through the SDK documentation on the **[VST 3 Developer Portal](https://steinbergmedia.github.io/vst3_dev_portal/pages/index.html)**
|
||||
* Ask some real people in the official **[VST 3 Developer Forum](https://forums.steinberg.net/c/developer/103)**
|
||||
@@ -0,0 +1,45 @@
|
||||
#include <windows.h>
|
||||
#include "../source/version.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Version
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION MAJOR_VERSION_INT,SUB_VERSION_INT,RELEASE_NUMBER_INT,BUILD_NUMBER_INT
|
||||
PRODUCTVERSION MAJOR_VERSION_INT,SUB_VERSION_INT,RELEASE_NUMBER_INT,BUILD_NUMBER_INT
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040004e4"
|
||||
BEGIN
|
||||
VALUE "FileVersion", FULL_VERSION_STR
|
||||
VALUE "ProductVersion", FULL_VERSION_STR
|
||||
VALUE "OriginalFilename", stringOriginalFilename
|
||||
VALUE "FileDescription", stringFileDescription
|
||||
VALUE "InternalName", stringFileDescription
|
||||
VALUE "ProductName", stringFileDescription
|
||||
VALUE "CompanyName", stringCompanyName
|
||||
VALUE "LegalCopyright", stringLegalCopyright
|
||||
VALUE "LegalTrademarks", stringLegalTrademarks
|
||||
//VALUE "PrivateBuild", " \0"
|
||||
//VALUE "SpecialBuild", " \0"
|
||||
//VALUE "Comments", " \0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x400, 1252
|
||||
END
|
||||
END
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"New": "1012FB81B92C57E485AD3D5D5FC2469D", // Test Remap ParamID
|
||||
"Old": [
|
||||
"84E8DE5F92554F5396FAE4133C935A18", // AGain
|
||||
],
|
||||
},
|
||||
]
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/remap_paramid/source/remapparamidcontroller.h
|
||||
// Created by : Steinberg, 02/2024
|
||||
// Description : Remap ParamID Example for VST 3
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "pluginterfaces/base/funknown.h"
|
||||
#include "pluginterfaces/vst/vsttypes.h"
|
||||
|
||||
namespace Steinberg {
|
||||
//------------------------------------------------------------------------
|
||||
static const FUID kTestRemapParamIDProcessorUID (0x1012FB81, 0xB92C57E4, 0x85AD3D5D, 0x5FC2469D);
|
||||
static const FUID kTestRemapParamIDControllerUID (0x0F1CA171, 0xFC7755DC, 0x906DD887, 0x2363F93A);
|
||||
|
||||
#define TestRemapParamIDVST3Category "Fx"
|
||||
|
||||
enum RemapParamID : Vst::ParamID
|
||||
{
|
||||
kMyGainParamTag = 123,
|
||||
|
||||
kBypassId = 1000
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // namespace Steinberg
|
||||
Vendored
+104
@@ -0,0 +1,104 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/remap_paramid/source/remapparamidcontroller.cpp
|
||||
// Created by : Steinberg, 02/2024
|
||||
// Description : Remap ParamID Example for VST 3 (by replacing AGain)
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "remapparamidcontroller.h"
|
||||
#include "remapparamidcids.h"
|
||||
#include "base/source/fstreamer.h"
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// TestRemapParamIDController Implementation
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API TestRemapParamIDController::initialize (FUnknown* context)
|
||||
{
|
||||
// Here the Plug-in will be instantiated
|
||||
|
||||
//---do not forget to call parent ------
|
||||
tresult result = EditController::initialize (context);
|
||||
if (result != kResultOk)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//---this parameter is the one which is compatible with the kGainId parameter of AGain
|
||||
parameters.addParameter (STR16 ("compatible Gain"), nullptr, 0, 0.5,
|
||||
ParameterInfo::kCanAutomate, kMyGainParamTag);
|
||||
|
||||
//---Bypass parameter---
|
||||
parameters.addParameter (STR16 ("Bypass"), nullptr, 1, 0,
|
||||
ParameterInfo::kCanAutomate | ParameterInfo::kIsBypass, kBypassId);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API TestRemapParamIDController::setComponentState (IBStream* state)
|
||||
{
|
||||
// Here you get the state of the component (Processor part)
|
||||
if (!state)
|
||||
return kResultFalse;
|
||||
|
||||
//---Compatible with AGain state -----------
|
||||
IBStreamer streamer (state, kLittleEndian);
|
||||
float savedGain = 0.f;
|
||||
if (streamer.readFloat (savedGain) == false)
|
||||
return kResultFalse;
|
||||
setParamNormalized (kMyGainParamTag, savedGain);
|
||||
|
||||
// jump the GainReduction
|
||||
streamer.seek (sizeof (float), kSeekCurrent);
|
||||
|
||||
int32 bypassState = 0;
|
||||
if (streamer.readInt32 (bypassState) == false)
|
||||
return kResultFalse;
|
||||
setParamNormalized (kBypassId, bypassState ? 1 : 0);
|
||||
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API TestRemapParamIDController::getCompatibleParamID (const TUID pluginToReplaceUID,
|
||||
Vst::ParamID oldParamID,
|
||||
Vst::ParamID& newParamID)
|
||||
{
|
||||
//--- We want to replace the AGain plug-in-------
|
||||
//--- check if the host is asking for remapping parameter of the AGain plug-in
|
||||
static const FUID AGainProcessorUID (0x84E8DE5F, 0x92554F53, 0x96FAE413, 0x3C935A18);
|
||||
FUID uidToCheck (FUID::fromTUID (pluginToReplaceUID));
|
||||
if (AGainProcessorUID != uidToCheck)
|
||||
return kResultFalse;
|
||||
|
||||
//--- host wants to remap from AGain------------
|
||||
newParamID = -1;
|
||||
switch (oldParamID)
|
||||
{
|
||||
//--- map the kGainId (0) to our param kMyGainParamTag
|
||||
case 0:
|
||||
{
|
||||
newParamID = kMyGainParamTag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//--- return kResultTrue if the mapping happens------------
|
||||
return (newParamID == -1) ? kResultFalse : kResultTrue;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // namespace Vst
|
||||
} // namespace Steinberg
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/remap_paramid/source/remapparamidcontroller.h
|
||||
// Created by : Steinberg, 02/2024
|
||||
// Description : Remap ParamID Example for VST 3
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "public.sdk/source/vst/vsteditcontroller.h"
|
||||
#include "pluginterfaces/vst/ivstremapparamid.h"
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// TestRemapParamIDController
|
||||
//------------------------------------------------------------------------
|
||||
class TestRemapParamIDController : public EditController, public IRemapParamID
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------
|
||||
TestRemapParamIDController () = default;
|
||||
~TestRemapParamIDController () SMTG_OVERRIDE = default;
|
||||
|
||||
// Create function
|
||||
static FUnknown* createInstance (void* /*context*/)
|
||||
{
|
||||
return (Vst::IEditController*)new TestRemapParamIDController;
|
||||
}
|
||||
|
||||
//--- from IPluginBase -----------------------------------------------
|
||||
tresult PLUGIN_API initialize (FUnknown* context) SMTG_OVERRIDE;
|
||||
|
||||
//--- from EditController --------------------------------------------
|
||||
tresult PLUGIN_API setComponentState (IBStream* state) SMTG_OVERRIDE;
|
||||
|
||||
//--- from IRemapParamID ---------------------------------------------
|
||||
tresult PLUGIN_API getCompatibleParamID (const TUID pluginToReplaceUID /*in*/,
|
||||
Vst::ParamID oldParamID /*in*/,
|
||||
Vst::ParamID& newParamID /*out*/) override;
|
||||
|
||||
//---Interface---------
|
||||
DEFINE_INTERFACES
|
||||
DEF_INTERFACE (IRemapParamID)
|
||||
END_DEFINE_INTERFACES (EditController)
|
||||
DELEGATE_REFCOUNT (EditController)
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
protected:
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // namespace Vst
|
||||
} // namespace Steinberg
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/remap_paramid/source/remapparamidcontroller.h
|
||||
// Created by : Steinberg, 02/2024
|
||||
// Description : Remap ParamID Example for VST 3
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "remapparamidcids.h"
|
||||
#include "remapparamidcontroller.h"
|
||||
#include "remapparamidprocessor.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "public.sdk/source/main/pluginfactory.h"
|
||||
|
||||
#define stringPluginName "Test Remap ParamID"
|
||||
|
||||
using namespace Steinberg;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// VST Plug-in Entry
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
BEGIN_FACTORY_DEF ("Steinberg", "https://www.mycompanyname.com", "mailto:test@test.fr")
|
||||
|
||||
//---First Plug-in included in this factory-------
|
||||
// its kVstAudioEffectClass component
|
||||
DEF_CLASS2 (
|
||||
INLINE_UID_FROM_FUID (kTestRemapParamIDProcessorUID),
|
||||
PClassInfo::kManyInstances, // cardinality
|
||||
kVstAudioEffectClass, // the component category (do not changed this)
|
||||
stringPluginName, // here the Plug-in name (to be changed)
|
||||
Vst::kDistributable, // means that component and controller could be distributed on different
|
||||
// computers
|
||||
TestRemapParamIDVST3Category, // Subcategory for this Plug-in (to be changed)
|
||||
FULL_VERSION_STR, // Plug-in version (to be changed)
|
||||
kVstVersionString, // the VST 3 SDK version (do not changed this, use always this define)
|
||||
Vst::TestRemapParamIDProcessor::createInstance) // function pointer called when this component
|
||||
// should be instantiated
|
||||
|
||||
// its kVstComponentControllerClass component
|
||||
DEF_CLASS2 (
|
||||
INLINE_UID_FROM_FUID (kTestRemapParamIDControllerUID),
|
||||
PClassInfo::kManyInstances, // cardinality
|
||||
kVstComponentControllerClass, // the Controller category (do not changed this)
|
||||
stringPluginName "Controller", // controller name (could be the same than component name)
|
||||
0, // not used here
|
||||
"", // not used here
|
||||
FULL_VERSION_STR, // Plug-in version (to be changed)
|
||||
kVstVersionString, // the VST 3 SDK version (do not changed this, use always this define)
|
||||
Vst::TestRemapParamIDController::createInstance) // function pointer called when this component
|
||||
// should be instantiated
|
||||
|
||||
//----for others Plug-ins contained in this factory, put like for the first Plug-in different
|
||||
//DEF_CLASS2---
|
||||
|
||||
END_FACTORY
|
||||
Vendored
+253
@@ -0,0 +1,253 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/remap_paramid/source/remapparamidprocessor.cpp
|
||||
// Created by : Steinberg, 02/2024
|
||||
// Description : Remap ParamID Example for VST 3
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "remapparamidprocessor.h"
|
||||
#include "remapparamidcids.h"
|
||||
|
||||
#include "public.sdk/source/vst/vstaudioprocessoralgo.h"
|
||||
#include "base/source/fstreamer.h"
|
||||
#include "pluginterfaces/vst/ivstaudioprocessor.h"
|
||||
#include "pluginterfaces/vst/ivstparameterchanges.h"
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// TestRemapParamIDProcessor
|
||||
//------------------------------------------------------------------------
|
||||
TestRemapParamIDProcessor::TestRemapParamIDProcessor ()
|
||||
{
|
||||
//--- set the wanted controller for our processor
|
||||
setControllerClass (kTestRemapParamIDControllerUID);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
TestRemapParamIDProcessor::~TestRemapParamIDProcessor ()
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API TestRemapParamIDProcessor::initialize (FUnknown* context)
|
||||
{
|
||||
// Here the Plug-in will be instantiated
|
||||
|
||||
//---always initialize the parent-------
|
||||
tresult result = AudioEffect::initialize (context);
|
||||
// if everything Ok, continue
|
||||
if (result != kResultOk)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//--- create Audio IO ------
|
||||
addAudioInput (STR16 ("Stereo In"), Steinberg::Vst::SpeakerArr::kStereo);
|
||||
addAudioOutput (STR16 ("Stereo Out"), Steinberg::Vst::SpeakerArr::kStereo);
|
||||
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API TestRemapParamIDProcessor::process (Vst::ProcessData& data)
|
||||
{
|
||||
//--- First : Read inputs parameter changes-----------
|
||||
if (data.inputParameterChanges)
|
||||
{
|
||||
int32 numParamsChanged = data.inputParameterChanges->getParameterCount ();
|
||||
for (int32 index = 0; index < numParamsChanged; index++)
|
||||
{
|
||||
if (auto* paramQueue = data.inputParameterChanges->getParameterData (index))
|
||||
{
|
||||
Vst::ParamValue value;
|
||||
int32 sampleOffset;
|
||||
int32 numPoints = paramQueue->getPointCount ();
|
||||
switch (paramQueue->getParameterId ())
|
||||
{
|
||||
case kMyGainParamTag:
|
||||
if (paramQueue->getPoint (numPoints - 1, sampleOffset, value) ==
|
||||
kResultTrue)
|
||||
{
|
||||
fGain = (float)value;
|
||||
}
|
||||
break;
|
||||
|
||||
case kBypassId:
|
||||
if (paramQueue->getPoint (numPoints - 1, sampleOffset, value) ==
|
||||
kResultTrue)
|
||||
{
|
||||
bBypass = (value > 0.5f);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--- ----------------------------------
|
||||
//---3) Process Audio---------------------
|
||||
//--- ----------------------------------
|
||||
if (data.numInputs == 0 || data.numOutputs == 0)
|
||||
{
|
||||
// nothing to do
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
// (simplification) we suppose in this example that we have the same input channel count than
|
||||
// the output
|
||||
int32 numChannels = data.inputs[0].numChannels;
|
||||
|
||||
//---get audio buffers----------------
|
||||
uint32 sampleFramesSize = getSampleFramesSizeInBytes (processSetup, data.numSamples);
|
||||
void** in = getChannelBuffersPointer (processSetup, data.inputs[0]);
|
||||
void** out = getChannelBuffersPointer (processSetup, data.outputs[0]);
|
||||
|
||||
//---check if silence---------------
|
||||
// check if all channel are silent then process silent
|
||||
if (data.inputs[0].silenceFlags == getChannelMask (data.inputs[0].numChannels))
|
||||
{
|
||||
// mark output silence too (it will help the host to propagate the silence)
|
||||
data.outputs[0].silenceFlags = data.inputs[0].silenceFlags;
|
||||
|
||||
// the plug-in has to be sure that if it sets the flags silence that the output buffer are
|
||||
// clear
|
||||
for (int32 i = 0; i < numChannels; i++)
|
||||
{
|
||||
// do not need to be cleared if the buffers are the same (in this case input buffer are
|
||||
// already cleared by the host)
|
||||
if (in[i] != out[i])
|
||||
{
|
||||
memset (out[i], 0, sampleFramesSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // we have to process (no silence)
|
||||
{
|
||||
// mark our outputs has not silent
|
||||
data.outputs[0].silenceFlags = 0;
|
||||
|
||||
//---in bypass mode outputs should be like inputs-----
|
||||
if (bBypass)
|
||||
{
|
||||
for (int32 i = 0; i < numChannels; i++)
|
||||
{
|
||||
// do not need to be copied if the buffers are the same
|
||||
if (in[i] != out[i])
|
||||
{
|
||||
memcpy (out[i], in[i], sampleFramesSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//---apply gain factor----------
|
||||
// if the applied gain is nearly zero, we could say that the outputs are zeroed and we
|
||||
// set the silence flags.
|
||||
if (fGain < 0.0000001)
|
||||
{
|
||||
for (int32 i = 0; i < numChannels; i++)
|
||||
{
|
||||
memset (out[i], 0, sampleFramesSize);
|
||||
}
|
||||
// this will set to 1 all channels
|
||||
data.outputs[0].silenceFlags = getChannelMask (data.outputs[0].numChannels);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data.symbolicSampleSize == Vst::kSample32)
|
||||
processAudio<Sample32> ((Sample32**)in, (Sample32**)out, numChannels,
|
||||
data.numSamples, fGain);
|
||||
else
|
||||
processAudio<Sample64> ((Sample64**)in, (Sample64**)out, numChannels,
|
||||
data.numSamples, fGain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API TestRemapParamIDProcessor::setBusArrangements (SpeakerArrangement* inputs,
|
||||
int32 numIns,
|
||||
SpeakerArrangement* outputs,
|
||||
int32 numOuts)
|
||||
{
|
||||
//--- support only Stereo => Stereo -----------------
|
||||
if (numIns == 1 && numOuts == 1)
|
||||
{
|
||||
if (SpeakerArr::getChannelCount (inputs[0]) == 2 &&
|
||||
SpeakerArr::getChannelCount (outputs[0]) == 2)
|
||||
{
|
||||
return AudioEffect::setBusArrangements (inputs, numIns, outputs, numOuts);
|
||||
}
|
||||
}
|
||||
return kResultFalse;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API TestRemapParamIDProcessor::canProcessSampleSize (int32 symbolicSampleSize)
|
||||
{
|
||||
if (symbolicSampleSize == Vst::kSample32 || symbolicSampleSize == Vst::kSample64)
|
||||
return kResultTrue;
|
||||
|
||||
return kResultFalse;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API TestRemapParamIDProcessor::setState (IBStream* state)
|
||||
{
|
||||
// called when we load a preset, the model has to be reloaded
|
||||
|
||||
// Compatible with AGain state
|
||||
|
||||
IBStreamer streamer (state, kLittleEndian);
|
||||
float savedGain = 0.f;
|
||||
if (streamer.readFloat (savedGain) == false)
|
||||
return kResultFalse;
|
||||
|
||||
// ignore this one
|
||||
float tmp = 0.f;
|
||||
if (streamer.readFloat (tmp) == false)
|
||||
return kResultFalse;
|
||||
|
||||
int32 savedBypass = 0;
|
||||
if (streamer.readInt32 (savedBypass) == false)
|
||||
return kResultFalse;
|
||||
|
||||
fGain = savedGain;
|
||||
bBypass = savedBypass > 0;
|
||||
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API TestRemapParamIDProcessor::getState (IBStream* state)
|
||||
{
|
||||
// here we need to save the model
|
||||
|
||||
// Compatible with AGain state
|
||||
IBStreamer streamer (state, kLittleEndian);
|
||||
|
||||
streamer.writeFloat (fGain);
|
||||
streamer.writeFloat (0.f); // unuse here
|
||||
streamer.writeInt32 (bBypass ? 1 : 0);
|
||||
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // namespace Vst
|
||||
} // namespace Steinberg
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/remap_paramid/source/remapparamidprocessor.h
|
||||
// Created by : Steinberg, 02/2024
|
||||
// Description : Remap ParamID Example for VST 3
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "public.sdk/source/vst/vstaudioeffect.h"
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// TestRemapParamIDProcessor
|
||||
//------------------------------------------------------------------------
|
||||
class TestRemapParamIDProcessor : public AudioEffect
|
||||
{
|
||||
public:
|
||||
TestRemapParamIDProcessor ();
|
||||
~TestRemapParamIDProcessor () SMTG_OVERRIDE;
|
||||
|
||||
// Create function
|
||||
static FUnknown* createInstance (void* /*context*/)
|
||||
{
|
||||
return (Vst::IAudioProcessor*)new TestRemapParamIDProcessor;
|
||||
}
|
||||
|
||||
//--- ---------------------------------------------------------------------
|
||||
// AudioEffect overrides:
|
||||
//--- ---------------------------------------------------------------------
|
||||
/** Called at first after constructor */
|
||||
tresult PLUGIN_API initialize (FUnknown* context) SMTG_OVERRIDE;
|
||||
|
||||
/** Bus arrangement managing: in this example we support only Stereo/Stereo */
|
||||
tresult PLUGIN_API setBusArrangements (SpeakerArrangement* inputs, int32 numIns,
|
||||
SpeakerArrangement* outputs,
|
||||
int32 numOuts) SMTG_OVERRIDE;
|
||||
|
||||
/** Asks if a given sample size is supported see SymbolicSampleSizes. */
|
||||
tresult PLUGIN_API canProcessSampleSize (int32 symbolicSampleSize) SMTG_OVERRIDE;
|
||||
|
||||
/** Here we go...the process call */
|
||||
tresult PLUGIN_API process (Vst::ProcessData& data) SMTG_OVERRIDE;
|
||||
|
||||
/** For persistence */
|
||||
tresult PLUGIN_API setState (IBStream* state) SMTG_OVERRIDE;
|
||||
tresult PLUGIN_API getState (IBStream* state) SMTG_OVERRIDE;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
protected:
|
||||
//--- ---------------------------------------------------------------------
|
||||
template <typename SampleType>
|
||||
SampleType processAudio (SampleType** in, SampleType** out, int32 numChannels,
|
||||
int32 sampleFrames, float gain)
|
||||
{
|
||||
SampleType vuPPM = 0;
|
||||
|
||||
// in real Plug-in it would be better to do dezippering to avoid jump (click) in gain value
|
||||
for (int32 i = 0; i < numChannels; i++)
|
||||
{
|
||||
int32 samples = sampleFrames;
|
||||
auto* ptrIn = (SampleType*)in[i];
|
||||
auto* ptrOut = (SampleType*)out[i];
|
||||
SampleType tmp;
|
||||
while (--samples >= 0)
|
||||
{
|
||||
// apply gain
|
||||
tmp = (*ptrIn++) * gain;
|
||||
(*ptrOut++) = tmp;
|
||||
|
||||
// check only positive values
|
||||
if (tmp > vuPPM)
|
||||
{
|
||||
vuPPM = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return vuPPM;
|
||||
}
|
||||
|
||||
float fGain {1.f};
|
||||
bool bBypass {false};
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // namespace Vst
|
||||
} // namespace Steinberg
|
||||
@@ -0,0 +1,34 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/remap_paramid/source/remapparamidcontroller.h
|
||||
// Created by : Steinberg, 02/2024
|
||||
// Description : Remap ParamID Example for VST 3
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "pluginterfaces/base/fplatform.h"
|
||||
|
||||
// Plain project version file generated by cmake
|
||||
#include "projectversion.h"
|
||||
|
||||
#define stringOriginalFilename "TestRemapParamID.vst3"
|
||||
#if SMTG_PLATFORM_64
|
||||
#define stringFileDescription "TestRemapParamID VST3 (64Bit)"
|
||||
#else
|
||||
#define stringFileDescription "TestRemapParamID VST3"
|
||||
#endif
|
||||
#define stringCompanyWeb "http://www.steinberg.net"
|
||||
#define stringCompanyEmail "mailto:info@steinberg.de"
|
||||
#define stringCompanyName "Steinberg Media Technologies"
|
||||
#define stringLegalCopyright "� 2025 Steinberg Media Technologies"
|
||||
#define stringLegalTrademarks "VST is a trademark of Steinberg Media Technologies GmbH"
|
||||
Reference in New Issue
Block a user