VST 3 SDK VST 3.7 SDK for developing VST plug-in

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
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

## ◆ ConfigCallback

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() [1/2]

DataExchangeHandler | ( | IAudioProcessor * | processor,
|  | ConfigCallback && | callback )

## ◆ DataExchangeHandler() [2/2]

DataExchangeHandler | ( | IAudioProcessor * | processor,
|  | const ConfigCallback & | callback )

## ◆ ~DataExchangeHandler()

~DataExchangeHandler | ( |  | ) |
| noexcept

## Member Function Documentation

## ◆ onConnect()

void onConnect | ( | IConnectionPoint * | other,
|  | FUnknown * | hostContext )

call this in AudioEffect::connect

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

## ◆ onDisconnect()

void onDisconnect | ( | IConnectionPoint * | other | ) |

call this in AudioEffect::disconnect

## ◆ onActivate()

void onActivate | ( | const Vst::ProcessSetup & | setup,
|  | bool | forceUseMessageHandling = false )

call this in AudioEffect::setActive(true)

## ◆ onDeactivate()

void onDeactivate | ( |  | ) |

call this in AudioEffect::setActive(false)

## ◆ getCurrentOrNewBlock()

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]

## ◆ sendCurrentBlock()

bool sendCurrentBlock | ( |  | ) |

Send the current block to the receiver.

[call only in process call]

## ◆ discardCurrentBlock()

bool discardCurrentBlock | ( |  | ) |

Discard the current block.

[call only in process call]

## ◆ enable()

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]

## ◆ isEnabled()

bool isEnabled | ( |  | ) | const

Ask if enabled.

[call only in process call]

Empty

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