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@14: #include "NoveltyCurveProcessor.h" c@14: #include "SpectrogramProcessor.h" c@25: #include "AutocorrelationProcessor.h" c@7: #include c@9: c@7: #include c@7: #include c@9: #include c@9: #include c@25: #include c@25: #include c@0: c@0: using std::string; c@0: using std::vector; c@0: c@18: typedef Spectrogram Tempogram; c@18: c@14: class TempogramPlugin : public Vamp::Plugin c@0: { c@0: public: c@14: TempogramPlugin(float inputSampleRate); c@14: virtual ~TempogramPlugin(); 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@18: size_t m_inputBlockSize; c@18: size_t m_inputStepSize; c@22: Spectrogram m_spectrogram; //spectrogram data c@9: c@18: //Novelty Curve specific parameters c@19: float m_noveltyCurveMinDB; c@29: float m_noveltyCurveMinV; c@18: float m_noveltyCurveCompressionConstant; c@9: c@18: //Tempogram specific parameters c@18: float m_tempogramLog2WindowLength; c@18: size_t m_tempogramWindowLength; c@18: float m_tempogramLog2FftLength; c@18: size_t m_tempogramFftLength; c@18: float m_tempogramLog2HopSize; c@18: size_t m_tempogramHopSize; c@0: c@18: float m_tempogramMinBPM; // tempogram output bin range min c@18: float m_tempogramMaxBPM; // tempogram output bin range max c@18: unsigned int m_tempogramMinBin; c@18: unsigned int m_tempogramMaxBin; c@28: unsigned int m_tempogramMinLag; c@28: unsigned int m_tempogramMaxLag; c@18: c@18: //Cyclic tempogram parameters c@18: float m_cyclicTempogramMinBPM; c@18: int m_cyclicTempogramNumberOfOctaves; c@18: int m_cyclicTempogramOctaveDivider; c@19: c@19: string floatToString(float value) const; c@22: vector< vector > calculateTempogramNearestNeighbourLogBins() const; c@22: unsigned int bpmToBin(const float &bpm) const; c@21: float binToBPM (const int &bin) const; c@21: bool handleParameterValues(); c@0: }; c@0: c@0: c@0: #endif