annotate plugins/AdaptiveSpectrogram.h @ 92:3602e755b696

* Add the Adaptive Spectrogram plugin -- but it isn't working correctly yet. Also, when it does work, it will need to be refactored out into the qm-dsp library
author Chris Cannam <c.cannam@qmul.ac.uk>
date Fri, 27 Feb 2009 10:45:10 +0000
parents
children 8700a93424f4
rev   line source
c@92 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@92 2
c@92 3 /*
c@92 4 QM Vamp Plugin Set
c@92 5
c@92 6 Centre for Digital Music, Queen Mary, University of London.
c@92 7 All rights reserved.
c@92 8 */
c@92 9
c@92 10 #ifndef _ADAPTIVE_SPECTROGRAM_H_
c@92 11 #define _ADAPTIVE_SPECTROGRAM_H_
c@92 12
c@92 13 #include <vamp-sdk/Plugin.h>
c@92 14 #include <cmath>
c@92 15 #include <vector>
c@92 16
c@92 17 class AdaptiveSpectrogram : public Vamp::Plugin
c@92 18 {
c@92 19 public:
c@92 20 AdaptiveSpectrogram(float inputSampleRate);
c@92 21 virtual ~AdaptiveSpectrogram();
c@92 22
c@92 23 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
c@92 24 void reset();
c@92 25
c@92 26 InputDomain getInputDomain() const { return TimeDomain; }
c@92 27
c@92 28 std::string getIdentifier() const;
c@92 29 std::string getName() const;
c@92 30 std::string getDescription() const;
c@92 31 std::string getMaker() const;
c@92 32 int getPluginVersion() const;
c@92 33 std::string getCopyright() const;
c@92 34
c@92 35 size_t getPreferredStepSize() const;
c@92 36 size_t getPreferredBlockSize() const;
c@92 37
c@92 38 ParameterList getParameterDescriptors() const;
c@92 39 float getParameter(std::string id) const;
c@92 40 void setParameter(std::string id, float value);
c@92 41
c@92 42 OutputList getOutputDescriptors() const;
c@92 43
c@92 44 FeatureSet process(const float *const *inputBuffers,
c@92 45 Vamp::RealTime timestamp);
c@92 46
c@92 47 FeatureSet getRemainingFeatures();
c@92 48
c@92 49 protected:
c@92 50 int m_w;
c@92 51 int m_n;
c@92 52
c@92 53 inline double xlogx(double x) {
c@92 54 if (x == 0.0) return 0.0;
c@92 55 else return x * log(x);
c@92 56 }
c@92 57
c@92 58 void unpackResultMatrix(std::vector<std::vector<float> > &rmat,
c@92 59 int x, int y, int w, int h,
c@92 60 int *spl,
c@92 61 double *spec, int specsz, int res);
c@92 62
c@92 63 double DoCutSpectrogramBlock2(int* spl, double*** Specs, int Y, int R0,
c@92 64 int x0, int Y0, int N, double& ene);
c@92 65
c@92 66 double DoMixSpectrogramBlock2(int* spl, double* Spec, double*** Specs,
c@92 67 int Y, int R0, int x0, int Y0,
c@92 68 bool normmix, int res, double* e);
c@92 69
c@92 70 double MixSpectrogramBlock2(int* spl, double* Spec, double*** Specs,
c@92 71 int WID, int wid, bool normmix);
c@92 72
c@92 73 double MixSpectrogram2(int** spl, double** Spec, double*** Specs, int Fr,
c@92 74 int WID, int wid, bool norm, bool normmix);
c@92 75 };
c@92 76
c@92 77
c@92 78 #endif