mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
Vamp::Plugins::process Lua bindings
This commit is contained in:
parent
0d2ccdd39c
commit
a51daedbe6
3 changed files with 28 additions and 2 deletions
|
|
@ -214,6 +214,18 @@ namespace ARDOUR { namespace LuaAPI {
|
||||||
|
|
||||||
bool initialized () const { return _initialized; }
|
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:
|
private:
|
||||||
::Vamp::Plugin* _plugin;
|
::Vamp::Plugin* _plugin;
|
||||||
float _sample_rate;
|
float _sample_rate;
|
||||||
|
|
|
||||||
|
|
@ -629,3 +629,13 @@ LuaAPI::Vamp::analyze (boost::shared_ptr<ARDOUR::Readable> r, uint32_t channel,
|
||||||
delete [] data;
|
delete [] data;
|
||||||
return rv;
|
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);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,10 @@ LuaBindings::stddef (lua_State* L)
|
||||||
// register float array (int32_t*)
|
// register float array (int32_t*)
|
||||||
.registerArray <int32_t> ("IntArray")
|
.registerArray <int32_t> ("IntArray")
|
||||||
|
|
||||||
|
// std::vector<float*>
|
||||||
|
.beginStdVector <float*> ("FloatArrayVector")
|
||||||
|
.endClass ()
|
||||||
|
|
||||||
// TODO std::set
|
// TODO std::set
|
||||||
.endNamespace ();
|
.endNamespace ();
|
||||||
}
|
}
|
||||||
|
|
@ -502,8 +506,7 @@ LuaBindings::common (lua_State* L)
|
||||||
.endNamespace () // Vamp::PluginBase
|
.endNamespace () // Vamp::PluginBase
|
||||||
|
|
||||||
.deriveClass<Vamp::Plugin, Vamp::PluginBase> ("Plugin")
|
.deriveClass<Vamp::Plugin, Vamp::PluginBase> ("Plugin")
|
||||||
// TODO add wrapper std::vector<FloatArray>
|
//.addFunction ("process", &Vamp::Plugin::process) // unusable due to float*const* -> LuaAPI::Vamp::process
|
||||||
.addFunction ("process", &Vamp::Plugin::process) // XXX unusable due to float * const *
|
|
||||||
.addFunction ("getRemainingFeatures", &Vamp::Plugin::getRemainingFeatures)
|
.addFunction ("getRemainingFeatures", &Vamp::Plugin::getRemainingFeatures)
|
||||||
.endClass ()
|
.endClass ()
|
||||||
|
|
||||||
|
|
@ -1609,6 +1612,7 @@ LuaBindings::common (lua_State* L)
|
||||||
.addFunction ("analyze", &ARDOUR::LuaAPI::Vamp::analyze)
|
.addFunction ("analyze", &ARDOUR::LuaAPI::Vamp::analyze)
|
||||||
.addFunction ("reset", &ARDOUR::LuaAPI::Vamp::reset)
|
.addFunction ("reset", &ARDOUR::LuaAPI::Vamp::reset)
|
||||||
.addFunction ("initialize", &ARDOUR::LuaAPI::Vamp::initialize)
|
.addFunction ("initialize", &ARDOUR::LuaAPI::Vamp::initialize)
|
||||||
|
.addFunction ("process", &ARDOUR::LuaAPI::Vamp::process)
|
||||||
.endClass ()
|
.endClass ()
|
||||||
|
|
||||||
.endNamespace () // end LuaAPI
|
.endNamespace () // end LuaAPI
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue