VST 3 SDK  VST 3.7
SDK for developing VST plug-in
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
DataExchangeHandler Class Reference

Helper class to provide a single API for plug-ins to transfer data from the realtime audio process to the edit controller either via the backwards compatible message handling protocol (see IMessage) or the new IDataExchangeHandler/IDataExchangeReceiver API. More...

#include <dataexchange.h>

Classes

struct  Config
 

Public Types

using ConfigCallback = std::function< bool(Config &config, const ProcessSetup &setup)>
 the callback will be called on setup processing to get the required configuration for the data exchange
 

Public Member Functions

 DataExchangeHandler (IAudioProcessor *processor, ConfigCallback &&callback)
 
 DataExchangeHandler (IAudioProcessor *processor, const ConfigCallback &callback)
 
 ~DataExchangeHandler () noexcept
 
void onConnect (IConnectionPoint *other, FUnknown *hostContext)
 call this in AudioEffect::connect
 
void onDisconnect (IConnectionPoint *other)
 call this in AudioEffect::disconnect
 
void onActivate (const Vst::ProcessSetup &setup, bool forceUseMessageHandling=false)
 call this in AudioEffect::setActive(true)
 
void onDeactivate ()
 call this in AudioEffect::setActive(false)
 
DataExchangeBlock getCurrentOrNewBlock ()
 Get the current or a new block.
 
bool sendCurrentBlock ()
 Send the current block to the receiver.
 
bool discardCurrentBlock ()
 Discard the current block.
 
void enable (bool state)
 Enable or disable the acquiring of new blocks (per default it is enabled)
 
bool isEnabled () const
 Ask if enabled.
 

Detailed Description

Helper class to provide a single API for plug-ins to transfer data from the realtime audio process to the edit controller either via the backwards compatible message handling protocol (see IMessage) or the new IDataExchangeHandler/IDataExchangeReceiver API.

To use this, make an instance of DataExchangeHandler a member of your IAudioProcessor class and call onConnect, onDisconnect, onActivate and onDeactivate when the processor is (dis-)connected and (de)activated. In your IAudioProcessor::process method you call getCurrentOrNewBlock () to get a block fill it with the data you want to send and then call sendCurrentBlock. See DataExchangeReceiverHandler on how to receive that data.

Member Typedef Documentation

using ConfigCallback = std::function<bool (Config& config, const ProcessSetup& setup)>

the callback will be called on setup processing to get the required configuration for the data exchange

Constructor & Destructor Documentation

DataExchangeHandler ( IAudioProcessor processor,
ConfigCallback &&  callback 
)
DataExchangeHandler ( IAudioProcessor processor,
const ConfigCallback callback 
)
~DataExchangeHandler ( )
noexcept

Member Function Documentation

void onConnect ( IConnectionPoint other,
FUnknown hostContext 
)

call this in AudioEffect::connect

provide the hostContext you get via AudioEffect::initiailze to this method

void onDisconnect ( IConnectionPoint other)
void onActivate ( const Vst::ProcessSetup setup,
bool  forceUseMessageHandling = false 
)

call this in AudioEffect::setActive(true)

void onDeactivate ( )

call this in AudioEffect::setActive(false)

DataExchangeBlock getCurrentOrNewBlock ( )

Get the current or a new block.

On the first call this will always return a new block, only after sendCurrentBlock or discardCurrentBlock is called a new block will be acquired. This may return an invalid DataExchangeBlock (check the blockID for InvalidDataExchangeBlockID) when the queue is full.

[call only in process call]

bool sendCurrentBlock ( )

Send the current block to the receiver.

[call only in process call]

bool discardCurrentBlock ( )

Discard the current block.

[call only in process call]

void enable ( bool  state)

Enable or disable the acquiring of new blocks (per default it is enabled)

If you disable this then the getCurrentOrNewBlock will always return an invalid block.

[call only in process call]

bool isEnabled ( ) const

Ask if enabled.

[call only in process call]

Empty

Copyright ©2024 Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.