diff options
author | David Robillard <d@drobilla.net> | 2010-03-06 10:23:19 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-03-06 10:23:19 +0000 |
commit | 059f20c9666234f2be01498ee04f1e7ee795ba8f (patch) | |
tree | ef0d53073d53012aeaa7d084fccf477b166c0684 /src/engine/BufferFactory.cpp | |
parent | 085a451dfec54126be1b9346899c81d82e6eb58e (diff) | |
download | ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.tar.gz ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.tar.bz2 ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.zip |
Save Ingen patches as working standard LV2 plugin bundles.
This allows you to create an Ingen patch in Ingen running as a Jack client,
save it, then load that patch as an LV2 plugin in any LV2 compliant host.
Eliminate (hopefully) all static data in the engine (for multiple instantiations in a single process).
More API/ABI stable interface for Ingen::Shared::World.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2533 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/BufferFactory.cpp')
-rw-r--r-- | src/engine/BufferFactory.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/engine/BufferFactory.cpp b/src/engine/BufferFactory.cpp index 83030c70..318a1422 100644 --- a/src/engine/BufferFactory.cpp +++ b/src/engine/BufferFactory.cpp @@ -32,11 +32,31 @@ namespace Ingen { using namespace Shared; -BufferFactory::BufferFactory(Engine& engine, SharedPtr<Shared::LV2URIMap> map) +BufferFactory::BufferFactory(Engine& engine, SharedPtr<Shared::LV2URIMap> a_uris) : _engine(engine) - , _map(map) + , _uris(a_uris) , _silent_buffer(NULL) { + assert(_uris); +} + + +BufferFactory::~BufferFactory() +{ + free_list(_free_audio.get()); + free_list(_free_control.get()); + free_list(_free_event.get()); + free_list(_free_object.get()); +} + + +void +BufferFactory::free_list(Buffer* head) +{ + Buffer* next = head->_next; + delete head; + if (next) + free_list(next); } @@ -87,7 +107,7 @@ BufferFactory::get(Shared::PortType type, size_t size, bool force_create) } if (!try_head) { - if (ThreadManager::current_thread_id() != THREAD_PROCESS) { + if (!ThreadManager::thread_is(THREAD_PROCESS)) { return create(type, size); } else { assert(false); @@ -113,12 +133,12 @@ BufferFactory::create(Shared::PortType type, size_t size) if (type.is_control()) { AudioBuffer* ret = new AudioBuffer(*this, type, size); - ret->object()->type = _map->object_class_vector.id; - ((LV2_Vector_Body*)ret->object()->body)->elem_type = _map->object_class_float32.id; + ret->object()->type = _uris->object_class_vector.id; + ((LV2_Vector_Body*)ret->object()->body)->elem_type = _uris->object_class_float32.id; buffer = ret; } else if (type.is_audio()) { AudioBuffer* ret = new AudioBuffer(*this, type, size); - ret->object()->type = _map->object_class_float32.id; + ret->object()->type = _uris->object_class_float32.id; buffer = ret; } else if (type.is_events()) { buffer = new EventBuffer(*this, size); |