annotate examples/FixedTempoEstimator.h @ 211:caa9d07bb9bd

* Update VC project file to handle proper export of plugin lookup function, and use the right dll name to match the other platforms and the .cat file
author cannam
date Sat, 18 Oct 2008 16:51:51 +0000
parents fa8afbb7221b
children 3cf5bd155e5b
rev   line source
cannam@198 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@198 2
cannam@198 3 /*
cannam@198 4 Vamp
cannam@198 5
cannam@198 6 An API for audio analysis and feature extraction plugins.
cannam@198 7
cannam@198 8 Centre for Digital Music, Queen Mary, University of London.
cannam@198 9 Copyright 2006-2008 Chris Cannam and QMUL.
cannam@198 10
cannam@198 11 Permission is hereby granted, free of charge, to any person
cannam@198 12 obtaining a copy of this software and associated documentation
cannam@198 13 files (the "Software"), to deal in the Software without
cannam@198 14 restriction, including without limitation the rights to use, copy,
cannam@198 15 modify, merge, publish, distribute, sublicense, and/or sell copies
cannam@198 16 of the Software, and to permit persons to whom the Software is
cannam@198 17 furnished to do so, subject to the following conditions:
cannam@198 18
cannam@198 19 The above copyright notice and this permission notice shall be
cannam@198 20 included in all copies or substantial portions of the Software.
cannam@198 21
cannam@198 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
cannam@198 23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
cannam@198 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
cannam@198 25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
cannam@198 26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
cannam@198 27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
cannam@198 28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
cannam@198 29
cannam@198 30 Except as contained in this notice, the names of the Centre for
cannam@198 31 Digital Music; Queen Mary, University of London; and Chris Cannam
cannam@198 32 shall not be used in advertising or otherwise to promote the sale,
cannam@198 33 use or other dealings in this Software without prior written
cannam@198 34 authorization.
cannam@198 35 */
cannam@198 36
cannam@198 37 #ifndef _FIXED_TEMPO_ESTIMATOR_PLUGIN_H_
cannam@198 38 #define _FIXED_TEMPO_ESTIMATOR_PLUGIN_H_
cannam@198 39
cannam@198 40 #include "vamp-sdk/Plugin.h"
cannam@198 41
cannam@198 42 /**
cannam@198 43 * Example plugin that estimates the tempo of a short fixed-tempo sample.
cannam@198 44 */
cannam@198 45
cannam@198 46 class FixedTempoEstimator : public Vamp::Plugin
cannam@198 47 {
cannam@198 48 public:
cannam@198 49 FixedTempoEstimator(float inputSampleRate);
cannam@198 50 virtual ~FixedTempoEstimator();
cannam@198 51
cannam@198 52 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
cannam@198 53 void reset();
cannam@198 54
cannam@198 55 InputDomain getInputDomain() const { return FrequencyDomain; }
cannam@198 56
cannam@198 57 std::string getIdentifier() const;
cannam@198 58 std::string getName() const;
cannam@198 59 std::string getDescription() const;
cannam@198 60 std::string getMaker() const;
cannam@198 61 int getPluginVersion() const;
cannam@198 62 std::string getCopyright() const;
cannam@198 63
cannam@198 64 size_t getPreferredStepSize() const;
cannam@198 65 size_t getPreferredBlockSize() const;
cannam@198 66
cannam@198 67 ParameterList getParameterDescriptors() const;
cannam@198 68 float getParameter(std::string id) const;
cannam@198 69 void setParameter(std::string id, float value);
cannam@198 70
cannam@198 71 OutputList getOutputDescriptors() const;
cannam@198 72
cannam@198 73 FeatureSet process(const float *const *inputBuffers,
cannam@198 74 Vamp::RealTime timestamp);
cannam@198 75
cannam@198 76 FeatureSet getRemainingFeatures();
cannam@198 77
cannam@198 78 protected:
cannam@200 79 class D;
cannam@200 80 D *m_d;
cannam@200 81
cannam@198 82 size_t m_stepSize;
cannam@198 83 size_t m_blockSize;
cannam@198 84
cannam@198 85 float *m_priorMagnitudes;
cannam@198 86
cannam@198 87 size_t m_dfsize;
cannam@198 88 float *m_df;
cannam@200 89 float *m_r;
cannam@200 90 float *m_fr;
cannam@204 91 float *m_t;
cannam@198 92 size_t m_n;
cannam@198 93
cannam@198 94 Vamp::RealTime m_start;
cannam@198 95 Vamp::RealTime m_lasttime;
cannam@198 96
cannam@200 97 void calculate();
cannam@200 98 FeatureSet assembleFeatures();
cannam@198 99 float lag2tempo(int);
cannam@207 100 int tempo2lag(float);
cannam@198 101 };
cannam@198 102
cannam@198 103
cannam@198 104 #endif