Skip to main content

Overview

The PluginProcessor class is the heart of plugdata. It inherits from both JUCE’s AudioProcessor and plugdata’s pd::Instance, combining DAW plugin functionality with Pure Data patch management and DSP processing. Location: Source/PluginProcessor.h

Class Hierarchy

Inherits from:
  • AudioProcessor - JUCE’s audio plugin base class
  • pd::Instance - Pure Data instance wrapper
  • SettingsFileListener - Settings file change notifications

Key Methods

Audio Processing

void
Called before audio processing starts. Initializes:
  • Sample rate configuration
  • Buffer sizes
  • DSP preparation
  • Internal synthesis setup
void
Main audio processing callback. Called by the DAW for each audio block. Handles:
  • Audio input/output routing
  • MIDI message processing
  • Pure Data DSP execution
  • Oversampling (if enabled)
  • Output limiting (if enabled)
void
Called when the plugin is bypassed. Ensures clean audio passthrough.

DSP Configuration

void
Configure oversampling factor:
  • 0 = No oversampling (default)
  • 1 = 2x oversampling
  • 2 = 4x oversampling
  • 3 = 8x oversampling
Higher oversampling reduces aliasing but increases CPU usage.
void
Control the output safety limiter:
  • Prevents output clipping
  • Removes non-finite numbers (NaN, infinity)
  • Enabled by default for protection

Parameter Management

void
Manage DAW automation parameters. Parameters are created via the [param] object and must be enabled to appear in the DAW.
void
Send current parameter values to Pure Data. Called during automation playback.

Playhead and Transport

void
Send DAW playhead information to Pure Data. This data is received by the [playhead] object. Includes:
  • Transport state (playing/stopped/recording)
  • Position (PPQ, samples, seconds)
  • Tempo (BPM)
  • Time signature
  • Loop points
  • Frame rate

Patch Management

pd::Patch::Ptr
Load a Pure Data patch from a string or URL. Returns a smart pointer to the loaded patch.
pd::Patch::Ptr
Find the patch associated with a specific editor window.

MIDI Handling

void
Callbacks for MIDI messages coming from Pure Data (sent to DAW).
void
Send MIDI messages to a specific MIDI device.

State Management

void
Serialize and deserialize plugin state for DAW session save/load. Includes:
  • Patch contents
  • Parameter values
  • Extra data from [daw_storage]
  • UI state
void
Handle data storage from [daw_storage] objects. Data is serialized to XML and stored with the plugin state.

Latency Compensation

void
Called when [plugin_latency] reports latency. Updates the DAW’s latency compensation.

Properties

SettingsFile*
Global settings file manager. Contains user preferences and configuration.
pd::Library*
Object library for searching and accessing Pure Data object documentation.
AtomicValue<int>
Current oversampling factor (0 = none, 1 = 2x, 2 = 4x, 3 = 8x).
AtomicValue<bool>
Whether the output safety limiter is enabled (default: true).
AtomicValue<float>*
Master output volume control.
Value
Plugin tail length in seconds (for reverb, delay, etc.).
OwnedArray<PluginEditor>
All currently open editor windows.

Constants

static constexpr int
Maximum number of DAW parameters: 512
static constexpr int
Maximum number of input buses: 16
static constexpr int
Maximum number of output buses: 16

Usage Example

See Also

  • pd::Instance - Pure Data instance wrapper (Source/Pd/Instance.h)
  • Canvas - Patch canvas and object management
  • PluginEditor - UI editor component
  • [param] - Parameter object
  • [playhead] - Playhead object
  • [plugin_latency] - Latency reporting object