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

A single audio device of a driver API. More...

#include <audio.hpp>

Public Member Functions

virtual ~Device ()
 
virtual std::string getName ()
 
virtual int getNumInputs ()
 
virtual int getNumOutputs ()
 
virtual std::set< float > getSampleRates ()
 Returns a list of all valid (user-selectable) sample rates. More...
 
virtual float getSampleRate ()
 Returns the current sample rate. More...
 
virtual void setSampleRate (float sampleRate)
 Sets the sample rate of the device, re-opening it if needed. More...
 
virtual std::set< int > getBlockSizes ()
 Returns a list of all valid (user-selectable) block sizes. More...
 
virtual int getBlockSize ()
 Returns the current block size. More...
 
virtual void setBlockSize (int blockSize)
 Sets the block size of the device, re-opening it if needed. More...
 
virtual void subscribe (Port *port)
 
virtual void unsubscribe (Port *port)
 
void processBuffer (const float *input, int inputStride, float *output, int outputStride, int frames)
 
void onStartStream ()
 
void onStopStream ()
 

Public Attributes

std::set< Port * > subscribed
 
std::mutex processMutex
 Ensures that ports do not subscribe/unsubscribe while processBuffer() is called. More...
 

Detailed Description

A single audio device of a driver API.

Modules and the UI should not interact with this API directly. Use Port instead.

Methods throw rack::Exception if the driver API has an exception.

Constructor & Destructor Documentation

◆ ~Device()

virtual rack::audio::Device::~Device ( )
inlinevirtual

Member Function Documentation

◆ getName()

virtual std::string rack::audio::Device::getName ( )
inlinevirtual

◆ getNumInputs()

virtual int rack::audio::Device::getNumInputs ( )
inlinevirtual

◆ getNumOutputs()

virtual int rack::audio::Device::getNumOutputs ( )
inlinevirtual

◆ getSampleRates()

virtual std::set< float > rack::audio::Device::getSampleRates ( )
inlinevirtual

Returns a list of all valid (user-selectable) sample rates.

The device may accept sample rates not in this list, but it must accept sample rates in the list.

◆ getSampleRate()

virtual float rack::audio::Device::getSampleRate ( )
inlinevirtual

Returns the current sample rate.

◆ setSampleRate()

virtual void rack::audio::Device::setSampleRate ( float  sampleRate)
inlinevirtual

Sets the sample rate of the device, re-opening it if needed.

◆ getBlockSizes()

virtual std::set< int > rack::audio::Device::getBlockSizes ( )
inlinevirtual

Returns a list of all valid (user-selectable) block sizes.

The device may accept block sizes not in this list, but it must accept block sizes in the list.

◆ getBlockSize()

virtual int rack::audio::Device::getBlockSize ( )
inlinevirtual

Returns the current block size.

◆ setBlockSize()

virtual void rack::audio::Device::setBlockSize ( int  blockSize)
inlinevirtual

Sets the block size of the device, re-opening it if needed.

◆ subscribe()

virtual void rack::audio::Device::subscribe ( Port port)
virtual

◆ unsubscribe()

virtual void rack::audio::Device::unsubscribe ( Port port)
virtual

◆ processBuffer()

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

◆ onStartStream()

void rack::audio::Device::onStartStream ( )

◆ onStopStream()

void rack::audio::Device::onStopStream ( )

Member Data Documentation

◆ subscribed

std::set<Port*> rack::audio::Device::subscribed

◆ processMutex

std::mutex rack::audio::Device::processMutex

Ensures that ports do not subscribe/unsubscribe while processBuffer() is called.


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