VCV Rack API v2
rack::audio::Port Struct Reference

A handle to a Device, typically owned by modules to have shared access to a single Device. More...

#include <audio.hpp>

Collaboration diagram for rack::audio::Port:
[legend]

Public Member Functions

 Port ()
 
virtual ~Port ()
 
void reset ()
 
DrivergetDriver ()
 
int getDriverId ()
 
void setDriverId (int driverId)
 
std::string getDriverName ()
 
DevicegetDevice ()
 
std::vector< int > getDeviceIds ()
 
int getDeviceId ()
 
void setDeviceId (int deviceId)
 
int getDeviceNumInputs (int deviceId)
 
int getDeviceNumOutputs (int deviceId)
 
std::string getDeviceName (int deviceId)
 
std::string getDeviceDetail (int deviceId, int offset)
 
std::set< float > getSampleRates ()
 
float getSampleRate ()
 
void setSampleRate (float sampleRate)
 
std::set< int > getBlockSizes ()
 
int getBlockSize ()
 
void setBlockSize (int blockSize)
 
int getNumInputs ()
 Returns the number of active Port inputs, considering inputOffset and maxInputs. More...
 
int getNumOutputs ()
 
json_t * toJson ()
 
void fromJson (json_t *rootJ)
 
virtual void processBuffer (const float *input, int inputStride, float *output, int outputStride, int frames)
 Callback for processing the audio stream. More...
 
virtual void processInput (const float *input, int inputStride, int frames)
 Called before processBuffer() is called for all Ports of the same device. More...
 
virtual void processOutput (float *output, int outputStride, int frames)
 Called after processBuffer() is called for all Ports of the same device. More...
 
virtual void onStartStream ()
 
virtual void onStopStream ()
 

Public Attributes

int inputOffset = 0
 The first channel index of the device to process. More...
 
int outputOffset = 0
 
int maxInputs = 8
 Maximum number of channels to process. More...
 
int maxOutputs = 8
 
int driverId = -1
 
int deviceId = -1
 
Driverdriver = NULL
 Not owned. More...
 
Devicedevice = NULL
 
Contextcontext
 

Detailed Description

A handle to a Device, typically owned by modules to have shared access to a single Device.

All Port methods safely wrap Drivers methods. That is, if the active Device throws a rack::Exception, it is caught and logged inside all Port methods, so they do not throw exceptions.

Constructor & Destructor Documentation

◆ Port()

rack::audio::Port::Port ( )

◆ ~Port()

virtual rack::audio::Port::~Port ( )
virtual

Member Function Documentation

◆ reset()

void rack::audio::Port::reset ( )

◆ getDriver()

Driver * rack::audio::Port::getDriver ( )

◆ getDriverId()

int rack::audio::Port::getDriverId ( )

◆ setDriverId()

void rack::audio::Port::setDriverId ( int  driverId)

◆ getDriverName()

std::string rack::audio::Port::getDriverName ( )

◆ getDevice()

Device * rack::audio::Port::getDevice ( )

◆ getDeviceIds()

std::vector< int > rack::audio::Port::getDeviceIds ( )

◆ getDeviceId()

int rack::audio::Port::getDeviceId ( )

◆ setDeviceId()

void rack::audio::Port::setDeviceId ( int  deviceId)

◆ getDeviceNumInputs()

int rack::audio::Port::getDeviceNumInputs ( int  deviceId)

◆ getDeviceNumOutputs()

int rack::audio::Port::getDeviceNumOutputs ( int  deviceId)

◆ getDeviceName()

std::string rack::audio::Port::getDeviceName ( int  deviceId)

◆ getDeviceDetail()

std::string rack::audio::Port::getDeviceDetail ( int  deviceId,
int  offset 
)

◆ getSampleRates()

std::set< float > rack::audio::Port::getSampleRates ( )

◆ getSampleRate()

float rack::audio::Port::getSampleRate ( )

◆ setSampleRate()

void rack::audio::Port::setSampleRate ( float  sampleRate)

◆ getBlockSizes()

std::set< int > rack::audio::Port::getBlockSizes ( )

◆ getBlockSize()

int rack::audio::Port::getBlockSize ( )

◆ setBlockSize()

void rack::audio::Port::setBlockSize ( int  blockSize)

◆ getNumInputs()

int rack::audio::Port::getNumInputs ( )

Returns the number of active Port inputs, considering inputOffset and maxInputs.

◆ getNumOutputs()

int rack::audio::Port::getNumOutputs ( )

◆ toJson()

json_t * rack::audio::Port::toJson ( )

◆ fromJson()

void rack::audio::Port::fromJson ( json_t *  rootJ)

◆ processBuffer()

virtual void rack::audio::Port::processBuffer ( const float *  input,
int  inputStride,
float *  output,
int  outputStride,
int  frames 
)
inlinevirtual

Callback for processing the audio stream.

inputStride and outputStride are the number of array elements between frames in the buffers.

◆ processInput()

virtual void rack::audio::Port::processInput ( const float *  input,
int  inputStride,
int  frames 
)
inlinevirtual

Called before processBuffer() is called for all Ports of the same device.

Splitting the processBuffer() into these calls is useful for synchronizing Ports of the same device. Called even if there are no inputs.

◆ processOutput()

virtual void rack::audio::Port::processOutput ( float *  output,
int  outputStride,
int  frames 
)
inlinevirtual

Called after processBuffer() is called for all Ports of the same device.

◆ onStartStream()

virtual void rack::audio::Port::onStartStream ( )
inlinevirtual

◆ onStopStream()

virtual void rack::audio::Port::onStopStream ( )
inlinevirtual

Member Data Documentation

◆ inputOffset

int rack::audio::Port::inputOffset = 0

The first channel index of the device to process.

◆ outputOffset

int rack::audio::Port::outputOffset = 0

◆ maxInputs

int rack::audio::Port::maxInputs = 8

Maximum number of channels to process.

◆ maxOutputs

int rack::audio::Port::maxOutputs = 8

◆ driverId

int rack::audio::Port::driverId = -1

◆ deviceId

int rack::audio::Port::deviceId = -1

◆ driver

Driver* rack::audio::Port::driver = NULL

Not owned.

◆ device

Device* rack::audio::Port::device = NULL

◆ context

Context* rack::audio::Port::context

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