To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / OfaVampPlugin.h @ 4:370af5759bce
History | View | Annotate | Download (2.93 KB)
| 1 |
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
|---|---|
| 2 |
|
| 3 |
/*
|
| 4 |
Vamp feature extraction plugin using MusicIP OFA library.
|
| 5 |
|
| 6 |
See README for more information and licensing terms.
|
| 7 |
*/
|
| 8 |
|
| 9 |
#ifndef _OFA_VAMP_PLUGIN_H_
|
| 10 |
#define _OFA_VAMP_PLUGIN_H_
|
| 11 |
|
| 12 |
#include <vamp-sdk/Plugin.h> |
| 13 |
|
| 14 |
class OfaVampPlugin : public Vamp::Plugin |
| 15 |
{
|
| 16 |
public:
|
| 17 |
enum Type { TypeFingerprint, TypePUID, TypeBoth };
|
| 18 |
OfaVampPlugin(float inputSampleRate, Type type);
|
| 19 |
virtual ~OfaVampPlugin(); |
| 20 |
|
| 21 |
bool initialise(size_t channels, size_t stepSize, size_t blockSize);
|
| 22 |
void reset();
|
| 23 |
|
| 24 |
InputDomain getInputDomain() const { return TimeDomain; } |
| 25 |
|
| 26 |
size_t getPreferredStepSize() const;
|
| 27 |
size_t getPreferredBlockSize() const;
|
| 28 |
|
| 29 |
size_t getMinChannelCount() const { return 1; } |
| 30 |
size_t getMaxChannelCount() const { return 2; } |
| 31 |
|
| 32 |
std::string getMaker() const;
|
| 33 |
int getPluginVersion() const; |
| 34 |
std::string getCopyright() const;
|
| 35 |
|
| 36 |
ParameterList getParameterDescriptors() const;
|
| 37 |
float getParameter(std::string) const; |
| 38 |
void setParameter(std::string, float); |
| 39 |
|
| 40 |
OutputList getOutputDescriptors() const;
|
| 41 |
|
| 42 |
FeatureSet process(const float *const *inputBuffers, |
| 43 |
Vamp::RealTime timestamp); |
| 44 |
|
| 45 |
FeatureSet getRemainingFeatures(); |
| 46 |
|
| 47 |
protected:
|
| 48 |
Type m_type; |
| 49 |
mutable int m_fingerprintResultIndex;
|
| 50 |
mutable int m_puidResultIndex;
|
| 51 |
int16_t *m_buffer; |
| 52 |
size_t m_bufsiz; |
| 53 |
size_t m_bufidx; |
| 54 |
size_t m_channels; |
| 55 |
size_t m_blockSize; |
| 56 |
size_t m_totalCount; |
| 57 |
std::string m_print; |
| 58 |
bool m_enough;
|
| 59 |
}; |
| 60 |
|
| 61 |
class OfaFingerprintPlugin : public OfaVampPlugin |
| 62 |
{
|
| 63 |
public:
|
| 64 |
OfaFingerprintPlugin(float inputSampleRate) :
|
| 65 |
OfaVampPlugin(inputSampleRate, TypeFingerprint) { }
|
| 66 |
|
| 67 |
std::string getName() const {
|
| 68 |
return "MusicIP Audio Fingerprinter"; |
| 69 |
} |
| 70 |
|
| 71 |
std::string getDescription() const {
|
| 72 |
return "Calculates an audio fingerprint using the MusicIP OFA fingerprinting library"; |
| 73 |
} |
| 74 |
|
| 75 |
std::string getIdentifier() const {
|
| 76 |
return "ofa_fingerprint"; |
| 77 |
} |
| 78 |
}; |
| 79 |
|
| 80 |
class OfaPUIDPlugin : public OfaVampPlugin |
| 81 |
{
|
| 82 |
public:
|
| 83 |
OfaPUIDPlugin(float inputSampleRate) :
|
| 84 |
OfaVampPlugin(inputSampleRate, TypePUID) { }
|
| 85 |
|
| 86 |
std::string getName() const {
|
| 87 |
return "MusicIP PUID Lookup"; |
| 88 |
} |
| 89 |
|
| 90 |
std::string getDescription() const {
|
| 91 |
return "Calculates an audio fingerprint using the MusicIP OFA fingerprinting library and uses it to look up a MusicDNS PUID"; |
| 92 |
} |
| 93 |
|
| 94 |
std::string getIdentifier() const {
|
| 95 |
return "ofa_puid"; |
| 96 |
} |
| 97 |
}; |
| 98 |
|
| 99 |
class OfaBothPlugin : public OfaVampPlugin |
| 100 |
{
|
| 101 |
public:
|
| 102 |
OfaBothPlugin(float inputSampleRate) :
|
| 103 |
OfaVampPlugin(inputSampleRate, TypeBoth) { }
|
| 104 |
|
| 105 |
std::string getName() const {
|
| 106 |
return "MusicIP Fingerprinter and PUID"; |
| 107 |
} |
| 108 |
|
| 109 |
std::string getDescription() const {
|
| 110 |
return "Calculates an audio fingerprint and PUID using the MusicIP OFA library"; |
| 111 |
} |
| 112 |
|
| 113 |
std::string getIdentifier() const {
|
| 114 |
return "ofa_both"; |
| 115 |
} |
| 116 |
}; |
| 117 |
|
| 118 |
|
| 119 |
#endif
|