annotate TempogramPlugin.h @ 31:f795b84c1ff2

This include change seems necessary for my compiler
author Chris Cannam
date Thu, 04 Sep 2014 10:08:09 +0100
parents 1ad47a9afc2e
children 4cf2d163127b
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@14 25 #include "NoveltyCurveProcessor.h"
c@14 26 #include "SpectrogramProcessor.h"
c@25 27 #include "AutocorrelationProcessor.h"
c@7 28 #include <vamp-sdk/FFT.h>
c@9 29
c@7 30 #include <cmath>
c@7 31 #include <fstream>
c@9 32 #include <cassert>
c@9 33 #include <string>
c@25 34 #include <sstream>
c@25 35 #include <stdexcept>
c@0 36
c@0 37 using std::string;
c@0 38 using std::vector;
c@0 39
c@18 40 typedef Spectrogram Tempogram;
c@18 41
c@14 42 class TempogramPlugin : public Vamp::Plugin
c@0 43 {
c@0 44 public:
c@14 45 TempogramPlugin(float inputSampleRate);
c@14 46 virtual ~TempogramPlugin();
c@0 47
c@0 48 string getIdentifier() const;
c@0 49 string getName() const;
c@0 50 string getDescription() const;
c@0 51 string getMaker() const;
c@0 52 int getPluginVersion() const;
c@0 53 string getCopyright() const;
c@0 54
c@0 55 InputDomain getInputDomain() const;
c@0 56 size_t getPreferredBlockSize() const;
c@0 57 size_t getPreferredStepSize() const;
c@0 58 size_t getMinChannelCount() const;
c@0 59 size_t getMaxChannelCount() const;
c@0 60
c@0 61 ParameterList getParameterDescriptors() const;
c@0 62 float getParameter(string identifier) const;
c@0 63 void setParameter(string identifier, float value);
c@0 64
c@0 65 ProgramList getPrograms() const;
c@0 66 string getCurrentProgram() const;
c@0 67 void selectProgram(string name);
c@0 68
c@0 69 OutputList getOutputDescriptors() const;
c@9 70
c@0 71 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
c@0 72 void reset();
c@0 73
c@0 74 FeatureSet process(const float *const *inputBuffers,
c@0 75 Vamp::RealTime timestamp);
c@0 76
c@0 77 FeatureSet getRemainingFeatures();
c@0 78
c@0 79 protected:
c@0 80 // plugin-specific data and methods go here
c@18 81 size_t m_inputBlockSize;
c@18 82 size_t m_inputStepSize;
c@22 83 Spectrogram m_spectrogram; //spectrogram data
c@9 84
c@18 85 //Novelty Curve specific parameters
c@19 86 float m_noveltyCurveMinDB;
c@29 87 float m_noveltyCurveMinV;
c@18 88 float m_noveltyCurveCompressionConstant;
c@9 89
c@18 90 //Tempogram specific parameters
c@18 91 float m_tempogramLog2WindowLength;
c@18 92 size_t m_tempogramWindowLength;
c@18 93 float m_tempogramLog2FftLength;
c@18 94 size_t m_tempogramFftLength;
c@18 95 float m_tempogramLog2HopSize;
c@18 96 size_t m_tempogramHopSize;
c@0 97
c@18 98 float m_tempogramMinBPM; // tempogram output bin range min
c@18 99 float m_tempogramMaxBPM; // tempogram output bin range max
c@18 100 unsigned int m_tempogramMinBin;
c@18 101 unsigned int m_tempogramMaxBin;
c@28 102 unsigned int m_tempogramMinLag;
c@28 103 unsigned int m_tempogramMaxLag;
c@18 104
c@18 105 //Cyclic tempogram parameters
c@18 106 float m_cyclicTempogramMinBPM;
c@18 107 int m_cyclicTempogramNumberOfOctaves;
c@18 108 int m_cyclicTempogramOctaveDivider;
c@19 109
c@19 110 string floatToString(float value) const;
c@22 111 vector< vector<unsigned int> > calculateTempogramNearestNeighbourLogBins() const;
c@22 112 unsigned int bpmToBin(const float &bpm) const;
c@21 113 float binToBPM (const int &bin) const;
c@21 114 bool handleParameterValues();
c@0 115 };
c@0 116
c@0 117
c@0 118 #endif