*/
-#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
#include <vector>
using namespace ARDOUR;
using namespace PBD;
-LadspaPlugin::LadspaPlugin (void *mod, AudioEngine& e, Session& session, uint32_t index, nframes_t rate)
+LadspaPlugin::LadspaPlugin (void *mod, AudioEngine& e, Session& session, uint32_t index, framecnt_t rate)
: Plugin (e, session)
{
init (mod, index, rate);
}
void
-LadspaPlugin::init (void *mod, uint32_t index, nframes_t rate)
+LadspaPlugin::init (void *mod, uint32_t index, framecnt_t rate)
{
LADSPA_Descriptor_Function dfunc;
uint32_t i, port_cnt;
deactivate ();
cleanup ();
- GoingAway (); /* EMIT SIGNAL */
-
/* XXX who should close a plugin? */
// dlclose (module);
sr_scaling = true;
}
- /* FIXME: add support for logarithmic defaults */
-
else if (LADSPA_IS_HINT_DEFAULT_LOW(prh[port].HintDescriptor)) {
if (LADSPA_IS_HINT_LOGARITHMIC(prh[port].HintDescriptor)) {
ret = exp(log(prh[port].LowerBound) * 0.75f + log(prh[port].UpperBound) * 0.25f);
return Plugin::save_preset (name, "ladspa");
}
+void
+LadspaPlugin::remove_preset (string name)
+{
+ return Plugin::remove_preset (name, "ladspa");
+}
+
int
-LadspaPlugin::set_state(const XMLNode& node)
+LadspaPlugin::set_state (const XMLNode& node, int version)
{
+ if (version < 3000) {
+ return set_state_2X (node, version);
+ }
+
XMLNodeList nodes;
XMLProperty *prop;
XMLNodeConstIterator iter;
return 0;
}
+int
+LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */)
+{
+ XMLNodeList nodes;
+ XMLProperty *prop;
+ XMLNodeConstIterator iter;
+ XMLNode *child;
+ const char *port;
+ const char *data;
+ uint32_t port_id;
+ LocaleGuard lg (X_("POSIX"));
+
+ if (node.name() != state_node_name()) {
+ error << _("Bad node sent to LadspaPlugin::set_state") << endmsg;
+ return -1;
+ }
+
+ nodes = node.children ("port");
+
+ for(iter = nodes.begin(); iter != nodes.end(); ++iter){
+
+ child = *iter;
+
+ if ((prop = child->property("number")) != 0) {
+ port = prop->value().c_str();
+ } else {
+ warning << _("LADSPA: no ladspa port number") << endmsg;
+ continue;
+ }
+ if ((prop = child->property("value")) != 0) {
+ data = prop->value().c_str();
+ } else {
+ warning << _("LADSPA: no ladspa port data") << endmsg;
+ continue;
+ }
+
+ sscanf (port, "%" PRIu32, &port_id);
+ set_parameter (port_id, atof(data));
+ }
+
+ latency_compute_run ();
+
+ return 0;
+}
+
int
LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc) const
{
}
}
-ARDOUR::nframes_t
+ARDOUR::framecnt_t
LadspaPlugin::signal_latency () const
{
if (_user_latency) {
}
if (_latency_control_port) {
- return (nframes_t) floor (*_latency_control_port);
+ return (framecnt_t) floor (*_latency_control_port);
} else {
return 0;
}
int
LadspaPlugin::connect_and_run (BufferSet& bufs,
ChanMapping in_map, ChanMapping out_map,
- nframes_t nframes, nframes_t offset)
+ pframes_t nframes, framecnt_t offset)
{
cycles_t now;
cycles_t then = get_cycles ();
}
void
-LadspaPlugin::run_in_place (nframes_t nframes)
+LadspaPlugin::run_in_place (pframes_t nframes)
{
for (uint32_t i = 0; i < parameter_count(); ++i) {
if (LADSPA_IS_PORT_INPUT(port_descriptor (i)) && LADSPA_IS_PORT_CONTROL(port_descriptor (i))) {
_control_data[i] = _shadow_data[i];
}
}
+
+ assert (_was_activated);
+
_descriptor->run (_handle, nframes);
}
uint32_t port_index = 0;
uint32_t in_index = 0;
uint32_t out_index = 0;
- const nframes_t bufsize = 1024;
+ const framecnt_t bufsize = 1024;
LADSPA_Data buffer[bufsize];
memset(buffer,0,sizeof(LADSPA_Data)*bufsize);
if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) {
error << string_compose(_("LADSPA: cannot load module from \"%1\""), path) << endmsg;
error << dlerror() << endmsg;
+ return PluginPtr ((Plugin*) 0);
} else {
plugin.reset (new LadspaPlugin (module, session.engine(), session, index, session.frame_rate()));
}
return PluginPtr ((Plugin*) 0);
}
}
+
+LadspaPluginInfo::LadspaPluginInfo()
+{
+ type = ARDOUR::LADSPA;
+}