summaryrefslogtreecommitdiffstats
path: root/src/analyzer/vamp/vampanalyzer.h
blob: 09f1bcb72ddf2b2d25d6f3f345ac21a067df865c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * vampanalyzer.h
 *  Created on: 14/mar/2011
 *      Author: Vittorio Colao
 *      Original ideas taken from Audacity VampEffect class from Chris Cannam.
 */

#ifndef ANALYZER_VAMP_VAMPANALYZER_H
#define ANALYZER_VAMP_VAMPANALYZER_H

#include <QString>
#include <QList>
#include <QVector>
#include <vamp-hostsdk/vamp-hostsdk.h>

#include "analyzer/vamp/vamppluginloader.h"
#include "configobject.h"
#include "util/sample.h"

class VampAnalyzer {
  public:
    VampAnalyzer();
    virtual ~VampAnalyzer();

    bool Init(const QString pluginlibrary, const QString pluginid,
              const int samplerate, const int TotalSamples, bool bFastAnalysis);
    bool Process(const CSAMPLE *pIn, const int iLen);
    bool End();
    bool SetParameter(const QString parameter, const double value);

    QVector<double> GetInitFramesVector();
    QVector<double> GetEndFramesVector();
    QVector<QString> GetLabelsVector();
    QVector<double> GetFirstValuesVector();
    QVector<double> GetLastValuesVector();

    // Initialize the VAMP_PATH environment variable to point to the default
    // places that Mixxx VAMP plugins are deployed on installation. If a
    // VAMP_PATH environment variable is already set by the user, then this
    // method appends to that.
    static void initializePluginPaths();
    void SelectOutput(const int outputnumber);

  private:
    Vamp::HostExt::PluginLoader::PluginKey m_key;
    int m_iSampleCount, m_iOUT, m_iRemainingSamples,
        m_iBlockSize, m_iStepSize, m_rate, m_iOutput;
    CSAMPLE ** m_pluginbuf;
    Vamp::Plugin *m_plugin;
    Vamp::Plugin::ParameterList mParameters;
    Vamp::Plugin::FeatureList m_Results;

    bool m_bDoNotAnalyseMoreSamples;
    bool m_FastAnalysisEnabled;
    int m_iMaxSamplesToAnalyse;
};

#endif /* ANALYZER_VAMP_VAMPANALYZER_H */