rt-vamp-plugin-sdk  0.3.1
Real-time Vamp plugin SDK for C++20
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
rtvamp::pluginsdk::Plugin< NOutputs > Class Template Referenceabstract

Base class to implement feature extraction plugins. More...

#include <rtvamp/pluginsdk/Plugin.hpp>

Inheritance diagram for rtvamp::pluginsdk::Plugin< NOutputs >:
[legend]

Classes

struct  Meta
 Static plugin descriptor. More...
 

Public Types

using OutputList = std::array< OutputDescriptor, NOutputs >
 List of output descriptors. More...
 
using FeatureSet = std::array< Feature, NOutputs >
 Computed features for each output. More...
 
- Public Types inherited from rtvamp::pluginsdk::PluginBase
enum  InputDomain { InputDomain::Time, InputDomain::Frequency }
 Input domain of the plugin. More...
 
using TimeDomainBuffer = std::span< const float >
 Time domain buffer. More...
 
using FrequencyDomainBuffer = std::span< const std::complex< float > >
 Frequency domain buffer (FFT) More...
 
using InputBuffer = std::variant< TimeDomainBuffer, FrequencyDomainBuffer >
 Input domain variant. More...
 
using Feature = std::vector< float >
 Feature with one or more values (defined by OutputDescriptor::binCount) More...
 

Public Member Functions

constexpr Plugin (float inputSampleRate)
 
virtual std::optional< float > getParameter (std::string_view id) const
 
virtual bool setParameter (std::string_view id, float value)
 
virtual std::string_view getCurrentProgram () const
 
virtual bool selectProgram (std::string_view name)
 
virtual uint32_t getPreferredStepSize () const
 
virtual uint32_t getPreferredBlockSize () const
 
virtual OutputList getOutputDescriptors () const =0
 
virtual bool initialise (uint32_t stepSize, uint32_t blockSize)=0
 
virtual void reset ()=0
 
virtual const FeatureSetprocess (InputBuffer buffer, uint64_t nsec)=0
 
- Public Member Functions inherited from rtvamp::pluginsdk::PluginBase
virtual ~PluginBase ()=default
 

Static Public Attributes

static constexpr uint32_t outputCount = NOutputs
 Number of outputs (defined by template parameter) More...
 
static constexpr Meta meta {}
 Required static plugin descriptor. More...
 
static constexpr std::array< ParameterDescriptor, 0 > parameters {}
 Optional parameter descriptors (default: none) More...
 
static constexpr std::array< const char *, 0 > programs {}
 Optional program list (default: none) More...
 

Protected Member Functions

float getInputSampleRate () const noexcept
 
FeatureSetgetFeatureSet () noexcept
 
void initialiseFeatureSet ()
 

Detailed Description

template<uint32_t NOutputs>
class rtvamp::pluginsdk::Plugin< NOutputs >

Base class to implement feature extraction plugins.

The number of outputs is provided as a template parameter. This allows fixed-sized arrays for both the process results (FeatureSet) and output descriptors (OutputList) and therefore enforce the requirement of matching output size at compile time.

Static plugin descriptors are provided as static constexpr variables to generate the C API descriptor at compile time. Dynamic plugin descriptors and methods are defined as (pure) virtual functions.

Member Typedef Documentation

◆ FeatureSet

template<uint32_t NOutputs>
using rtvamp::pluginsdk::Plugin< NOutputs >::FeatureSet = std::array<Feature, NOutputs>

Computed features for each output.

◆ OutputList

template<uint32_t NOutputs>
using rtvamp::pluginsdk::Plugin< NOutputs >::OutputList = std::array<OutputDescriptor, NOutputs>

List of output descriptors.

Constructor & Destructor Documentation

◆ Plugin()

template<uint32_t NOutputs>
constexpr rtvamp::pluginsdk::Plugin< NOutputs >::Plugin ( float  inputSampleRate)
inlineexplicitconstexpr

Member Function Documentation

◆ getCurrentProgram()

template<uint32_t NOutputs>
virtual std::string_view rtvamp::pluginsdk::Plugin< NOutputs >::getCurrentProgram ( ) const
inlinevirtual

◆ getFeatureSet()

template<uint32_t NOutputs>
FeatureSet& rtvamp::pluginsdk::Plugin< NOutputs >::getFeatureSet ( )
inlineprotectednoexcept

◆ getInputSampleRate()

template<uint32_t NOutputs>
float rtvamp::pluginsdk::Plugin< NOutputs >::getInputSampleRate ( ) const
inlineprotectednoexcept

◆ getOutputDescriptors()

template<uint32_t NOutputs>
virtual OutputList rtvamp::pluginsdk::Plugin< NOutputs >::getOutputDescriptors ( ) const
pure virtual

◆ getParameter()

template<uint32_t NOutputs>
virtual std::optional<float> rtvamp::pluginsdk::Plugin< NOutputs >::getParameter ( std::string_view  id) const
inlinevirtual

◆ getPreferredBlockSize()

template<uint32_t NOutputs>
virtual uint32_t rtvamp::pluginsdk::Plugin< NOutputs >::getPreferredBlockSize ( ) const
inlinevirtual

◆ getPreferredStepSize()

template<uint32_t NOutputs>
virtual uint32_t rtvamp::pluginsdk::Plugin< NOutputs >::getPreferredStepSize ( ) const
inlinevirtual

◆ initialise()

template<uint32_t NOutputs>
virtual bool rtvamp::pluginsdk::Plugin< NOutputs >::initialise ( uint32_t  stepSize,
uint32_t  blockSize 
)
pure virtual

◆ initialiseFeatureSet()

template<uint32_t NOutputs>
void rtvamp::pluginsdk::Plugin< NOutputs >::initialiseFeatureSet
protected

◆ process()

template<uint32_t NOutputs>
virtual const FeatureSet& rtvamp::pluginsdk::Plugin< NOutputs >::process ( InputBuffer  buffer,
uint64_t  nsec 
)
pure virtual

◆ reset()

template<uint32_t NOutputs>
virtual void rtvamp::pluginsdk::Plugin< NOutputs >::reset ( )
pure virtual

◆ selectProgram()

template<uint32_t NOutputs>
virtual bool rtvamp::pluginsdk::Plugin< NOutputs >::selectProgram ( std::string_view  name)
inlinevirtual

◆ setParameter()

template<uint32_t NOutputs>
virtual bool rtvamp::pluginsdk::Plugin< NOutputs >::setParameter ( std::string_view  id,
float  value 
)
inlinevirtual

Member Data Documentation

◆ meta

template<uint32_t NOutputs>
constexpr Meta rtvamp::pluginsdk::Plugin< NOutputs >::meta {}
staticconstexpr

Required static plugin descriptor.

◆ outputCount

template<uint32_t NOutputs>
constexpr uint32_t rtvamp::pluginsdk::Plugin< NOutputs >::outputCount = NOutputs
staticconstexpr

Number of outputs (defined by template parameter)

◆ parameters

template<uint32_t NOutputs>
constexpr std::array<ParameterDescriptor, 0> rtvamp::pluginsdk::Plugin< NOutputs >::parameters {}
staticconstexpr

Optional parameter descriptors (default: none)

◆ programs

template<uint32_t NOutputs>
constexpr std::array<const char*, 0> rtvamp::pluginsdk::Plugin< NOutputs >::programs {}
staticconstexpr

Optional program list (default: none)


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