summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine/HTTPEngineReceiver.cpp2
-rw-r--r--src/engine/LV2Node.cpp13
-rw-r--r--src/engine/NodeBase.cpp1
-rw-r--r--src/engine/NodeFactory.cpp35
-rw-r--r--src/engine/OSCClientSender.hpp2
-rw-r--r--src/engine/OSCEngineReceiver.cpp3
-rw-r--r--src/engine/PatchImpl.cpp1
-rw-r--r--src/engine/PortImpl.cpp2
-rw-r--r--src/engine/PortImpl.hpp5
-rw-r--r--src/engine/events/SetMetadata.cpp2
-rw-r--r--src/engine/internals/Controller.cpp2
-rw-r--r--src/engine/internals/Controller.hpp3
-rw-r--r--src/engine/internals/Note.cpp2
-rw-r--r--src/engine/internals/Note.hpp3
-rw-r--r--src/engine/internals/Trigger.cpp2
-rw-r--r--src/engine/internals/Trigger.hpp3
-rw-r--r--src/shared/OSCSender.cpp10
17 files changed, 60 insertions, 31 deletions
diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp
index dbda1ddd..0c9efcf2 100644
--- a/src/engine/HTTPEngineReceiver.cpp
+++ b/src/engine/HTTPEngineReceiver.cpp
@@ -69,7 +69,7 @@ HTTPEngineReceiver::~HTTPEngineReceiver()
_receive_thread->stop();
delete _receive_thread;
- if (_server != NULL) {
+ if (_server) {
soup_server_quit(_server);
_server = NULL;
}
diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp
index 2e176abe..cdc29b15 100644
--- a/src/engine/LV2Node.cpp
+++ b/src/engine/LV2Node.cpp
@@ -183,6 +183,7 @@ LV2Node::instantiate(BufferFactory& bufs)
Path port_path;
PortImpl* port = NULL;
+ bool ret = true;
float* min_values = new float[num_ports];
float* max_values = new float[num_ports];
@@ -271,7 +272,8 @@ LV2Node::instantiate(BufferFactory& bufs)
_ports = NULL;
delete _instances;
_instances = NULL;
- return false;
+ ret = false;
+ goto done;
}
if (val.type() == Atom::NIL)
@@ -325,9 +327,16 @@ LV2Node::instantiate(BufferFactory& bufs)
_ports->at(j) = port;
}
+done:
+ delete[] min_values;
+ delete[] max_values;
delete[] def_values;
+ slv2_value_free(context_pred);
+ slv2_value_free(default_pred);
+ slv2_value_free(min_size_pred);
+ slv2_value_free(port_property_pred);
- return true;
+ return ret;
}
diff --git a/src/engine/NodeBase.cpp b/src/engine/NodeBase.cpp
index 5874c93f..0effd248 100644
--- a/src/engine/NodeBase.cpp
+++ b/src/engine/NodeBase.cpp
@@ -62,6 +62,7 @@ NodeBase::~NodeBase()
delete _providers;
delete _dependants;
+ delete _ports;
free(_valid_ports);
}
diff --git a/src/engine/NodeFactory.cpp b/src/engine/NodeFactory.cpp
index 335feb26..28920d3c 100644
--- a/src/engine/NodeFactory.cpp
+++ b/src/engine/NodeFactory.cpp
@@ -137,26 +137,14 @@ NodeFactory::load_plugins()
void
NodeFactory::load_internal_plugins()
{
- // FIXME: This is a touch gross...
-
- const SampleRate r = 48000;
- const size_t s = sizeof(Sample);
-
- Engine& engine = *_world->local_engine;
- PatchImpl* parent = new PatchImpl(engine, "dummy", 1, NULL, r, s, 1);
-
- NodeImpl* n = NULL;
- n = new NoteNode(*engine.buffer_factory(), "foo", 1, parent, r, s);
- _plugins.insert(make_pair(n->plugin_impl()->uri(), n->plugin_impl()));
- delete n;
- n = new TriggerNode(*engine.buffer_factory(), "foo", 1, parent, r, s);
- _plugins.insert(make_pair(n->plugin_impl()->uri(), n->plugin_impl()));
- delete n;
- n = new ControllerNode(*engine.buffer_factory(), "foo", 1, parent, r, s);
- _plugins.insert(make_pair(n->plugin_impl()->uri(), n->plugin_impl()));
- delete n;
-
- delete parent;
+ InternalPlugin& note_plug = NoteNode::internal_plugin();
+ _plugins.insert(make_pair(note_plug.uri(), &note_plug));
+
+ InternalPlugin& trigger_plug = TriggerNode::internal_plugin();
+ _plugins.insert(make_pair(trigger_plug.uri(), &trigger_plug));
+
+ InternalPlugin& controller_plug = ControllerNode::internal_plugin();
+ _plugins.insert(make_pair(controller_plug.uri(), &controller_plug));
}
@@ -238,8 +226,13 @@ NodeFactory::load_ladspa_plugins()
continue;
Glib::Module* plugin_library = new Glib::Module(lib_path, Glib::MODULE_BIND_LOCAL);
- if (!plugin_library || !(*plugin_library))
+ if (!plugin_library)
+ continue;
+
+ if (!(*plugin_library)) {
+ delete plugin_library;
continue;
+ }
bool found = plugin_library->get_symbol("ladspa_descriptor", df.dp);
if (!found || !df.dp) {
diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp
index 2ca4aad3..f8e3023b 100644
--- a/src/engine/OSCClientSender.hpp
+++ b/src/engine/OSCClientSender.hpp
@@ -57,7 +57,7 @@ public:
void transfer_begin() { OSCSender::transfer_begin(); }
void transfer_end() { OSCSender::transfer_end(); }
- Raul::URI uri() const { return lo_address_get_url(_address); }
+ Raul::URI uri() const { return _url; }
/* *** ClientInterface Implementation Below *** */
diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp
index 5b939992..c186dbcd 100644
--- a/src/engine/OSCEngineReceiver.cpp
+++ b/src/engine/OSCEngineReceiver.cpp
@@ -222,6 +222,8 @@ OSCEngineReceiver::set_response_address_cb(const char* path, const char* types,
me->disable_responses();
}
+ free(url);
+
// If this returns 0 no OSC commands will work
return 1;
}
@@ -686,6 +688,7 @@ OSCEngineReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv
error_msg.append(path).append(" ").append(types);
OSCClientSender(url).error(error_msg);
+ free(url);
return 0;
}
diff --git a/src/engine/PatchImpl.cpp b/src/engine/PatchImpl.cpp
index a0172679..46d04e8b 100644
--- a/src/engine/PatchImpl.cpp
+++ b/src/engine/PatchImpl.cpp
@@ -54,6 +54,7 @@ PatchImpl::~PatchImpl()
assert(!_activated);
delete _compiled_patch;
+ delete _plugin;
}
diff --git a/src/engine/PortImpl.cpp b/src/engine/PortImpl.cpp
index 22492378..5766e80f 100644
--- a/src/engine/PortImpl.cpp
+++ b/src/engine/PortImpl.cpp
@@ -90,7 +90,7 @@ PortImpl::PortImpl(BufferFactory& bufs,
PortImpl::~PortImpl()
{
for (uint32_t v = 0; v < _poly; ++v)
- _buffers->at(v).reset(NULL); // old boost is missing this
+ _buffers->at(v).reset(NULL); // really old boost is missing this
//_buffers->at(v).reset(); // old boost is missing this
delete _buffers;
diff --git a/src/engine/PortImpl.hpp b/src/engine/PortImpl.hpp
index 06887f4a..ceb556c1 100644
--- a/src/engine/PortImpl.hpp
+++ b/src/engine/PortImpl.hpp
@@ -50,6 +50,8 @@ class BufferFactory;
class PortImpl : public GraphObjectImpl, public Ingen::Shared::Port
{
public:
+ ~PortImpl();
+
/** A port's parent is always a node, so static cast should be safe */
NodeImpl* parent_node() const { return (NodeImpl*)_parent; }
@@ -135,9 +137,6 @@ protected:
// Dynamic polyphony
Raul::Array<BufferFactory::Ref>* _prepared_buffers;
-
- friend class Engine;
- virtual ~PortImpl();
};
diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp
index 9b615a49..db68b1fb 100644
--- a/src/engine/events/SetMetadata.cpp
+++ b/src/engine/events/SetMetadata.cpp
@@ -72,6 +72,8 @@ SetMetadata::~SetMetadata()
{
for (SetEvents::iterator i = _set_events.begin(); i != _set_events.end(); ++i)
delete *i;
+
+ delete _create_event;
}
diff --git a/src/engine/internals/Controller.cpp b/src/engine/internals/Controller.cpp
index 56bc433d..941f7e49 100644
--- a/src/engine/internals/Controller.cpp
+++ b/src/engine/internals/Controller.cpp
@@ -39,6 +39,8 @@ using namespace Shared;
static InternalPlugin controller_plugin(NS_INTERNALS "Controller", "controller");
+InternalPlugin& ControllerNode::internal_plugin() { return controller_plugin; }
+
ControllerNode::ControllerNode(BufferFactory& bufs,
const string& path,
bool polyphonic,
diff --git a/src/engine/internals/Controller.hpp b/src/engine/internals/Controller.hpp
index 35824f52..9482916e 100644
--- a/src/engine/internals/Controller.hpp
+++ b/src/engine/internals/Controller.hpp
@@ -25,6 +25,7 @@ namespace Ingen {
class InputPort;
class OutputPort;
+class InternalPlugin;
namespace Internals {
@@ -47,6 +48,8 @@ public:
void learn() { _learning = true; }
+ static InternalPlugin& internal_plugin();
+
private:
bool _learning;
diff --git a/src/engine/internals/Note.cpp b/src/engine/internals/Note.cpp
index 10d7eeaf..61b7946f 100644
--- a/src/engine/internals/Note.cpp
+++ b/src/engine/internals/Note.cpp
@@ -45,6 +45,8 @@ using namespace Shared;
static InternalPlugin note_plugin(NS_INTERNALS "Note", "note");
+InternalPlugin& NoteNode::internal_plugin() { return note_plugin; }
+
NoteNode::NoteNode(BufferFactory& bufs, const string& path, bool polyphonic, PatchImpl* parent, SampleRate srate, size_t buffer_size)
: NodeBase(&note_plugin, path, polyphonic, parent, srate, buffer_size)
, _voices(new Raul::Array<Voice>(_polyphony))
diff --git a/src/engine/internals/Note.hpp b/src/engine/internals/Note.hpp
index 45bb084f..11fc1344 100644
--- a/src/engine/internals/Note.hpp
+++ b/src/engine/internals/Note.hpp
@@ -26,6 +26,7 @@ namespace Ingen {
class InputPort;
class OutputPort;
+class InternalPlugin;
namespace Internals {
@@ -54,6 +55,8 @@ public:
void sustain_on(ProcessContext& context, FrameTime time);
void sustain_off(ProcessContext& context, FrameTime time);
+ static InternalPlugin& internal_plugin();
+
private:
/** Key, one for each key on the keyboard */
struct Key {
diff --git a/src/engine/internals/Trigger.cpp b/src/engine/internals/Trigger.cpp
index a92ab605..f6474af2 100644
--- a/src/engine/internals/Trigger.cpp
+++ b/src/engine/internals/Trigger.cpp
@@ -41,6 +41,8 @@ using namespace Shared;
static InternalPlugin trigger_plugin(NS_INTERNALS "Trigger", "trigger");
+InternalPlugin& TriggerNode::internal_plugin() { return trigger_plugin; }
+
TriggerNode::TriggerNode(BufferFactory& bufs, const string& path, bool polyphonic, PatchImpl* parent, SampleRate srate, size_t buffer_size)
: NodeBase(&trigger_plugin, path, false, parent, srate, buffer_size)
, _learning(false)
diff --git a/src/engine/internals/Trigger.hpp b/src/engine/internals/Trigger.hpp
index dcc69b92..12e5c140 100644
--- a/src/engine/internals/Trigger.hpp
+++ b/src/engine/internals/Trigger.hpp
@@ -25,6 +25,7 @@ namespace Ingen {
class InputPort;
class OutputPort;
+class InternalPlugin;
namespace Internals {
@@ -51,6 +52,8 @@ public:
void learn() { _learning = true; }
+ static InternalPlugin& internal_plugin();
+
private:
bool _learning;
diff --git a/src/shared/OSCSender.cpp b/src/shared/OSCSender.cpp
index 151a3f40..b675265a 100644
--- a/src/shared/OSCSender.cpp
+++ b/src/shared/OSCSender.cpp
@@ -71,7 +71,7 @@ OSCSender::transfer_end()
{
assert(_transfer);
lo_send_bundle(_address, _transfer);
- lo_bundle_free(_transfer);
+ lo_bundle_free_messages(_transfer);
_transfer = NULL;
_send_state = Immediate;
}
@@ -95,6 +95,8 @@ OSCSender::send(const char *path, const char *types, ...)
if (!ret)
send_message(path, msg);
+ else
+ lo_message_free(msg);
va_end(args);
@@ -109,14 +111,17 @@ OSCSender::send_message(const char* path, lo_message msg)
// Don't want to exceed max UDP packet size (good default value?)
static const size_t MAX_BUNDLE_SIZE = 1024;
- if (!_enabled)
+ if (!_enabled) {
+ lo_message_free(msg);
return;
+ }
if (_transfer) {
if (lo_bundle_length(_transfer) + lo_message_length(msg, path) > MAX_BUNDLE_SIZE) {
if (_send_state == SendingBundle)
warn << "Maximum bundle size reached, bundle split" << endl;
lo_send_bundle(_address, _transfer);
+ lo_bundle_free_messages(_transfer);
lo_timetag t;
lo_timetag_now(&t);
_transfer = lo_bundle_new(t);
@@ -125,6 +130,7 @@ OSCSender::send_message(const char* path, lo_message msg)
} else {
lo_send_message(_address, path, msg);
+ lo_message_free(msg);
}
}