cannam@0: cannam@0:
cannam@0:#include <SpectralCentroid.h>
cannam@0: cannam@0:
cannam@0: List of all members.
Definition at line 47 of file SpectralCentroid.h.
cannam@0:Public Types | |
enum | InputDomain { TimeDomain, cannam@0: FrequencyDomain cannam@0: } |
typedef std::vector cannam@0: < OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, cannam@0: FeatureList > | FeatureSet |
typedef std::vector cannam@0: < ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
Public Member Functions | |
SpectralCentroid (float inputSampleRate) | |
virtual | ~SpectralCentroid () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
Initialise a plugin to prepare it for use with the given number of input channels, step size (window increment, in sample frames) and block size (window size, in sample frames). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
FeatureSet | process (const float *const *inputBuffers, Vamp::RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
virtual size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
virtual size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
virtual size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
virtual size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
virtual unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
virtual ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
virtual float | getParameter (std::string) const |
Get the value of a named parameter. | |
virtual void | setParameter (std::string, float) |
Set a named parameter. | |
virtual ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
virtual std::string | getCurrentProgram () const |
Get the current program. | |
virtual void | selectProgram (std::string) |
Select a program. | |
Protected Attributes | |
size_t | m_stepSize |
size_t | m_blockSize |
float | m_inputSampleRate |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
cannam@0:
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
cannam@0:
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
cannam@0:
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
cannam@0:
cannam@0: cannam@0:
Definition at line 195 of file PluginBase.h.
cannam@0: cannam@0:typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
cannam@0:
cannam@0: cannam@0:
Definition at line 217 of file PluginBase.h.
cannam@0: cannam@0:cannam@0:
enum Vamp::Plugin::InputDomain [inherited] |
cannam@0:
cannam@0:
SpectralCentroid::SpectralCentroid | cannam@0:( | cannam@0:float | cannam@0:inputSampleRate | cannam@0:) | cannam@0:cannam@0: |
cannam@0: cannam@0:
Definition at line 47 of file SpectralCentroid.cpp.
cannam@0: cannam@0:SpectralCentroid::~SpectralCentroid | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: [virtual] |
cannam@0:
cannam@0: cannam@0:
Definition at line 54 of file SpectralCentroid.cpp.
cannam@0: cannam@0:cannam@0:
bool SpectralCentroid::initialise | cannam@0:( | cannam@0:size_t | cannam@0:inputChannels, | cannam@0:|
cannam@0: | cannam@0: | size_t | cannam@0:stepSize, | cannam@0:|
cannam@0: | cannam@0: | size_t | cannam@0:blockSize | cannam@0: |
cannam@0: | ) | cannam@0: [virtual] |
cannam@0:
cannam@0: Initialise a plugin to prepare it for use with the given number of input channels, step size (window increment, in sample frames) and block size (window size, in sample frames). cannam@0:
cannam@0: The input sample rate should have been already specified at construction time.
cannam@0: Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported. cannam@0:
Implements Vamp::Plugin.
cannam@0: cannam@0:Definition at line 95 of file SpectralCentroid.cpp.
cannam@0: cannam@0:References Vamp::Plugin::getMaxChannelCount(), Vamp::Plugin::getMinChannelCount(), m_blockSize, and m_stepSize.
cannam@0: cannam@0:void SpectralCentroid::reset | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: [virtual] |
cannam@0:
cannam@0: Reset the plugin after use, to prepare it for another clean run. cannam@0:
cannam@0: Not called for the first initialisation (i.e. initialise must also do a reset). cannam@0:
Implements Vamp::Plugin.
cannam@0: cannam@0:Definition at line 107 of file SpectralCentroid.cpp.
cannam@0: cannam@0:InputDomain SpectralCentroid::getInputDomain | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual] |
cannam@0:
cannam@0: Get the plugin's required input domain. cannam@0:
cannam@0: If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin. If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window. cannam@0:
Implements Vamp::Plugin.
cannam@0: cannam@0:Definition at line 56 of file SpectralCentroid.h.
cannam@0: cannam@0:References Vamp::Plugin::FrequencyDomain.
cannam@0: cannam@0:string SpectralCentroid::getIdentifier | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [virtual] |
cannam@0:
cannam@0: Get the computer-usable name of the plugin. cannam@0:
cannam@0: This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
cannam@0: This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
cannam@0: Example: "zero_crossings" cannam@0:
Implements Vamp::PluginBase.
cannam@0: cannam@0:Definition at line 59 of file SpectralCentroid.cpp.
cannam@0: cannam@0:string SpectralCentroid::getName | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [virtual] |
cannam@0:
cannam@0: Get a human-readable name or title of the plugin. cannam@0:
cannam@0: This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
cannam@0: Example: "Zero Crossings" cannam@0:
Implements Vamp::PluginBase.
cannam@0: cannam@0:Definition at line 65 of file SpectralCentroid.cpp.
cannam@0: cannam@0:string SpectralCentroid::getDescription | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [virtual] |
cannam@0:
cannam@0: Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". cannam@0:
cannam@0: May be empty if the name has said it all already.
cannam@0: Example: "Detect and count zero crossing points" cannam@0:
Implements Vamp::PluginBase.
cannam@0: cannam@0:Definition at line 71 of file SpectralCentroid.cpp.
cannam@0: cannam@0:string SpectralCentroid::getMaker | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [virtual] |
cannam@0:
cannam@0: Get the name of the author or vendor of the plugin in human-readable form. cannam@0:
cannam@0: This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar. cannam@0:
Implements Vamp::PluginBase.
cannam@0: cannam@0:Definition at line 77 of file SpectralCentroid.cpp.
cannam@0: cannam@0:int SpectralCentroid::getPluginVersion | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [virtual] |
cannam@0:
cannam@0: Get the version number of the plugin. cannam@0:
cannam@0: cannam@0:
Implements Vamp::PluginBase.
cannam@0: cannam@0:Definition at line 83 of file SpectralCentroid.cpp.
cannam@0: cannam@0:string SpectralCentroid::getCopyright | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [virtual] |
cannam@0:
cannam@0: Get the copyright statement or licensing summary for the plugin. cannam@0:
cannam@0: This can be an informative text, without the same presentation constraints as mentioned for getMaker above. cannam@0:
Implements Vamp::PluginBase.
cannam@0: cannam@0:Definition at line 89 of file SpectralCentroid.cpp.
cannam@0: cannam@0:SpectralCentroid::OutputList SpectralCentroid::getOutputDescriptors | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [virtual] |
cannam@0:
cannam@0: Get the outputs of this plugin. cannam@0:
cannam@0: An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call. cannam@0:
Implements Vamp::Plugin.
cannam@0: cannam@0:Definition at line 112 of file SpectralCentroid.cpp.
cannam@0: cannam@0:References Vamp::Plugin::OutputDescriptor::binCount, Vamp::Plugin::OutputDescriptor::description, Vamp::Plugin::OutputDescriptor::hasFixedBinCount, Vamp::Plugin::OutputDescriptor::hasKnownExtents, Vamp::Plugin::OutputDescriptor::identifier, Vamp::Plugin::OutputDescriptor::isQuantized, Vamp::Plugin::OutputDescriptor::name, Vamp::Plugin::OutputDescriptor::OneSamplePerStep, Vamp::Plugin::OutputDescriptor::sampleType, and Vamp::Plugin::OutputDescriptor::unit.
cannam@0: cannam@0:SpectralCentroid::FeatureSet SpectralCentroid::process | cannam@0:( | cannam@0:const float *const * | cannam@0:inputBuffers, | cannam@0:|
cannam@0: | cannam@0: | Vamp::RealTime | cannam@0:timestamp | cannam@0: |
cannam@0: | ) | cannam@0: [virtual] |
cannam@0:
cannam@0: Process a single block of input data. cannam@0:
cannam@0: If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp will be the real time in seconds of the start of the supplied block of samples.
cannam@0: If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
cannam@0: Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.) cannam@0:
Implements Vamp::Plugin.
cannam@0: cannam@0:Definition at line 137 of file SpectralCentroid.cpp.
cannam@0: cannam@0:References Vamp::Plugin::Feature::hasTimestamp, m_blockSize, Vamp::Plugin::m_inputSampleRate, m_stepSize, and Vamp::Plugin::Feature::values.
cannam@0: cannam@0:SpectralCentroid::FeatureSet SpectralCentroid::getRemainingFeatures | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: [virtual] |
cannam@0:
cannam@0: After all blocks have been processed, calculate and return any remaining features derived from the complete input. cannam@0:
cannam@0: cannam@0:
Implements Vamp::Plugin.
cannam@0: cannam@0:Definition at line 184 of file SpectralCentroid.cpp.
cannam@0: cannam@0:virtual size_t Vamp::Plugin::getPreferredBlockSize | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual, inherited] |
cannam@0:
cannam@0: Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). cannam@0:
cannam@0: This should be called before initialise().
cannam@0: A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call. cannam@0:
Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
cannam@0: cannam@0:Definition at line 171 of file Plugin.h.
cannam@0: cannam@0:Referenced by Vamp::HostExt::PluginWrapper::getPreferredBlockSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredBlockSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), and runPlugin().
cannam@0: cannam@0:virtual size_t Vamp::Plugin::getPreferredStepSize | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual, inherited] |
cannam@0:
cannam@0: Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. cannam@0:
cannam@0: This should be called before initialise().
cannam@0: A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call. cannam@0:
Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
cannam@0: cannam@0:Definition at line 186 of file Plugin.h.
cannam@0: cannam@0:Referenced by Vamp::HostExt::PluginWrapper::getPreferredStepSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredStepSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), and runPlugin().
cannam@0: cannam@0:virtual size_t Vamp::Plugin::getMinChannelCount | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual, inherited] |
cannam@0:
cannam@0: Get the minimum supported number of input channels. cannam@0:
cannam@0: cannam@0:
Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
cannam@0: cannam@0:Definition at line 191 of file Plugin.h.
cannam@0: cannam@0:Referenced by Vamp::HostExt::PluginWrapper::getMinChannelCount(), ZeroCrossing::initialise(), initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), and runPlugin().
cannam@0: cannam@0:virtual size_t Vamp::Plugin::getMaxChannelCount | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual, inherited] |
cannam@0:
cannam@0: Get the maximum supported number of input channels. cannam@0:
cannam@0: cannam@0:
Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
cannam@0: cannam@0:Definition at line 196 of file Plugin.h.
cannam@0: cannam@0:Referenced by Vamp::HostExt::PluginWrapper::getMaxChannelCount(), ZeroCrossing::initialise(), initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), and runPlugin().
cannam@0: cannam@0:virtual std::string Vamp::Plugin::getType | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual, inherited] |
cannam@0:
cannam@0: Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. cannam@0:
cannam@0: Do not reimplement this function in your subclass. cannam@0:
Implements Vamp::PluginBase.
cannam@0: cannam@0: cannam@0: cannam@0:virtual unsigned int Vamp::PluginBase::getVampApiVersion | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual, inherited] |
cannam@0:
cannam@0: Get the Vamp API compatibility level of the plugin. cannam@0:
cannam@0: cannam@0:
Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
cannam@0: cannam@0:Definition at line 67 of file PluginBase.h.
cannam@0: cannam@0:Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getVampApiVersion().
cannam@0: cannam@0:virtual ParameterList Vamp::PluginBase::getParameterDescriptors | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual, inherited] |
cannam@0:
cannam@0: Get the controllable parameters of this plugin. cannam@0:
cannam@0: cannam@0:
Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
cannam@0: cannam@0:Definition at line 200 of file PluginBase.h.
cannam@0: cannam@0:Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getParameterDescriptors().
cannam@0: cannam@0:virtual float Vamp::PluginBase::getParameter | cannam@0:( | cannam@0:std::string | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual, inherited] |
cannam@0:
cannam@0: Get the value of a named parameter. cannam@0:
cannam@0: The argument is the identifier field from that parameter's descriptor. cannam@0:
Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
cannam@0: cannam@0:Definition at line 208 of file PluginBase.h.
cannam@0: cannam@0:Referenced by Vamp::HostExt::PluginWrapper::getParameter().
cannam@0: cannam@0:virtual void Vamp::PluginBase::setParameter | cannam@0:( | cannam@0:std::string | cannam@0:, | cannam@0:|
cannam@0: | cannam@0: | float | cannam@0:cannam@0: | |
cannam@0: | ) | cannam@0: [inline, virtual, inherited] |
cannam@0:
cannam@0: Set a named parameter. cannam@0:
cannam@0: The first argument is the identifier field from that parameter's descriptor. cannam@0:
Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
cannam@0: cannam@0:Definition at line 214 of file PluginBase.h.
cannam@0: cannam@0:Referenced by Vamp::HostExt::PluginWrapper::setParameter().
cannam@0: cannam@0:virtual ProgramList Vamp::PluginBase::getPrograms | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual, inherited] |
cannam@0:
cannam@0: Get the program settings available in this plugin. cannam@0:
cannam@0: A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
cannam@0: The programs must have unique names. cannam@0:
Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
cannam@0: cannam@0:Definition at line 229 of file PluginBase.h.
cannam@0: cannam@0:Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPrograms().
cannam@0: cannam@0:virtual std::string Vamp::PluginBase::getCurrentProgram | cannam@0:( | cannam@0:cannam@0: | ) | cannam@0: const [inline, virtual, inherited] |
cannam@0:
cannam@0: Get the current program. cannam@0:
cannam@0: cannam@0:
Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
cannam@0: cannam@0:Definition at line 234 of file PluginBase.h.
cannam@0: cannam@0:Referenced by Vamp::HostExt::PluginWrapper::getCurrentProgram().
cannam@0: cannam@0:virtual void Vamp::PluginBase::selectProgram | cannam@0:( | cannam@0:std::string | cannam@0:cannam@0: | ) | cannam@0: [inline, virtual, inherited] |
cannam@0:
cannam@0: Select a program. cannam@0:
cannam@0: (If the given program name is not one of the available programs, do nothing.) cannam@0:
Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
cannam@0: cannam@0:Definition at line 240 of file PluginBase.h.
cannam@0: cannam@0:Referenced by Vamp::HostExt::PluginWrapper::selectProgram().
cannam@0: cannam@0:cannam@0:
size_t SpectralCentroid::m_stepSize [protected] |
cannam@0:
cannam@0: cannam@0:
Definition at line 73 of file SpectralCentroid.h.
cannam@0: cannam@0:Referenced by initialise(), and process().
cannam@0: cannam@0:size_t SpectralCentroid::m_blockSize [protected] |
cannam@0:
cannam@0: cannam@0:
Definition at line 74 of file SpectralCentroid.h.
cannam@0: cannam@0:Referenced by initialise(), and process().
cannam@0: cannam@0:float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
cannam@0:
cannam@0: cannam@0:
Definition at line 397 of file Plugin.h.
cannam@0: cannam@0:Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), process(), and PercussionOnsetDetector::process().
cannam@0: cannam@0:cannam@0: