summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-08-28 03:07:12 +0000
committerDavid Robillard <d@drobilla.net>2015-08-28 03:07:12 +0000
commit3b22d3c8c57867cad7304dac1e9be5ee36ae9715 (patch)
tree3de4bd2f383346164ecbee3a55d17a28d32623df /src/server
parente6f29e606ba73af640469e3ee1e2198893ce3e5c (diff)
downloadingen-3b22d3c8c57867cad7304dac1e9be5ee36ae9715.tar.gz
ingen-3b22d3c8c57867cad7304dac1e9be5ee36ae9715.tar.bz2
ingen-3b22d3c8c57867cad7304dac1e9be5ee36ae9715.zip
Get rid of LV2Info class.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5708 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r--src/server/BlockFactory.cpp18
-rw-r--r--src/server/BlockFactory.hpp2
-rw-r--r--src/server/LV2Block.cpp51
-rw-r--r--src/server/LV2Info.cpp79
-rw-r--r--src/server/LV2Info.hpp62
-rw-r--r--src/server/LV2Plugin.cpp32
-rw-r--r--src/server/LV2Plugin.hpp12
-rw-r--r--src/server/wscript1
8 files changed, 46 insertions, 211 deletions
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp
index 5b00bb76..0a51e03e 100644
--- a/src/server/BlockFactory.cpp
+++ b/src/server/BlockFactory.cpp
@@ -27,9 +27,9 @@
#include "internals/Time.hpp"
#include "internals/Trigger.hpp"
+#include "BlockFactory.hpp"
#include "InternalPlugin.hpp"
#include "LV2Plugin.hpp"
-#include "BlockFactory.hpp"
#include "ThreadManager.hpp"
using namespace std;
@@ -41,7 +41,6 @@ using namespace Internals;
BlockFactory::BlockFactory(Ingen::World* world)
: _world(world)
- , _lv2_info(new LV2Info(world))
, _has_loaded(false)
{
load_internal_plugins();
@@ -107,8 +106,7 @@ BlockFactory::load_plugin(const Raul::URI& uri)
const LilvPlugins* plugs = lilv_world_get_all_plugins(_world->lilv_world());
const LilvPlugin* plug = lilv_plugins_get_by_uri(plugs, node);
if (plug) {
- LV2Plugin* const ingen_plugin = new LV2Plugin(_lv2_info, uri);
- ingen_plugin->lilv_plugin(plug);
+ LV2Plugin* const ingen_plugin = new LV2Plugin(_world, plug);
_plugins.insert(make_pair(uri, ingen_plugin));
}
lilv_node_free(node);
@@ -129,9 +127,6 @@ BlockFactory::load_lv2_plugins()
lilv_node_free));
}
- LilvNode* lv2_connectionOptional = lilv_new_uri(
- _world->lilv_world(), LV2_CORE__connectionOptional);
-
const LilvPlugins* plugins = lilv_world_get_all_plugins(_world->lilv_world());
LILV_FOREACH(plugins, i, plugins) {
const LilvPlugin* lv2_plug = lilv_plugins_get(plugins, i);
@@ -173,7 +168,9 @@ BlockFactory::load_lv2_plugins()
}
}
if (!supported &&
- !lilv_port_has_property(lv2_plug, port, lv2_connectionOptional)) {
+ !lilv_port_has_property(lv2_plug,
+ port,
+ _world->uris().lv2_connectionOptional)) {
_world->log().warn(
fmt("Ignoring <%1%>; unsupported port <%2%>\n")
% uri % lilv_node_as_string(
@@ -186,15 +183,12 @@ BlockFactory::load_lv2_plugins()
}
if (_plugins.find(uri) == _plugins.end()) {
- LV2Plugin* const plugin = new LV2Plugin(_lv2_info, uri);
- plugin->lilv_plugin(lv2_plug);
+ LV2Plugin* const plugin = new LV2Plugin(_world, lv2_plug);
_plugins.insert(make_pair(uri, plugin));
}
}
_world->log().info(fmt("Loaded %1% plugins\n") % _plugins.size());
-
- lilv_node_free(lv2_connectionOptional);
}
} // namespace Server
diff --git a/src/server/BlockFactory.hpp b/src/server/BlockFactory.hpp
index 2acaa09e..776ef948 100644
--- a/src/server/BlockFactory.hpp
+++ b/src/server/BlockFactory.hpp
@@ -28,7 +28,6 @@ namespace Ingen {
namespace Server {
class PluginImpl;
-class LV2Info;
/** Discovers and loads plugin libraries.
*
@@ -53,7 +52,6 @@ private:
Plugins _plugins;
Ingen::World* _world;
- SPtr<LV2Info> _lv2_info;
bool _has_loaded;
};
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index 6b644e5c..14aa42ae 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -80,7 +80,6 @@ LV2Block::make_instance(URIs& uris,
uint32_t voice,
bool preparing)
{
- LilvWorld* lworld = _lv2_plugin->lv2_info()->lv2_world();
const LilvPlugin* lplug = _lv2_plugin->lilv_plugin();
LilvInstance* inst = lilv_plugin_instantiate(
lplug, rate, _features->array());
@@ -92,16 +91,12 @@ LV2Block::make_instance(URIs& uris,
return SPtr<LilvInstance>();
}
- LilvNode* opt_interface = lilv_new_uri(lworld, LV2_OPTIONS__interface);
-
const LV2_Options_Interface* options_iface = NULL;
- if (lilv_plugin_has_extension_data(lplug, opt_interface)) {
+ if (lilv_plugin_has_extension_data(lplug, uris.opt_interface)) {
options_iface = (const LV2_Options_Interface*)
lilv_instance_get_extension_data(inst, LV2_OPTIONS__interface);
}
- lilv_node_free(opt_interface);
-
for (uint32_t p = 0; p < num_ports(); ++p) {
PortImpl* const port = _ports->at(p);
Buffer* const buffer = (preparing)
@@ -222,7 +217,7 @@ bool
LV2Block::instantiate(BufferFactory& bufs)
{
const Ingen::URIs& uris = bufs.uris();
- SPtr<LV2Info> info = _lv2_plugin->lv2_info();
+ Ingen::World* world = bufs.engine().world();
const LilvPlugin* plug = _lv2_plugin->lilv_plugin();
Ingen::Forge& forge = bufs.forge();
const uint32_t num_ports = lilv_plugin_get_num_ports(plug);
@@ -255,14 +250,14 @@ LV2Block::instantiate(BufferFactory& bufs)
LV2_URID buffer_type = 0;
bool is_morph = false;
bool is_auto_morph = false;
- if (lilv_port_is_a(plug, id, info->lv2_ControlPort)) {
- if (lilv_port_is_a(plug, id, info->morph_MorphPort)) {
+ if (lilv_port_is_a(plug, id, uris.lv2_ControlPort)) {
+ if (lilv_port_is_a(plug, id, uris.morph_MorphPort)) {
is_morph = true;
LilvNodes* types = lilv_port_get_value(
- plug, id, info->morph_supportsType);
+ plug, id, uris.morph_supportsType);
LILV_FOREACH(nodes, i, types) {
const LilvNode* type = lilv_nodes_get(types, i);
- if (lilv_node_equals(type, info->lv2_CVPort)) {
+ if (lilv_node_equals(type, uris.lv2_CVPort)) {
port_type = PortType::CV;
buffer_type = uris.atom_Sound;
}
@@ -273,24 +268,24 @@ LV2Block::instantiate(BufferFactory& bufs)
port_type = PortType::CONTROL;
buffer_type = uris.atom_Float;
}
- } else if (lilv_port_is_a(plug, id, info->lv2_CVPort)) {
+ } else if (lilv_port_is_a(plug, id, uris.lv2_CVPort)) {
port_type = PortType::CV;
buffer_type = uris.atom_Sound;
- } else if (lilv_port_is_a(plug, id, info->lv2_AudioPort)) {
+ } else if (lilv_port_is_a(plug, id, uris.lv2_AudioPort)) {
port_type = PortType::AUDIO;
buffer_type = uris.atom_Sound;
- } else if (lilv_port_is_a(plug, id, info->atom_AtomPort)) {
+ } else if (lilv_port_is_a(plug, id, uris.atom_AtomPort)) {
port_type = PortType::ATOM;
}
- if (lilv_port_is_a(plug, id, info->morph_AutoMorphPort)) {
+ if (lilv_port_is_a(plug, id, uris.morph_AutoMorphPort)) {
is_auto_morph = true;
}
// Get buffer type if necessary (atom ports)
if (!buffer_type) {
LilvNodes* types = lilv_port_get_value(
- plug, id, info->atom_bufferType);
+ plug, id, uris.atom_bufferType);
LILV_FOREACH(nodes, i, types) {
const LilvNode* type = lilv_nodes_get(types, i);
if (lilv_node_is_uri(type)) {
@@ -315,7 +310,7 @@ LV2Block::instantiate(BufferFactory& bufs)
if (port_type == PortType::ATOM) {
// Get default value, and its length
- LilvNodes* defaults = lilv_port_get_value(plug, id, info->lv2_default);
+ LilvNodes* defaults = lilv_port_get_value(plug, id, uris.lv2_default);
LILV_FOREACH(nodes, i, defaults) {
const LilvNode* d = lilv_nodes_get(defaults, i);
if (lilv_node_is_string(d)) {
@@ -336,7 +331,7 @@ LV2Block::instantiate(BufferFactory& bufs)
}
// Get minimum size, if set in data
- LilvNodes* sizes = lilv_port_get_value(plug, id, info->rsz_minimumSize);
+ LilvNodes* sizes = lilv_port_get_value(plug, id, uris.rsz_minimumSize);
LILV_FOREACH(nodes, i, sizes) {
const LilvNode* d = lilv_nodes_get(sizes, i);
if (lilv_node_is_int(d)) {
@@ -350,9 +345,9 @@ LV2Block::instantiate(BufferFactory& bufs)
}
enum { UNKNOWN, INPUT, OUTPUT } direction = UNKNOWN;
- if (lilv_port_is_a(plug, id, info->lv2_InputPort)) {
+ if (lilv_port_is_a(plug, id, uris.lv2_InputPort)) {
direction = INPUT;
- } else if (lilv_port_is_a(plug, id, info->lv2_OutputPort)) {
+ } else if (lilv_port_is_a(plug, id, uris.lv2_OutputPort)) {
direction = OUTPUT;
}
@@ -391,9 +386,9 @@ LV2Block::instantiate(BufferFactory& bufs)
}
// Inherit certain properties from plugin port
- const LilvNode* preds[] = { info->lv2_designation,
- info->lv2_portProperty,
- info->atom_supports,
+ const LilvNode* preds[] = { uris.lv2_designation,
+ uris.lv2_portProperty,
+ uris.atom_supports,
0 };
for (int p = 0; preds[p]; ++p) {
LilvNodes* values = lilv_port_get_value(plug, id, preds[p]);
@@ -424,7 +419,7 @@ LV2Block::instantiate(BufferFactory& bufs)
return ret;
}
- _features = info->world().lv2_features().lv2_features(&info->world(), this);
+ _features = world->lv2_features().lv2_features(world, this);
// Actually create plugin instances and port buffers.
const SampleRate rate = bufs.engine().driver()->sample_rate();
@@ -437,7 +432,7 @@ LV2Block::instantiate(BufferFactory& bufs)
}
// FIXME: Polyphony + worker?
- if (lilv_plugin_has_feature(plug, info->work_schedule)) {
+ if (lilv_plugin_has_feature(plug, uris.work_schedule)) {
_worker_iface = (const LV2_Worker_Interface*)
lilv_instance_get_extension_data(instance(0),
LV2_WORKER__interface);
@@ -557,8 +552,8 @@ LV2Block::post_process(ProcessContext& context)
LilvState*
LV2Block::load_preset(const Raul::URI& uri)
{
- World* world = &_lv2_plugin->lv2_info()->world();
- LilvWorld* lworld = _lv2_plugin->lv2_info()->lv2_world();
+ World* world = _lv2_plugin->world();
+ LilvWorld* lworld = world->lilv_world();
LilvNode* preset = lilv_new_uri(lworld, uri.c_str());
// Load preset into world if necessary
@@ -603,7 +598,7 @@ LV2Block::save_preset(const Raul::URI& uri,
const Properties& props)
{
World* world = parent_graph()->engine().world();
- LilvWorld* lworld = _lv2_plugin->lv2_info()->lv2_world();
+ LilvWorld* lworld = _lv2_plugin->world()->lilv_world();
LV2_URID_Map* lmap = &world->uri_map().urid_map_feature()->urid_map;
LV2_URID_Unmap* lunmap = &world->uri_map().urid_unmap_feature()->urid_unmap;
diff --git a/src/server/LV2Info.cpp b/src/server/LV2Info.cpp
deleted file mode 100644
index 3c7a4df9..00000000
--- a/src/server/LV2Info.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#define __STDC_LIMIT_MACROS 1
-
-#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
-#include "lv2/lv2plug.in/ns/ext/morph/morph.h"
-#include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h"
-#include "lv2/lv2plug.in/ns/ext/worker/worker.h"
-
-#include "ingen/World.hpp"
-#include "ingen/LV2Features.hpp"
-
-#include "LV2Info.hpp"
-#include "LV2ResizeFeature.hpp"
-
-namespace Ingen {
-namespace Server {
-
-LV2Info::LV2Info(Ingen::World* world)
- : atom_AtomPort(lilv_new_uri(world->lilv_world(), LV2_ATOM__AtomPort))
- , atom_bufferType(lilv_new_uri(world->lilv_world(), LV2_ATOM__bufferType))
- , atom_supports(lilv_new_uri(world->lilv_world(), LV2_ATOM__supports))
- , lv2_AudioPort(lilv_new_uri(world->lilv_world(), LV2_CORE__AudioPort))
- , lv2_CVPort(lilv_new_uri(world->lilv_world(), LV2_CORE__CVPort))
- , lv2_ControlPort(lilv_new_uri(world->lilv_world(), LV2_CORE__ControlPort))
- , lv2_InputPort(lilv_new_uri(world->lilv_world(), LV2_CORE__InputPort))
- , lv2_OutputPort(lilv_new_uri(world->lilv_world(), LV2_CORE__OutputPort))
- , lv2_default(lilv_new_uri(world->lilv_world(), LV2_CORE__default))
- , lv2_designation(lilv_new_uri(world->lilv_world(), LV2_CORE__designation))
- , lv2_portProperty(lilv_new_uri(world->lilv_world(), LV2_CORE__portProperty))
- , lv2_sampleRate(lilv_new_uri(world->lilv_world(), LV2_CORE__sampleRate))
- , morph_AutoMorphPort(lilv_new_uri(world->lilv_world(), LV2_MORPH__AutoMorphPort))
- , morph_MorphPort(lilv_new_uri(world->lilv_world(), LV2_MORPH__MorphPort))
- , morph_supportsType(lilv_new_uri(world->lilv_world(), LV2_MORPH__supportsType))
- , rsz_minimumSize(lilv_new_uri(world->lilv_world(), LV2_RESIZE_PORT__minimumSize))
- , work_schedule(lilv_new_uri(world->lilv_world(), LV2_WORKER__schedule))
- , _world(world)
-{
- world->lv2_features().add_feature(
- SPtr<LV2Features::Feature>(new ResizeFeature()));
-}
-
-LV2Info::~LV2Info()
-{
- lilv_node_free(atom_AtomPort);
- lilv_node_free(atom_bufferType);
- lilv_node_free(atom_supports);
- lilv_node_free(lv2_AudioPort);
- lilv_node_free(lv2_CVPort);
- lilv_node_free(lv2_ControlPort);
- lilv_node_free(lv2_InputPort);
- lilv_node_free(lv2_OutputPort);
- lilv_node_free(lv2_default);
- lilv_node_free(lv2_designation);
- lilv_node_free(lv2_portProperty);
- lilv_node_free(lv2_sampleRate);
- lilv_node_free(morph_AutoMorphPort);
- lilv_node_free(morph_MorphPort);
- lilv_node_free(morph_supportsType);
- lilv_node_free(rsz_minimumSize);
- lilv_node_free(work_schedule);
-}
-
-} // namespace Server
-} // namespace Ingen
diff --git a/src/server/LV2Info.hpp b/src/server/LV2Info.hpp
deleted file mode 100644
index e95c3964..00000000
--- a/src/server/LV2Info.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_ENGINE_LV2INFO_HPP
-#define INGEN_ENGINE_LV2INFO_HPP
-
-#include "ingen/World.hpp"
-#include "lilv/lilv.h"
-#include "raul/Noncopyable.hpp"
-
-namespace Ingen {
-namespace Server {
-
-/** Stuff that may need to be passed to an LV2 plugin (i.e. LV2 features).
- */
-class LV2Info : public Raul::Noncopyable {
-public:
- explicit LV2Info(Ingen::World* world);
- ~LV2Info();
-
- LilvNode* const atom_AtomPort;
- LilvNode* const atom_bufferType;
- LilvNode* const atom_supports;
- LilvNode* const lv2_AudioPort;
- LilvNode* const lv2_CVPort;
- LilvNode* const lv2_ControlPort;
- LilvNode* const lv2_InputPort;
- LilvNode* const lv2_OutputPort;
- LilvNode* const lv2_default;
- LilvNode* const lv2_designation;
- LilvNode* const lv2_portProperty;
- LilvNode* const lv2_sampleRate;
- LilvNode* const morph_AutoMorphPort;
- LilvNode* const morph_MorphPort;
- LilvNode* const morph_supportsType;
- LilvNode* const rsz_minimumSize;
- LilvNode* const work_schedule;
-
- Ingen::World& world() { return *_world; }
- LilvWorld* lv2_world() { return _world->lilv_world(); }
-
-private:
- Ingen::World* _world;
-};
-
-} // namespace Server
-} // namespace Ingen
-
-#endif // INGEN_ENGINE_LV2INFO_HPP
diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp
index 3b7c9b18..3dc87030 100644
--- a/src/server/LV2Plugin.cpp
+++ b/src/server/LV2Plugin.cpp
@@ -30,12 +30,12 @@ using namespace std;
namespace Ingen {
namespace Server {
-LV2Plugin::LV2Plugin(SPtr<LV2Info> lv2_info, const Raul::URI& uri)
- : PluginImpl(lv2_info->world().uris(),
- lv2_info->world().uris().lv2_Plugin.urid,
- uri)
- , _lilv_plugin(NULL)
- , _lv2_info(lv2_info)
+LV2Plugin::LV2Plugin(World* world, const LilvPlugin* lplugin)
+ : PluginImpl(world->uris(),
+ world->uris().lv2_Plugin.urid,
+ Raul::URI(lilv_node_as_uri(lilv_plugin_get_uri(lplugin))))
+ , _world(world)
+ , _lilv_plugin(lplugin)
{
set_property(_uris.rdf_type, _uris.lv2_Plugin);
}
@@ -79,18 +79,11 @@ LV2Plugin::instantiate(BufferFactory& bufs,
}
void
-LV2Plugin::lilv_plugin(const LilvPlugin* p)
-{
- _lilv_plugin = p;
-}
-
-void
LV2Plugin::load_presets()
{
- LilvWorld* lworld = _lv2_info->world().lilv_world();
- LilvNode* pset_Preset = lilv_new_uri(lworld, LV2_PRESETS__Preset);
- LilvNode* rdfs_label = lilv_new_uri(lworld, LILV_NS_RDFS "label");
- LilvNodes* presets = lilv_plugin_get_related(_lilv_plugin, pset_Preset);
+ const URIs& uris = _world->uris();
+ LilvWorld* lworld = _world->lilv_world();
+ LilvNodes* presets = lilv_plugin_get_related(_lilv_plugin, uris.pset_Preset);
if (presets) {
LILV_FOREACH(nodes, i, presets) {
@@ -98,7 +91,7 @@ LV2Plugin::load_presets()
lilv_world_load_resource(lworld, preset);
LilvNodes* labels = lilv_world_find_nodes(
- lworld, preset, rdfs_label, NULL);
+ lworld, preset, uris.rdfs_label, NULL);
if (labels) {
const LilvNode* label = lilv_nodes_get_first(labels);
@@ -107,7 +100,7 @@ LV2Plugin::load_presets()
lilv_nodes_free(labels);
} else {
- _lv2_info->world().log().error(
+ _world->log().error(
fmt("Preset <%1%> has no rdfs:label\n")
% lilv_node_as_string(lilv_nodes_get(presets, i)));
}
@@ -116,9 +109,6 @@ LV2Plugin::load_presets()
lilv_nodes_free(presets);
}
- lilv_node_free(rdfs_label);
- lilv_node_free(pset_Preset);
-
PluginImpl::load_presets();
}
diff --git a/src/server/LV2Plugin.hpp b/src/server/LV2Plugin.hpp
index 63946071..0eee6731 100644
--- a/src/server/LV2Plugin.hpp
+++ b/src/server/LV2Plugin.hpp
@@ -24,9 +24,11 @@
#include "raul/URI.hpp"
#include "PluginImpl.hpp"
-#include "LV2Info.hpp"
namespace Ingen {
+
+class World;
+
namespace Server {
class GraphImpl;
@@ -37,7 +39,7 @@ class BlockImpl;
class LV2Plugin : public PluginImpl
{
public:
- LV2Plugin(SPtr<LV2Info> lv2_info, const Raul::URI& uri);
+ LV2Plugin(World* world, const LilvPlugin* lplugin);
BlockImpl* instantiate(BufferFactory& bufs,
const Raul::Symbol& symbol,
@@ -47,16 +49,14 @@ public:
const Raul::Symbol symbol() const;
- SPtr<LV2Info> lv2_info() const { return _lv2_info; }
-
+ World* world() const { return _world; }
const LilvPlugin* lilv_plugin() const { return _lilv_plugin; }
- void lilv_plugin(const LilvPlugin* p);
void load_presets();
private:
+ World* _world;
const LilvPlugin* _lilv_plugin;
- SPtr<LV2Info> _lv2_info;
};
} // namespace Server
diff --git a/src/server/wscript b/src/server/wscript
index 16bca160..c3e963fa 100644
--- a/src/server/wscript
+++ b/src/server/wscript
@@ -18,7 +18,6 @@ def build(bld):
InputPort.cpp
InternalPlugin.cpp
LV2Block.cpp
- LV2Info.cpp
LV2Plugin.cpp
NodeImpl.cpp
OutputPort.cpp