Initial release
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.25.0)
|
||||
|
||||
project(smtg-vst3-channelcontext
|
||||
VERSION ${vstsdk_VERSION}.0
|
||||
DESCRIPTION "Steinberg VST 3 Channel Context example"
|
||||
)
|
||||
|
||||
smtg_add_vst3plugin(channel-context
|
||||
source/plug.cpp
|
||||
source/plug.h
|
||||
source/plugcids.h
|
||||
source/plugcontroller.cpp
|
||||
source/plugcontroller.h
|
||||
source/plugentry.cpp
|
||||
source/plugparamids.h
|
||||
source/version.h
|
||||
)
|
||||
|
||||
smtg_target_setup_as_vst3_example(channel-context)
|
||||
@@ -0,0 +1,18 @@
|
||||
# Test Channel Context
|
||||
|
||||
## Introduction
|
||||
|
||||
**Test Channel Context** is simple FX plug-in showing how to use the [Steinberg::Vst::ChannelContext::IInfoListener](https://steinbergmedia.github.io/vst3_dev_portal/pages/Technical+Documentation/Change+History/3.6.5/IInfoListener.html) interface.
|
||||
|
||||
> See also: [Online Documentation](https://steinbergmedia.github.io/vst3_dev_portal/pages/What+is+the+VST+3+SDK/Plug-in+Examples.html#testchannelcontext).
|
||||
|
||||
## 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
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/channelcontext/source/plug.cpp
|
||||
// Created by : Steinberg, 02/2014
|
||||
// Description : Plug Example for VST SDK 3.x
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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 "plug.h"
|
||||
#include "plugparamids.h"
|
||||
#include "plugcids.h" // for class ids
|
||||
|
||||
#include "public.sdk/source/vst/vstaudioprocessoralgo.h"
|
||||
|
||||
#include "pluginterfaces/base/futils.h"
|
||||
#include "pluginterfaces/base/ibstream.h"
|
||||
#include "pluginterfaces/vst/ivstevents.h"
|
||||
#include "pluginterfaces/vst/ivstparameterchanges.h"
|
||||
|
||||
#include "base/source/fstreamer.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Plug Implementation
|
||||
//------------------------------------------------------------------------
|
||||
Plug::Plug ()
|
||||
: bBypass (false)
|
||||
{
|
||||
// register its editor class (the same than used in plugentry.cpp)
|
||||
setControllerClass (PlugControllerUID);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API Plug::initialize (FUnknown* context)
|
||||
{
|
||||
//---always initialize the parent-------
|
||||
tresult result = AudioEffect::initialize (context);
|
||||
// if everything Ok, continue
|
||||
if (result != kResultOk)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//---create Audio In/Out busses------
|
||||
// we want a stereo Input and a Stereo Output
|
||||
addAudioInput (STR16 ("Stereo In"), SpeakerArr::kStereo);
|
||||
addAudioOutput (STR16 ("Stereo Out"), SpeakerArr::kStereo);
|
||||
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API Plug::process (ProcessData& data)
|
||||
{
|
||||
//---1) Read inputs parameter changes-----------
|
||||
if (IParameterChanges* paramChanges = data.inputParameterChanges)
|
||||
{
|
||||
int32 numParamsChanged = paramChanges->getParameterCount ();
|
||||
// for each parameter which are some changes in this audio block:
|
||||
for (int32 i = 0; i < numParamsChanged; i++)
|
||||
{
|
||||
if (IParamValueQueue* paramQueue = paramChanges->getParameterData (i))
|
||||
{
|
||||
int32 offsetSamples;
|
||||
double value;
|
||||
int32 numPoints = paramQueue->getPointCount ();
|
||||
switch (paramQueue->getParameterId ())
|
||||
{
|
||||
case kBypassId:
|
||||
if (paramQueue->getPoint (numPoints - 1, offsetSamples, 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 = Min (data.inputs[0].numChannels, data.outputs[0].numChannels);
|
||||
|
||||
//---get audio buffers----------------
|
||||
float** in = data.inputs[0].channelBuffers32;
|
||||
float** out = data.outputs[0].channelBuffers32;
|
||||
|
||||
// check if all channel are silent then process silent
|
||||
if (data.inputs[0].silenceFlags == getChannelMask (data.inputs[0].numChannels))
|
||||
{
|
||||
// mark output silence too
|
||||
data.outputs[0].silenceFlags = data.inputs[0].silenceFlags;
|
||||
|
||||
int32 sampleFrames = data.numSamples;
|
||||
|
||||
// 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, sampleFrames * sizeof (float));
|
||||
}
|
||||
}
|
||||
|
||||
// nothing to do at this point
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
// mark our outputs has not silent
|
||||
data.outputs[0].silenceFlags = 0;
|
||||
|
||||
//---in bypass mode outputs should be like inputs-----
|
||||
if (bBypass)
|
||||
{
|
||||
int32 sampleFrames = data.numSamples;
|
||||
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], sampleFrames * sizeof (float));
|
||||
}
|
||||
}
|
||||
for (int32 i = numChannels; i < data.outputs[0].numChannels; i++)
|
||||
{
|
||||
memset (out[i], 0, sizeof (float)* data.numSamples);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float gain = 0.5;
|
||||
|
||||
// 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 sampleFrames = data.numSamples;
|
||||
float* ptrIn = in[i];
|
||||
float* ptrOut = out[i];
|
||||
float tmp;
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
// apply gain
|
||||
tmp = (*ptrIn++) * gain;
|
||||
(*ptrOut++) = tmp;
|
||||
}
|
||||
}
|
||||
for (int32 i = numChannels; i < data.outputs[0].numChannels; i++)
|
||||
{
|
||||
memset (out[i], 0, sizeof (float)* data.numSamples);
|
||||
}
|
||||
}
|
||||
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API Plug::setState (IBStream* state)
|
||||
{
|
||||
// called when we load a preset, the model has to be reloaded
|
||||
|
||||
if (!state)
|
||||
return kResultFalse;
|
||||
|
||||
IBStreamer streamer (state, kLittleEndian);
|
||||
|
||||
// read the bypass
|
||||
int32 savedBypass = 0;
|
||||
if (streamer.readInt32 (savedBypass) == false)
|
||||
return kResultFalse;
|
||||
|
||||
bBypass = savedBypass > 0;
|
||||
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API Plug::getState (IBStream* state)
|
||||
{
|
||||
// here we need to save the model
|
||||
|
||||
if (!state)
|
||||
return kResultFalse;
|
||||
|
||||
IBStreamer streamer (state, kLittleEndian);
|
||||
streamer.writeInt32 (bBypass ? 1 : 0);
|
||||
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // namespace Vst
|
||||
} // namespace Steinberg
|
||||
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/channelcontext/source/plug.h
|
||||
// Created by : Steinberg, 02/2014
|
||||
// Description : Plug-in Example for VST SDK 3.x using ChannelContext::IInfoListener
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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 {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Plug: directly derived from the helper class AudioEffect
|
||||
//------------------------------------------------------------------------
|
||||
class Plug : public AudioEffect
|
||||
{
|
||||
public:
|
||||
Plug ();
|
||||
|
||||
//--- ---------------------------------------------------------------------
|
||||
// create function required for plug-in factory,
|
||||
// it will be called to create new instances of this plug-in
|
||||
//--- ---------------------------------------------------------------------
|
||||
static FUnknown* createInstance (void* /*context*/) { return (IAudioProcessor*)new Plug; }
|
||||
|
||||
//--- ---------------------------------------------------------------------
|
||||
// AudioEffect overrides:
|
||||
//--- ---------------------------------------------------------------------
|
||||
/** Called at first after constructor */
|
||||
tresult PLUGIN_API initialize (FUnknown* context) SMTG_OVERRIDE;
|
||||
|
||||
/** Here we go...the process call */
|
||||
tresult PLUGIN_API process (ProcessData& data) SMTG_OVERRIDE;
|
||||
|
||||
/** For persistence */
|
||||
tresult PLUGIN_API setState (IBStream* state) SMTG_OVERRIDE;
|
||||
tresult PLUGIN_API getState (IBStream* state) SMTG_OVERRIDE;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
protected:
|
||||
bool bBypass;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // namespace Vst
|
||||
} // namespace Steinberg
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/channelcontext/source/plugcids.h
|
||||
// Created by : Steinberg, 02/2014
|
||||
// Description : define the class IDs for channelcontext
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
// Plug A
|
||||
static const FUID PlugProcessorUID (0x01EDEBE8, 0x8CD14564, 0xAF34B1A2, 0xDDC13384);
|
||||
static const FUID PlugControllerUID(0xB4D97900, 0xAAC84AAE, 0xB9D1C427, 0xB77A698B);
|
||||
|
||||
}} // namespaces
|
||||
+293
@@ -0,0 +1,293 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/channelcontext/source/PlugController.cpp
|
||||
// Created by : Steinberg, 02/2014
|
||||
// Description : Plug Controller Example for VST SDK 3.x
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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 "plugcontroller.h"
|
||||
#include "plugparamids.h"
|
||||
|
||||
#include "pluginterfaces/base/ibstream.h"
|
||||
#include "pluginterfaces/base/ustring.h"
|
||||
#include "base/source/fstreamer.h"
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// PlugController Implementation
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API PlugController::initialize (FUnknown* context)
|
||||
{
|
||||
tresult result = EditControllerEx1::initialize (context);
|
||||
if (result != kResultOk)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//---Create Parameters------------
|
||||
|
||||
//---Bypass parameter---
|
||||
int32 stepCount = 1;
|
||||
ParamValue defaultVal = 0;
|
||||
int32 flags = ParameterInfo::kCanAutomate | ParameterInfo::kIsBypass;
|
||||
int32 tag = kBypassId;
|
||||
parameters.addParameter (STR16 ("Bypass"), nullptr, stepCount, defaultVal, flags, tag);
|
||||
|
||||
//---Read only parameters
|
||||
String128 undefinedStr;
|
||||
Steinberg::UString (undefinedStr, 128).fromAscii ("undefined");
|
||||
|
||||
flags = ParameterInfo::kIsReadOnly;
|
||||
auto* strParam = NEW StringListParameter (STR16 ("Ch Uid"), kChannelUIDId, nullptr, flags);
|
||||
strParam->appendString (undefinedStr);
|
||||
parameters.addParameter (strParam);
|
||||
|
||||
strParam = NEW StringListParameter (STR16 ("Ch Uid Len"), kChannelUIDLengthId, nullptr, flags);
|
||||
strParam->appendString (undefinedStr);
|
||||
parameters.addParameter (strParam);
|
||||
|
||||
strParam = NEW StringListParameter (STR16 ("Ch Name"), kChannelNameId, nullptr, flags);
|
||||
strParam->appendString (undefinedStr);
|
||||
parameters.addParameter (strParam);
|
||||
|
||||
strParam = NEW StringListParameter (STR16 ("Ch Name Len"), kChannelNameLengthId, nullptr, flags);
|
||||
strParam->appendString (undefinedStr);
|
||||
parameters.addParameter (strParam);
|
||||
|
||||
strParam = NEW StringListParameter (STR16 ("Ch Index"), kChannelIndexId, nullptr, flags);
|
||||
strParam->appendString (undefinedStr);
|
||||
parameters.addParameter (strParam);
|
||||
|
||||
strParam =
|
||||
NEW StringListParameter (STR16 ("Ch Index Namespace Order"), kChannelIndexNamespaceOrderId, nullptr, flags);
|
||||
strParam->appendString (undefinedStr);
|
||||
parameters.addParameter (strParam);
|
||||
|
||||
strParam =
|
||||
NEW StringListParameter (STR16 ("Ch Index Namespace"), kChannelIndexNamespaceId, nullptr, flags);
|
||||
strParam->appendString (undefinedStr);
|
||||
parameters.addParameter (strParam);
|
||||
|
||||
strParam = NEW StringListParameter (STR16 ("Ch Index Namespace Len"),
|
||||
kChannelIndexNamespaceLengthId, nullptr, flags);
|
||||
strParam->appendString (undefinedStr);
|
||||
parameters.addParameter (strParam);
|
||||
|
||||
strParam = NEW StringListParameter (STR16 ("Ch Color"), kChannelColorId, nullptr, flags);
|
||||
strParam->appendString (undefinedStr);
|
||||
parameters.addParameter (strParam);
|
||||
|
||||
strParam = NEW StringListParameter (STR16 ("Ch Plug Loc."), kChannelPluginLocationId, nullptr, flags);
|
||||
strParam->appendString (undefinedStr);
|
||||
parameters.addParameter (strParam);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API PlugController::setComponentState (IBStream* state)
|
||||
{
|
||||
// we receive the current state of the component (processor part)
|
||||
// we read only the gain and bypass value...
|
||||
|
||||
if (!state)
|
||||
return kResultFalse;
|
||||
|
||||
IBStreamer streamer (state, kLittleEndian);
|
||||
|
||||
// read the bypass
|
||||
int32 bypassState = 0;
|
||||
if (streamer.readInt32 (bypassState) == false)
|
||||
return kResultFalse;
|
||||
setParamNormalized (kBypassId, bypassState ? 1 : 0);
|
||||
|
||||
return kResultOk;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
tresult PLUGIN_API PlugController::setChannelContextInfos (IAttributeList* list)
|
||||
{
|
||||
if (!list)
|
||||
return kResultFalse;
|
||||
|
||||
String128 undefinedStr;
|
||||
Steinberg::UString (undefinedStr, 128).fromAscii ("undefined");
|
||||
|
||||
// get the channel name length (optional) where we, as plugin, are instantiated
|
||||
auto* param =
|
||||
static_cast<StringListParameter*> (parameters.getParameter (kChannelNameLengthId));
|
||||
if (param)
|
||||
{
|
||||
int64 length;
|
||||
if (list->getInt (ChannelContext::kChannelNameLengthKey, length) == kResultTrue)
|
||||
{
|
||||
String128 string128;
|
||||
Steinberg::UString (string128, 128).printInt (length);
|
||||
param->replaceString (0, string128);
|
||||
}
|
||||
else
|
||||
param->replaceString (0, undefinedStr);
|
||||
}
|
||||
|
||||
// get the channel name where we, as plugin, are instantiated
|
||||
param = static_cast<StringListParameter*> (parameters.getParameter (kChannelNameId));
|
||||
if (param)
|
||||
{
|
||||
String128 name;
|
||||
if (list->getString (ChannelContext::kChannelNameKey, name, sizeof (name)) == kResultTrue)
|
||||
param->replaceString (0, name);
|
||||
else
|
||||
param->replaceString (0, undefinedStr);
|
||||
}
|
||||
|
||||
// get the channel UID Length
|
||||
param = static_cast<StringListParameter*> (parameters.getParameter (kChannelUIDLengthId));
|
||||
if (param)
|
||||
{
|
||||
int64 length;
|
||||
if (list->getInt (ChannelContext::kChannelUIDLengthKey, length) == kResultTrue)
|
||||
{
|
||||
String128 string128;
|
||||
Steinberg::UString (string128, 128).printInt (length);
|
||||
param->replaceString (0, string128);
|
||||
}
|
||||
else
|
||||
param->replaceString (0, undefinedStr);
|
||||
}
|
||||
|
||||
// get the channel UID
|
||||
param = static_cast<StringListParameter*> (parameters.getParameter (kChannelUIDId));
|
||||
if (param)
|
||||
{
|
||||
String128 name;
|
||||
if (list->getString (ChannelContext::kChannelUIDKey, name, sizeof (name)) == kResultTrue)
|
||||
param->replaceString (0, name);
|
||||
else
|
||||
param->replaceString (0, undefinedStr);
|
||||
}
|
||||
|
||||
// get Channel Index
|
||||
param = static_cast<StringListParameter*> (parameters.getParameter (kChannelIndexId));
|
||||
if (param)
|
||||
{
|
||||
int64 index;
|
||||
if (list->getInt (ChannelContext::kChannelIndexKey, index) == kResultTrue)
|
||||
{
|
||||
String128 string128;
|
||||
Steinberg::UString (string128, 128).printInt (index);
|
||||
param->replaceString (0, string128);
|
||||
}
|
||||
else
|
||||
param->replaceString (0, undefinedStr);
|
||||
}
|
||||
|
||||
// get Channel Index Namespace Order
|
||||
param = static_cast<StringListParameter*> (parameters.getParameter (kChannelIndexNamespaceOrderId));
|
||||
if (param)
|
||||
{
|
||||
int64 index;
|
||||
if (list->getInt (ChannelContext::kChannelIndexNamespaceOrderKey, index) == kResultTrue)
|
||||
{
|
||||
String128 string128;
|
||||
Steinberg::UString (string128, 128).printInt (index);
|
||||
param->replaceString (0, string128);
|
||||
}
|
||||
else
|
||||
param->replaceString (0, undefinedStr);
|
||||
}
|
||||
|
||||
// get the channel Index Namespace Length
|
||||
param = static_cast<StringListParameter*> (
|
||||
parameters.getParameter (kChannelIndexNamespaceLengthId));
|
||||
if (param)
|
||||
{
|
||||
int64 length;
|
||||
if (list->getInt (ChannelContext::kChannelIndexNamespaceLengthKey, length) == kResultTrue)
|
||||
{
|
||||
String128 string128;
|
||||
Steinberg::UString (string128, 128).printInt (length);
|
||||
param->replaceString (0, string128);
|
||||
}
|
||||
else
|
||||
param->replaceString (0, undefinedStr);
|
||||
}
|
||||
|
||||
// get the channel Index Namespace
|
||||
param = static_cast<StringListParameter*> (parameters.getParameter (kChannelIndexNamespaceId));
|
||||
if (param)
|
||||
{
|
||||
String128 name;
|
||||
if (list->getString (ChannelContext::kChannelIndexNamespaceKey, name, sizeof (name)) ==
|
||||
kResultTrue)
|
||||
param->replaceString (0, name);
|
||||
else
|
||||
param->replaceString (0, undefinedStr);
|
||||
}
|
||||
|
||||
// get plug-in Channel Location
|
||||
param = static_cast<StringListParameter*> (parameters.getParameter (kChannelPluginLocationId));
|
||||
if (param)
|
||||
{
|
||||
int64 location;
|
||||
if (list->getInt (ChannelContext::kChannelPluginLocationKey, location) == kResultTrue)
|
||||
{
|
||||
String128 string128;
|
||||
switch (location)
|
||||
{
|
||||
case ChannelContext::kPreVolumeFader:
|
||||
Steinberg::UString (string128, 128).fromAscii ("PreVolFader");
|
||||
break;
|
||||
case ChannelContext::kPostVolumeFader:
|
||||
Steinberg::UString (string128, 128).fromAscii ("PostVolFader");
|
||||
break;
|
||||
case ChannelContext::kUsedAsPanner:
|
||||
Steinberg::UString (string128, 128).fromAscii ("UsedAsPanner");
|
||||
break;
|
||||
default: Steinberg::UString (string128, 128).fromAscii ("unknown!"); break;
|
||||
}
|
||||
param->replaceString (0, string128);
|
||||
}
|
||||
else
|
||||
param->replaceString (0, undefinedStr);
|
||||
}
|
||||
|
||||
// get Channel Color
|
||||
param = static_cast<StringListParameter*> (parameters.getParameter (kChannelColorId));
|
||||
if (param)
|
||||
{
|
||||
int64 color;
|
||||
if (list->getInt (ChannelContext::kChannelColorKey, color) == kResultTrue)
|
||||
{
|
||||
uint32 channelColor = (uint32)color;
|
||||
char str[10];
|
||||
snprintf (str, 10, "%x%x%x%x", ChannelContext::GetAlpha (channelColor),
|
||||
ChannelContext::GetRed (channelColor),
|
||||
ChannelContext::GetGreen (channelColor),
|
||||
ChannelContext::GetBlue (channelColor));
|
||||
String128 string128;
|
||||
Steinberg::UString (string128, 128).fromAscii (str);
|
||||
param->replaceString (0, string128);
|
||||
}
|
||||
else
|
||||
param->replaceString (0, undefinedStr);
|
||||
}
|
||||
|
||||
// we have to inform the host that our strings have changed (values not)
|
||||
if (componentHandler)
|
||||
componentHandler->restartComponent (kParamValuesChanged);
|
||||
|
||||
return kResultTrue;
|
||||
}
|
||||
}
|
||||
} // namespaces
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/channelcontext/source/plugcontroller.h
|
||||
// Created by : Steinberg, 02/2014
|
||||
// Description : channelcontext Controller Example for VST SDK 3.x
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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/ivstchannelcontextinfo.h"
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// PlugController
|
||||
//------------------------------------------------------------------------
|
||||
class PlugController : public EditControllerEx1, public ChannelContext::IInfoListener
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------
|
||||
// create function required for plug-in factory,
|
||||
// it will be called to create new instances of this controller
|
||||
//------------------------------------------------------------------------
|
||||
static FUnknown* createInstance (void* /*context*/) { return (IEditController*)new PlugController; }
|
||||
|
||||
//---from IPluginBase--------
|
||||
tresult PLUGIN_API initialize (FUnknown* context) SMTG_OVERRIDE;
|
||||
|
||||
//---from EditController-----
|
||||
tresult PLUGIN_API setComponentState (IBStream* state) SMTG_OVERRIDE;
|
||||
|
||||
//---from ChannelContext::IInfoListener-----
|
||||
tresult PLUGIN_API setChannelContextInfos (IAttributeList* list) SMTG_OVERRIDE;
|
||||
|
||||
//---Interface---------
|
||||
OBJ_METHODS (PlugController, EditControllerEx1)
|
||||
DEFINE_INTERFACES
|
||||
DEF_INTERFACE (ChannelContext::IInfoListener)
|
||||
END_DEFINE_INTERFACES (EditController)
|
||||
DELEGATE_REFCOUNT (EditControllerEx1)
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
};
|
||||
}
|
||||
} // namespaces
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/channelcontext/source/plugentry.cpp
|
||||
// Created by : Steinberg, 02/2014
|
||||
// Description : ChannelContext Example for VST SDK 3.x
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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 "plug.h"
|
||||
#include "plugcontroller.h"
|
||||
#include "plugcids.h" // for class ids
|
||||
#include "version.h" // for versioning
|
||||
|
||||
#include "public.sdk/source/main/pluginfactory.h"
|
||||
|
||||
#define stringPluginName "Test Channel Context"
|
||||
|
||||
using namespace Steinberg;
|
||||
using namespace Steinberg::Vst;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// VST Plug-in Entry
|
||||
//------------------------------------------------------------------------
|
||||
// Windows: do not forget to include a .def file in your project to export
|
||||
// GetPluginFactory function!
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
BEGIN_FACTORY_DEF (stringCompanyName, stringCompanyWeb, stringCompanyEmail)
|
||||
|
||||
//---First plug-in included in this factory-------
|
||||
// its kVstAudioEffectClass component
|
||||
DEF_CLASS2 (INLINE_UID_FROM_FUID(PlugProcessorUID),
|
||||
PClassInfo::kManyInstances, // cardinality
|
||||
kVstAudioEffectClass, // the component category (do not change this)
|
||||
stringPluginName, // here the plug-in name (to be changed)
|
||||
Vst::kDistributable, // means that component and controller could be distributed on different computers
|
||||
"Spatial|Fx|Up-Downmix|Instrument",// 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 change this, always use this define)
|
||||
Steinberg::Vst::Plug::createInstance) // function pointer called when this component should be instantiated
|
||||
|
||||
// its kVstComponentControllerClass component
|
||||
DEF_CLASS2 (INLINE_UID_FROM_FUID (PlugControllerUID),
|
||||
PClassInfo::kManyInstances, // cardinality
|
||||
kVstComponentControllerClass,// the Controller category (do not change this)
|
||||
stringPluginName "Controller", // controller name (can be the same as the 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 change this, always use this define)
|
||||
Steinberg::Vst::PlugController::createInstance)// function pointer called when this component should be instantiated
|
||||
END_FACTORY
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/channelcontext/source/plugparamids.h
|
||||
// Created by : Steinberg, 02/2014
|
||||
// Description : define the parameter IDs used by channelcontext
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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
|
||||
|
||||
enum
|
||||
{
|
||||
/** parameter ID */
|
||||
kBypassId = 0, ///< Bypass value (we will handle the bypass process) (is automatable)
|
||||
|
||||
kChannelUIDId, ///< read Only parameters
|
||||
kChannelUIDLengthId,
|
||||
kChannelNameId,
|
||||
kChannelNameLengthId,
|
||||
kChannelIndexNamespaceOrderId,
|
||||
kChannelIndexNamespaceId,
|
||||
kChannelIndexNamespaceLengthId,
|
||||
kChannelColorId,
|
||||
kChannelIndexId,
|
||||
kChannelPluginLocationId
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Examples
|
||||
// Filename : public.sdk/samples/vst/channelcontext/source/version.h
|
||||
// Created by : Steinberg, 02/2014
|
||||
// Description : Example of handle the versioning and copyright info of the plug-in
|
||||
// used for the resources (RC file for example)
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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 "TestChannelContext.vst3"
|
||||
#if SMTG_PLATFORM_64
|
||||
#define stringFileDescription "TestChannelContext VST3-SDK (64Bit)"
|
||||
#else
|
||||
#define stringFileDescription "TestChannelContext VST3-SDK"
|
||||
#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