Skip to main content
IPluginBase is the base class that contains plugin metadata, parameter management, preset handling, and state serialization. It knows nothing about audio processing.

Class Definition

IPlugPluginBase.h
class IPluginBase : public EDITOR_DELEGATE_CLASS
{
public:
  IPluginBase(int nParams, int nPresets);
  virtual ~IPluginBase();
};

Plugin Properties

Access plugin metadata through read-only getters:

Basic Information

const char* GetPluginName() const;
const char* GetMfrName() const;
const char* GetProductName() const;
int GetUniqueID() const;                    // Four-char ID as int
int GetMfrID() const;                        // Manufacturer ID
const char* GetBundleID() const;             // macOS/iOS bundle ID
const char* GetAppGroupID() const;           // macOS/iOS app group

Version Information

// Get version as integer (VVVVRRMM format)
int GetPluginVersion(bool decimal) const;

// Get version as string (e.g. "v1.2.3D" in debug builds)
void GetPluginVersionStr(WDL_String& str) const;

// Example usage
WDL_String version;
GetPluginVersionStr(version);
DBGMSG("Plugin version: %s\n", version.Get());

Host Information

EHost GetHost() const;                       // Identified host
void GetHostStr(WDL_String& str) const;      // Normalized host name
void GetRawHostStr(WDL_String& str) const;   // Raw host name
int GetHostVersion(bool decimal) const;
void GetHostVersionStr(WDL_String& str) const;

API and Architecture

EAPI GetAPI() const;                         // VST3, AUv2, CLAP, etc.
const char* GetAPIStr() const;               // "VST3", "CLAP", etc.
const char* GetArchStr() const;              // "x86-64", "arm64", "WASM"

// Get complete build info
void GetBuildInfoStr(WDL_String& str, const char* date, const char* time) const;

// Example
WDL_String buildInfo;
GetBuildInfoStr(buildInfo, __DATE__, __TIME__);
// "v1.0.0 VST3 (x86-64), built on Jan 15 2025 at 14:30"

UI Configuration

bool HasUI() const;                          // Plugin has UI?
bool GetHostResizeEnabled() const;           // Host can resize?

Parameter Management

Parameter Basics

Parameters are accessed by index through GetParam():
enum EParams {
  kGain = 0,
  kFrequency,
  kNumParams
};

// In constructor
GetParam(kGain)->InitDouble("Gain", 0., -70., 12., 0.5, "dB");

// In ProcessBlock
double gainDB = GetParam(kGain)->Value();

Parameter Groups

int NParamGroups() const;
int AddParamGroup(const char* name);
const char* GetParamGroupName(int idx) const;

// Notify host of parameter changes (if supported)
virtual void InformHostOfParameterDetailsChange();

Bulk Parameter Operations

// Initialize multiple parameters with pattern
void InitParamRange(
  int startIdx,
  int endIdx,
  int countStart,
  const char* nameFmtStr,  // Use %i for index
  double defaultVal,
  double minVal,
  double maxVal,
  double step,
  const char* label = "",
  int flags = 0,
  const char* group = "",
  const IParam::Shape& shape = IParam::ShapeLinear(),
  IParam::EParamUnit unit = IParam::kUnitCustom,
  IParam::DisplayFunc displayFunc = nullptr
);

// Example: Create 8 envelope parameters
enum { kEnvAttack, kEnvDecay, kEnvSustain, kEnvRelease };
InitParamRange(kEnvAttack, kEnvRelease, 0, "Envelope %i",
               0., 0., 1., 0.01, "", 0, "Envelope");

Parameter Value Manipulation

// Copy parameter values
void CopyParamValues(int startIdx, int destIdx, int nParams);
void CopyParamValues(const char* inGroup, const char* outGroup);

// Randomize parameters
void RandomiseParamValues();                          // All parameters
void RandomiseParamValues(int startIdx, int endIdx);  // Range
void RandomiseParamValues(const char* paramGroup);    // Group

