48 Plugin(inputSampleRate),
50 m_previousSample(0.0f)
61 return "zerocrossing";
67 return "Zero Crossings";
73 return "Detect and count zero crossing points";
79 return "Vamp SDK Example Plugins";
91 return "Freely redistributable (BSD license)";
118 zc.
name =
"Zero Crossing Counts";
119 zc.
description =
"The number of zero crossing points per processing block";
120 zc.
unit =
"crossings";
130 zc.
name =
"Zero Crossings";
131 zc.
description =
"The locations of zero crossing points";
147 cerr <<
"ERROR: ZeroCrossing::process: "
148 <<
"ZeroCrossing has not been initialised"
160 float sample = inputBuffers[0][i];
161 bool crossing =
false;
164 if (prev > 0.0) crossing =
true;
165 }
else if (sample > 0.0) {
166 if (prev <= 0.0) crossing =
true;
175 returnFeatures[1].push_back(feature);
185 feature.
values.push_back(
float(count));
187 returnFeatures[0].push_back(feature);
188 return returnFeatures;
std::vector< OutputDescriptor > OutputList
FeatureSet process(const float *const *inputBuffers, Vamp::RealTime timestamp)
Process a single block of input data.
std::string getMaker() const
Get the name of the author or vendor of the plugin in human-readable form.
float sampleRate
Sample rate of the output results, as samples per second.
std::string getName() const
Get a human-readable name or title of the plugin.
bool hasFixedBinCount
True if the output has the same number of values per sample for every output sample.
std::string getIdentifier() const
Get the computer-usable name of the plugin.
std::vector< float > values
Results for a single sample of this feature.
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).
std::map< int, FeatureList > FeatureSet
float quantizeStep
Quantization resolution of the output values (e.g.
FeatureSet getRemainingFeatures()
After all blocks have been processed, calculate and return any remaining features derived from the co...
RealTime timestamp
Timestamp of the output feature.
std::string getDescription() const
Get a human-readable description for the plugin, typically a line of text that may optionally be disp...
std::string description
A human-readable short text describing the output.
void reset()
Reset the plugin after use, to prepare it for another clean run.
std::string identifier
The name of the output, in computer-usable form.
ZeroCrossing(float inputSampleRate)
OutputList getOutputDescriptors() const
Get the outputs of this plugin.
std::string unit
The unit of the output, in human-readable form.
std::string name
The human-readable name of the output.
RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conve...
bool hasTimestamp
True if an output feature has its own timestamp.
int getPluginVersion() const
Get the version number of the plugin.
static RealTime frame2RealTime(long frame, unsigned int sampleRate)
Convert a sample frame at the given sample rate into a RealTime.
Results from each process() align with that call's block start.
virtual size_t getMaxChannelCount() const
Get the maximum supported number of input channels.
size_t binCount
The number of values per result of the output.
bool isQuantized
True if the output values are quantized to a particular resolution.
virtual size_t getMinChannelCount() const
Get the minimum supported number of input channels.
std::string getCopyright() const
Get the copyright statement or licensing summary for the plugin.
SampleType sampleType
Positioning in time of the output results.
Results are unevenly spaced and have individual timestamps.
bool hasKnownExtents
True if the results in each output bin fall within a fixed numeric range (minimum and maximum values)...