VST 3 SDK VST 3.7
SDK for developing VST plug-in
|
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 More... | |
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 More... | |
void | onDisconnect (IConnectionPoint *other) |
call this in AudioEffect::disconnect More... | |
void | onActivate (const Vst::ProcessSetup &setup, bool forceUseMessageHandling=false) |
call this in AudioEffect::setActive(true) More... | |
void | onDeactivate () |
call this in AudioEffect::setActive(false) More... | |
DataExchangeBlock | getCurrentOrNewBlock () |
Get the current or a new block. More... | |
bool | sendCurrentBlock () |
Send the current block to the receiver. More... | |
bool | discardCurrentBlock () |
Discard the current block. More... | |
void | enable (bool state) |
Enable or disable the acquiring of new blocks (per default it is enabled) More... | |
bool | isEnabled () const |
Ask if enabled. More... | |
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.
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
DataExchangeHandler | ( | IAudioProcessor * | processor, |
ConfigCallback && | callback | ||
) |
DataExchangeHandler | ( | IAudioProcessor * | processor, |
const ConfigCallback & | callback | ||
) |
|
noexcept |
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 | ) |
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.
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]