mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
cont'd work on Lua Vamp-plugin API
This commit is contained in:
parent
ae72acb493
commit
f6b59676b5
3 changed files with 12 additions and 6 deletions
|
|
@ -197,7 +197,7 @@ namespace ARDOUR { namespace LuaAPI {
|
||||||
|
|
||||||
/** initialize the plugin for use with analyze().
|
/** initialize the plugin for use with analyze().
|
||||||
*
|
*
|
||||||
* This is equivalent to plugin():initialise (1, 8192, 8192)
|
* This is equivalent to plugin():initialise (1, 512, 1024)
|
||||||
* and prepares a plugin for analyze.
|
* and prepares a plugin for analyze.
|
||||||
*
|
*
|
||||||
* Manual initialization is only required to set plugin-parameters
|
* Manual initialization is only required to set plugin-parameters
|
||||||
|
|
@ -206,7 +206,7 @@ namespace ARDOUR { namespace LuaAPI {
|
||||||
* @code
|
* @code
|
||||||
* vamp:reset ()
|
* vamp:reset ()
|
||||||
* vamp:initialize ()
|
* vamp:initialize ()
|
||||||
* vamp:plugin():setParameter (0, 1.5)
|
* vamp:plugin():setParameter (0, 1.5, nil)
|
||||||
* vamp:analyze (r, 0)
|
* vamp:analyze (r, 0)
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
|
|
@ -218,6 +218,7 @@ namespace ARDOUR { namespace LuaAPI {
|
||||||
::Vamp::Plugin* _plugin;
|
::Vamp::Plugin* _plugin;
|
||||||
float _sample_rate;
|
float _sample_rate;
|
||||||
framecnt_t _bufsize;
|
framecnt_t _bufsize;
|
||||||
|
framecnt_t _stepsize;
|
||||||
bool _initialized;
|
bool _initialized;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -543,7 +543,8 @@ void LuaTableRef::assign (luabridge::LuaRef* rv, T key, const LuaTableEntry& s)
|
||||||
LuaAPI::Vamp::Vamp (const std::string& key, float sample_rate)
|
LuaAPI::Vamp::Vamp (const std::string& key, float sample_rate)
|
||||||
: _plugin (0)
|
: _plugin (0)
|
||||||
, _sample_rate (sample_rate)
|
, _sample_rate (sample_rate)
|
||||||
, _bufsize (8192)
|
, _bufsize (1024)
|
||||||
|
, _stepsize (512)
|
||||||
, _initialized (false)
|
, _initialized (false)
|
||||||
{
|
{
|
||||||
using namespace ::Vamp::HostExt;
|
using namespace ::Vamp::HostExt;
|
||||||
|
|
@ -577,7 +578,7 @@ LuaAPI::Vamp::initialize ()
|
||||||
if (!_plugin || _plugin->getMinChannelCount() > 1) {
|
if (!_plugin || _plugin->getMinChannelCount() > 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!_plugin->initialise (1, _bufsize, _bufsize)) {
|
if (!_plugin->initialise (1, _stepsize, _bufsize)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
|
|
@ -615,10 +616,10 @@ LuaAPI::Vamp::analyze (boost::shared_ptr<ARDOUR::Readable> r, uint32_t channel,
|
||||||
features = _plugin->process (bufs, ::Vamp::RealTime::fromSeconds ((double) pos / _sample_rate));
|
features = _plugin->process (bufs, ::Vamp::RealTime::fromSeconds ((double) pos / _sample_rate));
|
||||||
|
|
||||||
if (cb.type () == LUA_TFUNCTION) {
|
if (cb.type () == LUA_TFUNCTION) {
|
||||||
cb (features, pos);
|
cb (&features, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos += to_read;
|
pos += std::min (_stepsize, to_read);
|
||||||
|
|
||||||
if (pos >= len) {
|
if (pos >= len) {
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -446,9 +446,13 @@ LuaBindings::common (lua_State* L)
|
||||||
|
|
||||||
.beginClass<Vamp::RealTime> ("RealTime")
|
.beginClass<Vamp::RealTime> ("RealTime")
|
||||||
.addConstructor <void (*) (int, int)> ()
|
.addConstructor <void (*) (int, int)> ()
|
||||||
|
.addData ("sec", &Vamp::RealTime::sec, false)
|
||||||
|
.addData ("nsec", &Vamp::RealTime::nsec, false)
|
||||||
.addFunction ("usec", &Vamp::RealTime::usec)
|
.addFunction ("usec", &Vamp::RealTime::usec)
|
||||||
.addFunction ("msec", &Vamp::RealTime::msec)
|
.addFunction ("msec", &Vamp::RealTime::msec)
|
||||||
.addFunction ("toString", &Vamp::RealTime::toString)
|
.addFunction ("toString", &Vamp::RealTime::toString)
|
||||||
|
.addStaticFunction ("realTime2Frame", &Vamp::RealTime::realTime2Frame)
|
||||||
|
.addStaticFunction ("frame2RealTime", &Vamp::RealTime::frame2RealTime)
|
||||||
.endClass ()
|
.endClass ()
|
||||||
|
|
||||||
.beginClass<Vamp::PluginBase> ("PluginBase")
|
.beginClass<Vamp::PluginBase> ("PluginBase")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue