bool initialized () const { return _initialized; }
+ /** process given array of audio-samples.
+ *
+ * This is a lua-binding for vamp:plugin():process ()
+ *
+ * @d audio-data, the vector must match the configured channel count
+ * and hold a complete buffer for every channel as set during
+ * plugin():initialise()
+ * @rt timestamp matching the provided buffer.
+ * @returns features extracted from that data (if the plugin is causal)
+ */
+ ::Vamp::Plugin::FeatureSet process (const std::vector<float*>& d, ::Vamp::RealTime rt);
+
private:
::Vamp::Plugin* _plugin;
float _sample_rate;
delete [] data;
return rv;
}
+
+::Vamp::Plugin::FeatureSet
+LuaAPI::Vamp::process (const std::vector<float*>& d, ::Vamp::RealTime rt)
+{
+ if (!_plugin || d.size() == 0) {
+ return ::Vamp::Plugin::FeatureSet ();
+ }
+ const float* const* bufs = &d[0];
+ return _plugin->process (bufs, rt);
+}
// register float array (int32_t*)
.registerArray <int32_t> ("IntArray")
+ // std::vector<float*>
+ .beginStdVector <float*> ("FloatArrayVector")
+ .endClass ()
+
// TODO std::set
.endNamespace ();
}
.endNamespace () // Vamp::PluginBase
.deriveClass<Vamp::Plugin, Vamp::PluginBase> ("Plugin")
- // TODO add wrapper std::vector<FloatArray>
- .addFunction ("process", &Vamp::Plugin::process) // XXX unusable due to float * const *
+ //.addFunction ("process", &Vamp::Plugin::process) // unusable due to float*const* -> LuaAPI::Vamp::process
.addFunction ("getRemainingFeatures", &Vamp::Plugin::getRemainingFeatures)
.endClass ()
.addFunction ("analyze", &ARDOUR::LuaAPI::Vamp::analyze)
.addFunction ("reset", &ARDOUR::LuaAPI::Vamp::reset)
.addFunction ("initialize", &ARDOUR::LuaAPI::Vamp::initialize)
+ .addFunction ("process", &ARDOUR::LuaAPI::Vamp::process)
.endClass ()
.endNamespace () // end LuaAPI