VCV Rack API v2
Loading...
Searching...
No Matches
rack::engine::Module::Expander Struct Reference
module NULL

Represents a message-passing channel for an adjacent module. More...

#include <Module.hpp>

Public Member Functions

void requestMessageFlip ()
 

Public Attributes

int64_t moduleId = -1
 ID of the expander module, or -1 if nonexistent.
 
void * producerMessage = NULL
 Double buffer for receiving messages from the expander module.
 
void * consumerMessage = NULL
 
bool messageFlipRequested = false
 

Detailed Description

Represents a message-passing channel for an adjacent module.

Member Function Documentation

◆ requestMessageFlip()

void rack::engine::Module::Expander::requestMessageFlip ( )
inline

Member Data Documentation

◆ moduleId

int64_t rack::engine::Module::Expander::moduleId = -1

ID of the expander module, or -1 if nonexistent.

◆ producerMessage

void* rack::engine::Module::Expander::producerMessage = NULL

Double buffer for receiving messages from the expander module.

If you intend to receive messages from an expander, allocate both message buffers with identical blocks of memory (arrays, structs, etc). Remember to free the buffer in the Module destructor. Example:

rightExpander.producerMessage = new MyExpanderMessage;
rightExpander.consumerMessage = new MyExpanderMessage;

You must check the expander module's model before attempting to write its message buffer. Once the module is checked, you can reinterpret_cast its producerMessage at no performance cost.

Producer messages are intended to be write-only. Consumer messages are intended to be read-only.

Once you write a message, set messageFlipRequested to true to request that the messages are flipped at the end of the timestep. This means that message-passing has 1-sample latency.

You may choose for your Module to instead write to its own message buffer for consumption by other modules, i.e. the expander "pulls" rather than this module "pushing". As long as this convention is followed by the other module, this is fine.

◆ consumerMessage

void* rack::engine::Module::Expander::consumerMessage = NULL

◆ messageFlipRequested

bool rack::engine::Module::Expander::messageFlipRequested = false

The documentation for this struct was generated from the following file: