Revision 2:8056c637875b OfaVampPlugin.h

View differences:

OfaVampPlugin.h
1 1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2 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

  
3 16
#ifndef _OFA_VAMP_PLUGIN_H_
4 17
#define _OFA_VAMP_PLUGIN_H_
5 18

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

  
8
#include <pthread.h>
9

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

  
16 28
    bool initialise(size_t channels, size_t stepSize, size_t blockSize);
......
24 36
    size_t getMinChannelCount() const { return 1; }
25 37
    size_t getMaxChannelCount() const { return 2; }
26 38

  
27
    std::string getIdentifier() const;
28
    std::string getName() const;
29
    std::string getDescription() const;
30 39
    std::string getMaker() const;
31 40
    int getPluginVersion() const;
32 41
    std::string getCopyright() const;
......
43 52
    FeatureSet getRemainingFeatures();
44 53

  
45 54
protected:
55
    Type m_type;
56
    mutable int m_fingerprintResultIndex;
57
    mutable int m_puidResultIndex;
46 58
    int16_t *m_buffer;
47 59
    size_t m_bufsiz;
48 60
    size_t m_bufidx;
......
53 65
    bool m_enough;
54 66
};
55 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

  
56 125

  
57 126
#endif

Also available in: Unified diff