Mercurial > hg > lowfreq
view LowFreq.cpp @ 1:411c5c28fc43
Makefiles, and build fix
author | Chris Cannam |
---|---|
date | Wed, 05 Mar 2014 10:47:15 +0000 |
parents | b26975f6a1f1 |
children | a84bae4ee627 |
line wrap: on
line source
#include "LowFreq.h" static float defaultPShort = 0.1; static float defaultPLong = 1.0; LowFreq::LowFreq(float inputSampleRate) : Plugin(inputSampleRate), m_pShort(defaultPShort), m_pLong(defaultPLong) { } LowFreq::~LowFreq() { } string LowFreq::getIdentifier() const { return "lowfreq"; } string LowFreq::getName() const { return "Low-frequency Spectrogram"; } string LowFreq::getDescription() const { //!!! Return something helpful here! return ""; } string LowFreq::getMaker() const { return "Queen Mary, University of London"; } int LowFreq::getPluginVersion() const { return 1; } string LowFreq::getCopyright() const { return "GPL"; } LowFreq::InputDomain LowFreq::getInputDomain() const { return TimeDomain; } size_t LowFreq::getPreferredBlockSize() const { //!!! calculate from params return 0; } size_t LowFreq::getPreferredStepSize() const { //!!! return 0; } size_t LowFreq::getMinChannelCount() const { return 1; } size_t LowFreq::getMaxChannelCount() const { return 1; } LowFreq::ParameterList LowFreq::getParameterDescriptors() const { ParameterList list; ParameterDescriptor d; d.identifier = "p_short"; d.name = "Shortest Period"; d.description = "Period in seconds of the highest-frequency component to include in the spectrogram. That is, 1/f where f is the highest frequency (in Hz) spanned by the spectrogram."; d.unit = "s"; d.minValue = 0.01; d.maxValue = 10; d.defaultValue = defaultPShort; d.isQuantized = false; list.push_back(d); d.identifier = "p_long"; d.name = "Longest Period"; d.description = "Period in seconds of the lowest-frequency component to include in the spectrogram. That is, 1/f where f is the lowest frequency (in Hz) spanned by the spectrogram."; d.unit = "s"; d.minValue = 0.01; d.maxValue = 10; d.defaultValue = defaultPLong; d.isQuantized = false; list.push_back(d); return list; } float LowFreq::getParameter(string identifier) const { if (identifier == "p_short") { return m_pShort; } else if (identifier == "p_long") { return m_pLong; } return 0; } void LowFreq::setParameter(string identifier, float value) { if (identifier == "p_short") { m_pShort = value; } else if (identifier == "p_long") { m_pLong = value; } } LowFreq::ProgramList LowFreq::getPrograms() const { ProgramList list; return list; } string LowFreq::getCurrentProgram() const { return ""; // no programs } void LowFreq::selectProgram(string name) { } LowFreq::OutputList LowFreq::getOutputDescriptors() const { OutputList list; OutputDescriptor d; d.identifier = "spectrogram"; d.name = "Spectrogram"; d.description = ""; d.unit = ""; d.hasFixedBinCount = true; d.binCount = 1; //!!! calculate d.hasKnownExtents = false; d.isQuantized = false; d.sampleType = OutputDescriptor::OneSamplePerStep; d.hasDuration = false; list.push_back(d); return list; } bool LowFreq::initialise(size_t channels, size_t stepSize, size_t blockSize) { if (channels < getMinChannelCount() || channels > getMaxChannelCount()) return false; // Real initialisation work goes here! return true; } void LowFreq::reset() { // Clear buffers, reset stored values, etc } LowFreq::FeatureSet LowFreq::process(const float *const *inputBuffers, Vamp::RealTime timestamp) { // Do actual work! return FeatureSet(); } LowFreq::FeatureSet LowFreq::getRemainingFeatures() { return FeatureSet(); }