summaryrefslogtreecommitdiff
path: root/NT/src/vampHost.h
diff options
context:
space:
mode:
Diffstat (limited to 'NT/src/vampHost.h')
-rw-r--r--NT/src/vampHost.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/NT/src/vampHost.h b/NT/src/vampHost.h
new file mode 100644
index 0000000..a8b0bbb
--- /dev/null
+++ b/NT/src/vampHost.h
@@ -0,0 +1,95 @@
+#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 "libavwrapper.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);
+ double get_progress();
+ vector<float> beats;
+ private:
+ double 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> &params);
+ void process_frame(uint8_t *data,int samples_in_frame);
+ void cleanup();
+ double get_value(const double &time);
+ //map<double,int> features;
+ map<double,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;
+ double 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<double>& out);
+ void rotorGetFeatures(int frame, int sr, int output,Plugin::FeatureSet features, vector<double>& out, double& progress);
+
+}