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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#include <vamp-hostsdk/PluginHostAdapter.h>
#include <vamp-hostsdk/PluginInputDomainAdapter.h>
#include <vamp-hostsdk/PluginLoader.h>
#include "Poco/Mutex.h"
#include <iostream>
#include <fstream>
#include <set>
#include <sndfile.h>
#include <cstring>
#include <cstdlib>
#include "system.h"
#include <cmath>
/*
line 366: is returnValue the fail/succeed return value?
*/
using namespace std;
using Vamp::Plugin;
using Vamp::PluginHostAdapter;
using Vamp::RealTime;
using Vamp::HostExt::PluginLoader;
using Vamp::HostExt::PluginWrapper;
using Vamp::HostExt::PluginInputDomainAdapter;
#define HOST_VERSION "1.5"
namespace vampHost {
struct feature{
feature():number(0){};
int number;
vector<float> values;
};
class Settings{
public:
Settings(string _so="",string _filter="",string _input="") {
soname=_so;
filtername=_filter;
inputFile=_input;
}
string soname;
string filtername;
string inputFile;
};
class QMAnalyser{
public:
int process(const string soundfile);
float get_progress();
vector<float> beats;
private:
float progress;
Poco::Mutex mutex; //lock for progress data
};
class Analyser{
//can load any vamp analysis plugin and present its data with a unified interface
public:
bool init(const string &soname,const string &id,const int &_channels,const int &_bits,const int &_samples,const int &_rate,int outputNo,const map<string,float> ¶ms);
void process_frame(uint8_t *data,int samples_in_frame);
void cleanup();
//map<double,int> features;
map<float,feature> features;
//map<time,featureNo>
//this is the best way to store features: because map allows to search for the key below and above the present time
private:
PluginLoader *loader;
PluginLoader::PluginKey key;
Plugin *plugin;
RealTime rt;
int channels,bits,samples,rate;
int bytes,stride;
float scale;
int blockSize,stepSize,overlapSize,finalStepsRemaining,currentStep,outputNo;
int in_block,blocks_processed;
string output;
float **plugbuf;
int featureNo;
};
string getQMBeats(const string soundfile);
void printFeatures(int, int, int, Plugin::FeatureSet, ostream &, bool frames);
void getTimestamps(int output,Plugin::FeatureSet features, vector<float>& out);
int runPlugin(string myname, string soname, string id, string output,int outputNo, string inputFile, ostream& out, bool frames);
int rotorRunPlugin(string soname, string id, string output,int outputNo, string inputFile, vector<float>& out, float& progress);
void rotorGetFeatures(int frame, int sr, int output,Plugin::FeatureSet features, vector<float>& out, float& progress);
}
|