// Reset to defaults
void DefaultParamValues();                            // All parameters
void DefaultParamValues(int startIdx, int endIdx);    // Range
void DefaultParamValues(const char* paramGroup);      // Group

// Debug output
void PrintParamValues();

State Serialization

Basic State Management

bool DoesStateChunks() const;  // Configured for state chunks?

// Serialize/unserialize parameters only
bool SerializeParams(IByteChunk& chunk) const;
int UnserializeParams(const IByteChunk& chunk, int startPos);

Custom State Chunks

Override these for custom data beyond parameters:
// Override to save custom state
virtual bool SerializeState(IByteChunk& chunk) const
{
  // Save custom data first
  chunk.Put(&mCustomData);
  
  // Then save parameters
  return SerializeParams(chunk);
}

// Override to load custom state
virtual int UnserializeState(const IByteChunk& chunk, int startPos)
{
  // Load custom data first
  int pos = chunk.Get(&mCustomData, startPos);
  
  // Then load parameters
  return UnserializeParams(chunk, pos);
}
The default SerializeState() implementation just calls SerializeParams(). Override both methods if you need to save additional state like sample data, wavetables, or custom settings.

VST3 Controller State

VST3-specific state serialization (rarely needed):
virtual bool SerializeVST3CtrlrState(IByteChunk& chunk) const;
virtual int UnserializeVST3CtrlrState(const IByteChunk& chunk, int startPos);

Preset Management

See the Presets page for detailed information about:
  • Creating factory presets with MakePreset()
  • Loading/saving user presets
  • Preset banks (VST2)
  • Exporting presets to code

Basic Preset Methods

int NPresets() const;
int GetCurrentPresetIdx() const;
void SetCurrentPresetIdx(int idx);
IPreset* GetPreset(int idx);
const char* GetPresetName(int idx) const;

bool RestorePreset(int idx);
bool RestorePreset(const char* name);
void ModifyCurrentPreset(const char* name = 0);

virtual void InformHostOfPresetChange();  // Notify host
virtual void OnPresetsModified();         // VST2 only

Example: Complete Plugin Constructor

class MySynth : public iplug::Plugin
{
public:
  MySynth(const InstanceInfo& info)
  : Plugin(info, MakeConfig(kNumParams, kNumPresets))
  {
    // Initialize parameters
    GetParam(kGain)->InitGain("Gain", 0., -70., 12.);
    GetParam(kFilterFreq)->InitFrequency("Filter Freq", 1000., 20., 20000.);
    
    // Initialize parameter range with pattern
    InitParamRange(kEnvAttack, kEnvRelease, 0, "Envelope %i",
                   0.1, 0., 1., 0.01, "s", 0, "Envelope");
    
    // Create factory presets
    MakeDefaultPreset("Init", 1);
    MakePreset("Bright", 0., 5000., 0.01, 0.1, 0.7, 0.2);
    MakePreset("Dark", -6., 400., 0.05, 0.3, 0.5, 0.8);
  }
  
  bool SerializeState(IByteChunk& chunk) const override
  {
    // Save custom wavetable data
    chunk.PutBytes(mWavetable, sizeof(mWavetable));
    return SerializeParams(chunk);
  }
  
  int UnserializeState(const IByteChunk& chunk, int startPos) override
  {
    int pos = chunk.GetBytes(mWavetable, sizeof(mWavetable), startPos);
    return UnserializeParams(chunk, pos);
  }
  
private:
  float mWavetable[2048];
};

API Reference

IPluginBase
class
Base class for plugin metadata and parameter management
GetParam(int idx)
IParam*
Get parameter at index. See Parameters for IParam API.
NParams()
int
Total number of parameters (inherited from EDITOR_DELEGATE_CLASS)

Next Steps

Parameters

Deep dive into IParam types, shapes, and display functions

Presets

Learn about factory presets and preset management

Processor

Audio processing and channel I/O