To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / OfaVampPlugin.h @ 2:8056c637875b

History | View | Annotate | Download (3.3 KB)

1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2

    
3
/*
4
    Vamp feature extraction plugins using MusicIP OFA library.
5

6
    Centre for Digital Music, Queen Mary, University of London.
7
    This file copyright 2007 QMUL.
8
    
9
    This program is free software; you can redistribute it and/or
10
    modify it under the terms of the GNU General Public License as
11
    published by the Free Software Foundation; either version 2 of the
12
    License, or (at your option) any later version.  See the file
13
    COPYING included with this distribution for more information.
14
*/
15

    
16
#ifndef _OFA_VAMP_PLUGIN_H_
17
#define _OFA_VAMP_PLUGIN_H_
18

    
19
#include <vamp-sdk/Plugin.h>
20

    
21
class OfaVampPlugin : public Vamp::Plugin
22
{
23
public:
24
    enum Type { TypeFingerprint, TypePUID, TypeBoth };
25
    OfaVampPlugin(float inputSampleRate, Type type);
26
    virtual ~OfaVampPlugin();
27

    
28
    bool initialise(size_t channels, size_t stepSize, size_t blockSize);
29
    void reset();
30

    
31
    InputDomain getInputDomain() const { return TimeDomain; }
32

    
33
    size_t getPreferredStepSize() const;
34
    size_t getPreferredBlockSize() const;
35

    
36
    size_t getMinChannelCount() const { return 1; }
37
    size_t getMaxChannelCount() const { return 2; }
38

    
39
    std::string getMaker() const;
40
    int getPluginVersion() const;
41
    std::string getCopyright() const;
42

    
43
    ParameterList getParameterDescriptors() const;
44
    float getParameter(std::string) const;
45
    void setParameter(std::string, float);
46

    
47
    OutputList getOutputDescriptors() const;
48

    
49
    FeatureSet process(const float *const *inputBuffers,
50
                       Vamp::RealTime timestamp);
51

    
52
    FeatureSet getRemainingFeatures();
53

    
54
protected:
55
    Type m_type;
56
    mutable int m_fingerprintResultIndex;
57
    mutable int m_puidResultIndex;
58
    int16_t *m_buffer;
59
    size_t m_bufsiz;
60
    size_t m_bufidx;
61
    size_t m_channels;
62
    size_t m_blockSize;
63
    size_t m_totalCount;
64
    std::string m_print;
65
    bool m_enough;
66
};
67

    
68
class OfaFingerprintPlugin : public OfaVampPlugin
69
{
70
public:
71
    OfaFingerprintPlugin(float inputSampleRate) :
72
        OfaVampPlugin(inputSampleRate, TypeFingerprint) { }
73

    
74
    std::string getName() const { 
75
        return "MusicIP Audio Fingerprinter";
76
    }
77

    
78
    std::string getDescription() const { 
79
        return "Calculates an audio fingerprint using the MusicIP OFA fingerprinting library";
80
    }
81

    
82
    std::string getIdentifier() const {
83
        return "ofa_fingerprint";
84
    }
85
};
86

    
87
class OfaPUIDPlugin : public OfaVampPlugin
88
{
89
public:
90
    OfaPUIDPlugin(float inputSampleRate) :
91
        OfaVampPlugin(inputSampleRate, TypePUID) { }
92

    
93
    std::string getName() const { 
94
        return "MusicIP PUID Lookup";
95
    }
96

    
97
    std::string getDescription() const { 
98
        return "Calculates an audio fingerprint using the MusicIP OFA fingerprinting library and uses it to look up a MusicDNS PUID";
99
    }
100

    
101
    std::string getIdentifier() const {
102
        return "ofa_puid";
103
    }
104
};
105

    
106
class OfaBothPlugin : public OfaVampPlugin
107
{
108
public:
109
    OfaBothPlugin(float inputSampleRate) :
110
        OfaVampPlugin(inputSampleRate, TypeBoth) { }
111

    
112
    std::string getName() const { 
113
        return "MusicIP Fingerprinter and PUID";
114
    }
115

    
116
    std::string getDescription() const { 
117
        return "Calculates an audio fingerprint and PUID using the MusicIP OFA library";
118
    }
119

    
120
    std::string getIdentifier() const {
121
        return "ofa_both";
122
    }
123
};
124

    
125

    
126
#endif