annotate Tempogram.h @ 10:17a260410116

Change NULL to 0 throughout
author Chris Cannam
date Tue, 12 Aug 2014 16:20:14 +0100
parents be59b4a73f49
children 09fb76606b2b
rev   line source
c@0 1
c@0 2 // This is a skeleton file for use in creating your own plugin
c@0 3 // libraries. Replace MyPlugin and myPlugin throughout with the name
c@0 4 // of your first plugin class, and fill in the gaps as appropriate.
c@0 5
c@9 6 //* 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 7 //* I've taken this approach with NoveltyCurve, Spectrogram and FIRFilter too. Is this a good approach?
c@9 8 //* The names "cleanUpForGRF()" and "initialise...()" are horrible...
c@9 9 //* The "m_..." variable name thing (I've been quite inconsitent with that)
c@9 10 //* Using size_t and not unsigned int?
c@9 11 //* In Tempogram.h, should the protected methods be private?
c@9 12 //* NoveltyCurve::NoveltyCurve() calls initialise(). May be overdetermined with amount of info? i.e., constructor takes parameters fftLength, numberOfBlocks... these are dimensions of vector< vector<float> >spectrogram.
c@9 13 //* When to use function() const?
c@9 14 //* spectrogram continues for too long? see tempogram output
c@9 15 //* should WindowFunction::hanning be static? Justification: no initialisation needed (i.e., no need for a constructor!).
c@9 16
c@0 17
c@0 18 // Remember to use a different guard symbol in each header!
c@0 19 #ifndef _TEMPOGRAM_H_
c@0 20 #define _TEMPOGRAM_H_
c@0 21
c@0 22 #include <vamp-sdk/Plugin.h>
c@7 23 #include "FIRFilter.h"
c@7 24 #include "WindowFunction.h"
c@7 25 #include "NoveltyCurve.h"
c@9 26 #include "Spectrogram.h"
c@7 27 #include <vamp-sdk/FFT.h>
c@9 28
c@7 29 #include <cmath>
c@7 30 #include <fstream>
c@9 31 #include <cassert>
c@9 32 #include <string>
c@0 33
c@0 34 using std::string;
c@0 35 using std::vector;
c@0 36
c@0 37 class Tempogram : public Vamp::Plugin
c@0 38 {
c@0 39 public:
c@0 40 Tempogram(float inputSampleRate);
c@0 41 virtual ~Tempogram();
c@0 42
c@0 43 string getIdentifier() const;
c@0 44 string getName() const;
c@0 45 string getDescription() const;
c@0 46 string getMaker() const;
c@0 47 int getPluginVersion() const;
c@0 48 string getCopyright() const;
c@0 49
c@0 50 InputDomain getInputDomain() const;
c@0 51 size_t getPreferredBlockSize() const;
c@0 52 size_t getPreferredStepSize() const;
c@0 53 size_t getMinChannelCount() const;
c@0 54 size_t getMaxChannelCount() const;
c@0 55
c@0 56 ParameterList getParameterDescriptors() const;
c@0 57 float getParameter(string identifier) const;
c@0 58 void setParameter(string identifier, float value);
c@0 59
c@0 60 ProgramList getPrograms() const;
c@0 61 string getCurrentProgram() const;
c@0 62 void selectProgram(string name);
c@0 63
c@0 64 OutputList getOutputDescriptors() const;
c@9 65
c@0 66 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
c@0 67 void reset();
c@0 68
c@0 69 FeatureSet process(const float *const *inputBuffers,
c@0 70 Vamp::RealTime timestamp);
c@0 71
c@0 72 FeatureSet getRemainingFeatures();
c@0 73
c@0 74 protected:
c@0 75 // plugin-specific data and methods go here
c@0 76 size_t m_blockSize;
c@1 77 size_t m_stepSize;
c@0 78 float compressionConstant;
c@0 79 float *previousY;
c@0 80 float *currentY;
c@9 81 vector< vector<float> > specData; //spectrogram data
c@9 82 vector<float> noveltyCurve; //novelty curve data
c@3 83 float minDB;
c@0 84
c@9 85 void cleanup(); //used to release anything allocated in initialise()
c@9 86 void initialiseForGRF(); //used to initialise anything for getRemainingFeatures()
c@9 87 void cleanupForGRF(); //used to clean up anything allocated in initialiseForGRF()
c@9 88 string floatToString(float value) const;
c@9 89 void updateBPMParameters();
c@9 90
c@9 91 //FFT params for noveltyCurve -> tempogra
c@9 92 unsigned int windowLength;
c@9 93 unsigned int fftLength;
c@0 94 unsigned int thopSize;
c@9 95
c@9 96 float minBPM; // tempogram output bin range min
c@9 97 float maxBPM; // tempogram output bin range max
c@9 98 unsigned int minBin;
c@9 99 unsigned int maxBin;
c@0 100
c@3 101 int numberOfBlocks;
c@0 102 float *hannWindowtN;
c@0 103
c@0 104 vector<Vamp::RealTime> ncTimestamps;
c@0 105 };
c@0 106
c@0 107
c@0 108 #endif