22 #include <vamp-hostsdk/PluginLoader.h>
24 #include <glibmm/miscutils.h>
25 #include <glibmm/fileutils.h>
26 #include <glib/gstdio.h>
63 using namespace Vamp::HostExt;
65 PluginLoader* loader (PluginLoader::getInstance());
67 plugin = loader->loadPlugin (key, sr, PluginLoader::ADAPT_ALL_SAFE);
81 if (
plugin->getMinChannelCount() > 1) {
106 Plugin::FeatureSet features;
112 float* bufs[1] = { 0 };
122 ofile.open (tmp_path.c_str());
139 if (src->
read (data, pos, to_read, channel) != to_read) {
145 if (to_read != bufsize) {
146 memset (data + to_read, 0, (bufsize - to_read) *
sizeof (
Sample));
149 features =
plugin->process (bufs, RealTime::fromSeconds ((
double) pos /
sample_rate));
151 if (
use_features (features, (path.empty() ? 0 : &ofile))) {
164 features =
plugin->getRemainingFeatures ();
166 if (
use_features (features, (path.empty() ? &ofile : 0))) {
177 g_remove (tmp_path.c_str());
178 }
else if (!path.empty()) {
180 g_rename (tmp_path.c_str(), path.c_str());
virtual int use_features(Vamp::Plugin::FeatureSet &, std::ostream *)=0
int initialize_plugin(AnalysisPluginKey name, float sample_rate)
int analyse(const std::string &path, Readable *, uint32_t channel)
LIBPBD_API Transmitter error
std::ostream & endmsg(std::ostream &ostr)
virtual framecnt_t read(Sample *, framepos_t pos, framecnt_t cnt, int channel) const =0
AnalysisPluginKey plugin_key
virtual framecnt_t readable_length() const =0
std::string AnalysisPluginKey
std::string string_compose(const std::string &fmt, const T1 &o1)