|
Constant-Q Library
|
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 /* 00003 Constant-Q library 00004 Copyright (c) 2013-2014 Queen Mary, University of London 00005 00006 Permission is hereby granted, free of charge, to any person 00007 obtaining a copy of this software and associated documentation 00008 files (the "Software"), to deal in the Software without 00009 restriction, including without limitation the rights to use, copy, 00010 modify, merge, publish, distribute, sublicense, and/or sell copies 00011 of the Software, and to permit persons to whom the Software is 00012 furnished to do so, subject to the following conditions: 00013 00014 The above copyright notice and this permission notice shall be 00015 included in all copies or substantial portions of the Software. 00016 00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00018 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00019 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00020 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00021 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 00022 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00023 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00024 00025 Except as contained in this notice, the names of the Centre for 00026 Digital Music; Queen Mary, University of London; and Chris Cannam 00027 shall not be used in advertising or otherwise to promote the sale, 00028 use or other dealings in this Software without prior written 00029 authorization. 00030 */ 00031 00032 #ifndef CQVAMP_H 00033 #define CQVAMP_H 00034 00035 #include <vamp-sdk/Plugin.h> 00036 00037 #include "cq/CQSpectrogram.h" 00038 00039 class ConstantQ; 00040 00041 class CQVamp : public Vamp::Plugin 00042 { 00043 public: 00044 CQVamp(float inputSampleRate, bool midiPitchParameters); 00045 virtual ~CQVamp(); 00046 00047 bool initialise(size_t channels, size_t stepSize, size_t blockSize); 00048 void reset(); 00049 00050 InputDomain getInputDomain() const { return TimeDomain; } 00051 00052 std::string getIdentifier() const; 00053 std::string getName() const; 00054 std::string getDescription() const; 00055 std::string getMaker() const; 00056 int getPluginVersion() const; 00057 std::string getCopyright() const; 00058 00059 ParameterList getParameterDescriptors() const; 00060 float getParameter(std::string) const; 00061 void setParameter(std::string, float); 00062 00063 size_t getPreferredStepSize() const; 00064 size_t getPreferredBlockSize() const; 00065 00066 OutputList getOutputDescriptors() const; 00067 00068 FeatureSet process(const float *const *inputBuffers, 00069 Vamp::RealTime timestamp); 00070 00071 FeatureSet getRemainingFeatures(); 00072 00073 protected: 00074 bool m_midiPitchParameters; 00075 int m_minMIDIPitch; 00076 int m_maxMIDIPitch; 00077 float m_tuningFrequency; 00078 int m_bpo; 00079 CQSpectrogram::Interpolation m_interpolation; 00080 00081 CQSpectrogram *m_cq; 00082 float m_maxFrequency; 00083 float m_minFrequency; 00084 int m_stepSize; 00085 int m_blockSize; 00086 00087 Vamp::RealTime m_startTime; 00088 bool m_haveStartTime; 00089 int m_columnCount; 00090 00091 std::string noteName(int i) const; 00092 00093 std::vector<float> m_prevFeature; 00094 FeatureSet convertToFeatures(const std::vector<std::vector<double> > &); 00095 }; 00096 00097 00098 #endif
1.7.6.1