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