view LowFreq.h @ 5:bf742ae09443

Frequency range, and resample to higher frequency to avoid transition band -- and some comments on what is still wrong with it
author Chris Cannam
date Mon, 10 Mar 2014 16:03:53 +0000
parents 9867e53a2592
children 4a777e3b515e
line wrap: on
line source
#ifndef _LOWFREQ_H_
#define _LOWFREQ_H_

#include <vamp-sdk/Plugin.h>

#include "base/Window.h"

using std::string;

class Resampler;
class FFT;

class LowFreq : public Vamp::Plugin
{
public:
    LowFreq(float inputSampleRate);
    virtual ~LowFreq();

    string getIdentifier() const;
    string getName() const;
    string getDescription() const;
    string getMaker() const;
    int getPluginVersion() const;
    string getCopyright() const;

    InputDomain getInputDomain() const;
    size_t getPreferredBlockSize() const;
    size_t getPreferredStepSize() const;
    size_t getMinChannelCount() const;
    size_t getMaxChannelCount() const;

    ParameterList getParameterDescriptors() const;
    float getParameter(string identifier) const;
    void setParameter(string identifier, float value);

    ProgramList getPrograms() const;
    string getCurrentProgram() const;
    void selectProgram(string name);

    OutputList getOutputDescriptors() const;

    bool initialise(size_t channels, size_t stepSize, size_t blockSize);
    void reset();

    FeatureSet process(const float *const *inputBuffers,
                       Vamp::RealTime timestamp);

    FeatureSet getRemainingFeatures();

protected:
    Feature processColumn();
    void advance();

    int getTargetSampleRate() const;
    int getTargetStepSize() const;
    int getFFTSize() const;
    int getFirstOutputBin() const;
    float getOutputBinFrequency(int i) const;

    float m_fmin;
    float m_fmax;
    int m_n;
    float m_overlap;

    int m_blockSize;

    Resampler *m_resampler;
    FFT *m_fft;
    Window<double> *m_window;
    std::vector<double> m_buffer;
};



#endif