annotate examples/PowerSpectrum.h @ 482:95b7404af6ce

Might as well add these, since pretty much everyone seems to need them for Homebrew-installed libsndfile
author Chris Cannam <cannam@all-day-breakfast.com>
date Thu, 23 Feb 2017 13:51:06 +0000
parents 70e6826adc64
children
rev   line source
cannam@241 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@241 2
cannam@241 3 /*
cannam@241 4 Vamp
cannam@241 5
cannam@241 6 An API for audio analysis and feature extraction plugins.
cannam@241 7
cannam@241 8 Centre for Digital Music, Queen Mary, University of London.
cannam@241 9 Copyright 2006 Chris Cannam.
cannam@241 10
cannam@241 11 Permission is hereby granted, free of charge, to any person
cannam@241 12 obtaining a copy of this software and associated documentation
cannam@241 13 files (the "Software"), to deal in the Software without
cannam@241 14 restriction, including without limitation the rights to use, copy,
cannam@241 15 modify, merge, publish, distribute, sublicense, and/or sell copies
cannam@241 16 of the Software, and to permit persons to whom the Software is
cannam@241 17 furnished to do so, subject to the following conditions:
cannam@241 18
cannam@241 19 The above copyright notice and this permission notice shall be
cannam@241 20 included in all copies or substantial portions of the Software.
cannam@241 21
cannam@241 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
cannam@241 23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
cannam@241 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
cannam@241 25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
cannam@241 26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
cannam@241 27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
cannam@241 28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
cannam@241 29
cannam@241 30 Except as contained in this notice, the names of the Centre for
cannam@241 31 Digital Music; Queen Mary, University of London; and Chris Cannam
cannam@241 32 shall not be used in advertising or otherwise to promote the sale,
cannam@241 33 use or other dealings in this Software without prior written
cannam@241 34 authorization.
cannam@241 35 */
cannam@241 36
cannam@241 37 #ifndef _POWER_SPECTRUM_PLUGIN_H_
cannam@241 38 #define _POWER_SPECTRUM_PLUGIN_H_
cannam@241 39
cannam@241 40 #include "vamp-sdk/Plugin.h"
cannam@241 41
cannam@241 42 /**
cannam@241 43 * Example plugin that returns a power spectrum calculated (trivially)
cannam@241 44 * from the frequency domain representation of each block of audio.
cannam@241 45 * This is one of the simplest possible Vamp plugins, included as an
cannam@241 46 * example of how to return the appropriate value structure for this
cannam@241 47 * sort of visualisation.
cannam@241 48 */
cannam@241 49
cannam@241 50 class PowerSpectrum : public Vamp::Plugin
cannam@241 51 {
cannam@241 52 public:
cannam@241 53 PowerSpectrum(float inputSampleRate);
cannam@241 54 virtual ~PowerSpectrum();
cannam@241 55
cannam@241 56 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
cannam@241 57 void reset();
cannam@241 58
cannam@241 59 InputDomain getInputDomain() const { return FrequencyDomain; }
cannam@241 60
cannam@241 61 std::string getIdentifier() const;
cannam@241 62 std::string getName() const;
cannam@241 63 std::string getDescription() const;
cannam@241 64 std::string getMaker() const;
cannam@241 65 int getPluginVersion() const;
cannam@241 66 std::string getCopyright() const;
cannam@241 67
cannam@241 68 OutputList getOutputDescriptors() const;
cannam@241 69
cannam@241 70 FeatureSet process(const float *const *inputBuffers,
cannam@241 71 Vamp::RealTime timestamp);
cannam@241 72
cannam@241 73 FeatureSet getRemainingFeatures();
cannam@241 74
cannam@241 75 protected:
cannam@241 76 size_t m_blockSize;
cannam@241 77 };
cannam@241 78
cannam@241 79
cannam@241 80 #endif