diff options
Diffstat (limited to 'src/engine/BufferFactory.cpp')
-rw-r--r-- | src/engine/BufferFactory.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/engine/BufferFactory.cpp b/src/engine/BufferFactory.cpp index aff44254..8a5617fa 100644 --- a/src/engine/BufferFactory.cpp +++ b/src/engine/BufferFactory.cpp @@ -45,7 +45,7 @@ struct BufferDeleter { }; -SharedPtr<Buffer> +BufferFactory::Ref BufferFactory::get(Shared::PortType type, size_t size, bool force_create) { Raul::AtomicPtr<Buffer>& head_ptr = free_list(type); @@ -66,16 +66,16 @@ BufferFactory::get(Shared::PortType type, size_t size, bool force_create) return create(type, size); } else { cerr << "ERROR: Failed to obtain buffer" << endl; - return SharedPtr<Buffer>(); + return Ref(); } } try_head->_next = NULL; - return SharedPtr<Buffer>(try_head, BufferDeleter(*this)); + return Ref(try_head); } -SharedPtr<Buffer> +BufferFactory::Ref BufferFactory::create(Shared::PortType type, size_t size) { assert(ThreadManager::current_thread_id() != THREAD_PROCESS); @@ -85,7 +85,7 @@ BufferFactory::create(Shared::PortType type, size_t size) if (type.is_control()) { if (size == 0) size = sizeof(LV2_Object) + sizeof(float); - AudioBuffer* ret = new AudioBuffer(type, size); + AudioBuffer* ret = new AudioBuffer(*this, type, size); ret->object()->type = _map->object_class_vector; ((LV2_Vector_Body*)ret->object()->body)->elem_type = _map->object_class_float32; buffer = ret; @@ -93,23 +93,23 @@ BufferFactory::create(Shared::PortType type, size_t size) if (size == 0) size = sizeof(LV2_Object) + sizeof(LV2_Vector_Body) + _engine.audio_driver()->buffer_size() * sizeof(float); - AudioBuffer* ret = new AudioBuffer(type, size); + AudioBuffer* ret = new AudioBuffer(*this, type, size); ret->object()->type = _map->object_class_float32; buffer = ret; } else if (type.is_events()) { if (size == 0) size = _engine.audio_driver()->buffer_size() * 4; // FIXME - buffer = new EventBuffer(size); + buffer = new EventBuffer(*this, size); } else if (type.is_value() || type.is_message()) { if (size == 0) size = 32; // FIXME - buffer = new ObjectBuffer(std::max(size, sizeof(LV2_Object) + sizeof(void*))); + buffer = new ObjectBuffer(*this, std::max(size, sizeof(LV2_Object) + sizeof(void*))); } else { cout << "ERROR: Failed to create buffer of unknown type" << endl; - return SharedPtr<Buffer>(); + return Ref(); } - return SharedPtr<Buffer>(buffer, BufferDeleter(*this)); + return Ref(buffer); } void |