c@0: c@0: // This is a skeleton file for use in creating your own plugin c@0: // libraries. Replace MyPlugin and myPlugin throughout with the name c@0: // of your first plugin class, and fill in the gaps as appropriate. c@0: c@9: //* Should I use initialiseForGRF()? I generally think it's nicer to initialise stuff before processing. It just means that for some reason if somebody needs to process quickly (and have preparation time before) it's a bit easier on the load. c@9: //* I've taken this approach with NoveltyCurve, Spectrogram and FIRFilter too. Is this a good approach? c@9: //* The names "cleanUpForGRF()" and "initialise...()" are horrible... c@9: //* The "m_..." variable name thing (I've been quite inconsitent with that) c@9: //* Using size_t and not unsigned int? c@9: //* In Tempogram.h, should the protected methods be private? c@9: //* NoveltyCurve::NoveltyCurve() calls initialise(). May be overdetermined with amount of info? i.e., constructor takes parameters fftLength, numberOfBlocks... these are dimensions of vector< vector >spectrogram. c@9: //* When to use function() const? c@9: //* spectrogram continues for too long? see tempogram output c@9: //* should WindowFunction::hanning be static? Justification: no initialisation needed (i.e., no need for a constructor!). c@9: c@0: c@0: // Remember to use a different guard symbol in each header! c@0: #ifndef _TEMPOGRAM_H_ c@0: #define _TEMPOGRAM_H_ c@0: c@0: #include c@7: #include "FIRFilter.h" c@7: #include "WindowFunction.h" c@7: #include "NoveltyCurve.h" c@9: #include "Spectrogram.h" c@7: #include c@9: c@7: #include c@7: #include c@9: #include c@9: #include c@0: c@0: using std::string; c@0: using std::vector; c@0: c@0: class Tempogram : public Vamp::Plugin c@0: { c@0: public: c@0: Tempogram(float inputSampleRate); c@0: virtual ~Tempogram(); c@0: c@0: string getIdentifier() const; c@0: string getName() const; c@0: string getDescription() const; c@0: string getMaker() const; c@0: int getPluginVersion() const; c@0: string getCopyright() const; c@0: c@0: InputDomain getInputDomain() const; c@0: size_t getPreferredBlockSize() const; c@0: size_t getPreferredStepSize() const; c@0: size_t getMinChannelCount() const; c@0: size_t getMaxChannelCount() const; c@0: c@0: ParameterList getParameterDescriptors() const; c@0: float getParameter(string identifier) const; c@0: void setParameter(string identifier, float value); c@0: c@0: ProgramList getPrograms() const; c@0: string getCurrentProgram() const; c@0: void selectProgram(string name); c@0: c@0: OutputList getOutputDescriptors() const; c@9: c@0: bool initialise(size_t channels, size_t stepSize, size_t blockSize); c@0: void reset(); c@0: c@0: FeatureSet process(const float *const *inputBuffers, c@0: Vamp::RealTime timestamp); c@0: c@0: FeatureSet getRemainingFeatures(); c@0: c@0: protected: c@0: // plugin-specific data and methods go here c@0: size_t m_blockSize; c@1: size_t m_stepSize; c@13: float m_compressionConstant; c@13: vector< vector > m_spectrogram; //spectrogram data c@13: vector m_noveltyCurve; //novelty curve data c@13: float m_minDB; c@0: c@9: void cleanup(); //used to release anything allocated in initialise() c@9: string floatToString(float value) const; c@9: void updateBPMParameters(); c@9: c@9: //FFT params for noveltyCurve -> tempogra c@13: int m_log2WindowLength; c@13: size_t m_windowLength; c@13: size_t m_fftLength; c@13: size_t m_hopSize; c@9: c@13: float m_minBPM; // tempogram output bin range min c@13: float m_maxBPM; // tempogram output bin range max c@13: unsigned int m_minBin; c@13: unsigned int m_maxBin; c@0: c@13: unsigned int m_numberOfBlocks; c@0: c@0: vector ncTimestamps; c@0: }; c@0: c@0: c@0: #endif