summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-04 20:59:01 +0000
committerDavid Robillard <d@drobilla.net>2010-01-04 20:59:01 +0000
commitbfca1f3a2739c1c0148b0641d3bdb8f4ea16b431 (patch)
tree39ca3cffc0e404fe33fac66663444d9e1a603b96 /src/engine
parent29b77e922d7fd883795b04eadd528eca21a37a2f (diff)
downloadingen-bfca1f3a2739c1c0148b0641d3bdb8f4ea16b431.tar.gz
ingen-bfca1f3a2739c1c0148b0641d3bdb8f4ea16b431.tar.bz2
ingen-bfca1f3a2739c1c0148b0641d3bdb8f4ea16b431.zip
Remove redundant LV2EventBuffer class and merge with EventBuffer.
Refactor mixing from an in-place Buffer method (which doesn't work with EventBuffer) to a single function that takes an out of place destination and an array of sources. Fix audio buffer mixing for control<->audio. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2333 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/AudioBuffer.cpp14
-rw-r--r--src/engine/AudioBuffer.hpp2
-rw-r--r--src/engine/Buffer.hpp1
-rw-r--r--src/engine/ConnectionImpl.cpp21
-rw-r--r--src/engine/EventBuffer.cpp224
-rw-r--r--src/engine/EventBuffer.hpp79
-rw-r--r--src/engine/InputPort.cpp19
-rw-r--r--src/engine/LV2EventBuffer.cpp238
-rw-r--r--src/engine/LV2EventBuffer.hpp85
-rw-r--r--src/engine/ObjectBuffer.hpp2
-rw-r--r--src/engine/wscript1
11 files changed, 240 insertions, 446 deletions
diff --git a/src/engine/AudioBuffer.cpp b/src/engine/AudioBuffer.cpp
index 633a004b..b564a3ba 100644
--- a/src/engine/AudioBuffer.cpp
+++ b/src/engine/AudioBuffer.cpp
@@ -185,16 +185,12 @@ AudioBuffer::copy(Context& context, const Buffer* src)
* This function only adds the same range in one buffer to another.
*/
void
-AudioBuffer::mix(Context& context, const Buffer* const src)
+AudioBuffer::accumulate(Context& context, const AudioBuffer* const src)
{
- const AudioBuffer* src_abuf = dynamic_cast<const AudioBuffer*>(src);
- if (!src_abuf)
- return;
-
Sample* const buf = data();
- const Sample* const src_buf = src_abuf->data();
+ const Sample* const src_buf = src->data();
- const size_t frames = std::min(nframes(), src_abuf->nframes());
+ const size_t frames = std::min(nframes(), src->nframes());
assert(frames != 0);
// Mix initial portions
@@ -204,8 +200,8 @@ AudioBuffer::mix(Context& context, const Buffer* const src)
// Extend/Mix the final sample of src if it is shorter
const Sample last = src_buf[i - 1];
- while (i < frames)
- buf[i++] = last;
+ while (i < nframes())
+ buf[i++] += last;
}
diff --git a/src/engine/AudioBuffer.hpp b/src/engine/AudioBuffer.hpp
index f7d036ff..8b0e95a5 100644
--- a/src/engine/AudioBuffer.hpp
+++ b/src/engine/AudioBuffer.hpp
@@ -41,7 +41,7 @@ public:
void set_block(Sample val, size_t start_offset, size_t end_offset);
void copy(const Sample* src, size_t start_sample, size_t end_sample);
void copy(Context& context, const Buffer* src);
- void mix(Context& context, const Buffer* src);
+ void accumulate(Context& context, const AudioBuffer* src);
bool is_control() const { return _type.symbol() == Shared::PortType::CONTROL; }
diff --git a/src/engine/Buffer.hpp b/src/engine/Buffer.hpp
index 94589dac..1fb0a96f 100644
--- a/src/engine/Buffer.hpp
+++ b/src/engine/Buffer.hpp
@@ -51,7 +51,6 @@ public:
virtual void rewind() const {}
virtual void copy(Context& context, const Buffer* src) = 0;
- virtual void mix(Context& context, const Buffer* src) = 0;
virtual void prepare_read(Context& context) {}
virtual void prepare_write(Context& context) {}
diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp
index db71df70..b64875c2 100644
--- a/src/engine/ConnectionImpl.cpp
+++ b/src/engine/ConnectionImpl.cpp
@@ -17,7 +17,6 @@
#include <algorithm>
#include "raul/Maid.hpp"
-#include "util.hpp"
#include "AudioBuffer.hpp"
#include "BufferFactory.hpp"
#include "ConnectionImpl.hpp"
@@ -27,6 +26,8 @@
#include "MessageContext.hpp"
#include "PortImpl.hpp"
#include "ProcessContext.hpp"
+#include "mix.hpp"
+#include "util.hpp"
namespace Ingen {
@@ -52,6 +53,7 @@ ConnectionImpl::ConnectionImpl(BufferFactory& bufs, PortImpl* src_port, PortImpl
if (must_mix() || must_queue())
_local_buffer = bufs.get(dst_port->type(), dst_port->buffer_size());
+
if (must_queue())
_queue = new Raul::RingBuffer<LV2_Object>(src_port->buffer_size() * 2);
@@ -118,18 +120,15 @@ ConnectionImpl::process(Context& context)
_queue->full_peek(sizeof(LV2_Object), &obj);
_queue->full_read(sizeof(LV2_Object) + obj.size, local_buf->object());
}
- return;
- }
-
- if (!must_mix())
- return;
- // Copy the first voice
- _local_buffer->copy(context, src_port()->buffer(0).get());
+ } else if (must_mix()) {
+ const uint32_t num_srcs = src_port()->poly();
+ Buffer* srcs[num_srcs];
+ for (uint32_t v = 0; v < num_srcs; ++v)
+ srcs[v] = src_port()->buffer(v).get();
- // Mix in the rest
- for (uint32_t v = 0; v < src_port()->poly(); ++v)
- _local_buffer->mix(context, src_port()->buffer(v).get());
+ mix(context, _local_buffer.get(), srcs, num_srcs);
+ }
}
diff --git a/src/engine/EventBuffer.cpp b/src/engine/EventBuffer.cpp
index 8d3769a6..24ed4be9 100644
--- a/src/engine/EventBuffer.cpp
+++ b/src/engine/EventBuffer.cpp
@@ -35,11 +35,40 @@ using namespace Shared;
*/
EventBuffer::EventBuffer(size_t capacity)
: Buffer(PortType(PortType::EVENTS), capacity)
- , _buf(new LV2EventBuffer(capacity))
+ , _latest_frames(0)
+ , _latest_subframes(0)
{
+ if (capacity > UINT32_MAX) {
+ cerr << "Event buffer size " << capacity << " too large, aborting." << endl;
+ throw std::bad_alloc();
+ }
+
+#ifdef HAVE_POSIX_MEMALIGN
+ int ret = posix_memalign((void**)&_data, 16, sizeof(LV2_Event_Buffer) + capacity);
+#else
+ _data = (LV2_Event_Buffer*)malloc(sizeof(LV2_Event_Buffer) + capacity);
+ int ret = (_data != NULL) ? 0 : -1;
+#endif
+
+ if (ret != 0) {
+ cerr << "Failed to allocate event buffer. Aborting." << endl;
+ exit(EXIT_FAILURE);
+ }
+
+ _data->header_size = sizeof(LV2_Event_Buffer);
+ _data->data = reinterpret_cast<uint8_t*>(_data + _data->header_size);
+ _data->stamp_type = 0;
+ _data->event_count = 0;
+ _data->capacity = (uint32_t)capacity;
+ _data->size = 0;
+
clear();
+}
- //cerr << "Creating Event Buffer " << _buf << ", capacity = " << _buf->capacity << endl;
+
+EventBuffer::~EventBuffer()
+{
+ free(_data);
}
@@ -61,82 +90,173 @@ void
EventBuffer::copy(Context& context, const Buffer* src_buf)
{
const EventBuffer* src = dynamic_cast<const EventBuffer*>(src_buf);
- assert(src);
- assert(_buf->capacity() >= src->_buf->capacity());
- assert(src != this);
- assert(src->_buf != _buf);
+ if (src->_data == _data)
+ return;
+
+ assert(capacity() >= src->capacity());
+
+ rewind();
+
+ assert(src->_data->header_size == _data->header_size);
+ memcpy(_data, src->_data, _data->header_size + src->_data->size);
- src->rewind();
+ _iter = src->_iter;
+ _iter.buf = _data;
+
+ _latest_frames = src->_latest_frames;
+ _latest_subframes = src->_latest_subframes;
- _buf->copy(*src->_buf);
assert(event_count() == src->event_count());
}
-void
-EventBuffer::mix(Context& context, const Buffer* src)
+/** Increment the read position by one event.
+ *
+ * \return true if increment was successful, or false if end of buffer reached.
+ */
+bool
+EventBuffer::increment() const
+{
+ if (lv2_event_is_valid(&_iter)) {
+ lv2_event_increment(&_iter);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+/** \return true iff the cursor is valid (ie get_event is safe)
+ */
+bool
+EventBuffer::is_valid() const
+{
+ return lv2_event_is_valid(&_iter);
+}
+
+
+/** Read an event from the current position in the buffer
+ *
+ * \return true if read was successful, or false if end of buffer reached
+ */
+bool
+EventBuffer::get_event(uint32_t* frames,
+ uint32_t* subframes,
+ uint16_t* type,
+ uint16_t* size,
+ uint8_t** data) const
+{
+ if (lv2_event_is_valid(&_iter)) {
+ LV2_Event* ev = lv2_event_get(&_iter, data);
+ *frames = ev->frames;
+ *subframes = ev->subframes;
+ *type = ev->type;
+ *size = ev->size;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+/** Get the object currently pointed to, or NULL if invalid.
+ */
+LV2_Object*
+EventBuffer::get_object() const
{
+ if (lv2_event_is_valid(&_iter)) {
+ uint8_t* data;
+ LV2_Event* ev = lv2_event_get(&_iter, &data);
+ return LV2_OBJECT_FROM_EVENT(ev);
+ }
+ return NULL;
+}
+
+
+/** Get the event currently pointed to, or NULL if invalid.
+ */
+LV2_Event*
+EventBuffer::get_event() const
+{
+ if (lv2_event_is_valid(&_iter)) {
+ uint8_t* data;
+ return lv2_event_get(&_iter, &data);
+ }
+ return NULL;
}
-/** Clear, and merge \a a and \a b into this buffer.
+/** Append an event to the buffer.
*
- * FIXME: This is slow.
+ * \a timestamp must be >= the latest event in the buffer.
*
- * \return true if complete merge was successful
+ * \return true on success
*/
bool
-EventBuffer::merge(const EventBuffer& a, const EventBuffer& b)
+EventBuffer::append(uint32_t frames,
+ uint32_t subframes,
+ uint16_t type,
+ uint16_t size,
+ const uint8_t* data)
{
- // Die if a merge isn't necessary as it's expensive
- assert(a.size() > 0 && b.size() > 0);
+#ifndef NDEBUG
+ if (lv2_event_is_valid(&_iter)) {
+ LV2_Event* last_event = lv2_event_get(&_iter, NULL);
+ assert(last_event->frames < frames
+ || (last_event->frames == frames && last_event->subframes <= subframes));
+ }
+#endif
- clear();
+ /*cout << "Appending event type " << type << ", size " << size
+ << " @ " << frames << "." << subframes << endl;*/
+
+ if (!lv2_event_write(&_iter, frames, subframes, type, size, data)) {
+ cerr << "ERROR: Failed to write event." << endl;
+ return false;
+ } else {
+ _latest_frames = frames;
+ _latest_subframes = subframes;
+ return true;
+ }
+}
- a.rewind();
- b.rewind();
+/** Append a buffer of events to the buffer.
+ *
+ * \a timestamp must be >= the latest event in the buffer.
+ *
+ * \return true on success
+ */
+bool
+EventBuffer::append(const EventBuffer* buf)
+{
+ cerr << "FIXME: EventBuffer append" << endl;
#if 0
- uint32_t a_frames;
- uint32_t a_subframes;
- uint16_t a_type;
- uint16_t a_size;
- uint8_t* a_data;
-
- uint32_t b_frames;
- uint32_t b_subframes;
- uint16_t b_type;
- uint16_t b_size;
- uint8_t* b_data;
+ uint8_t** data = NULL;
+ bool ret = true;
+
+ LV2_Event_Iterator iter;
+ for (lv2_event_begin(&iter, _data); lv2_event_is_valid(&iter); lv2_event_increment(&iter)) {
+ LV2_Event* ev = lv2_event_get(&iter, data);
+
+#ifndef NDEBUG
+ assert((ev->frames > _latest_frames)
+ || (ev->frames == _latest_frames
+ && ev->subframes >= _latest_subframes));
#endif
- cout << "FIXME: merge" << endl;
-#if 0
- a.get_event(&a_frames, &a_subframes, &a_type, &a_size, &a_data);
- b.get_event(&b_frames, &b_subframes, &b_type, &b_size, &b_data);
-
- while (true) {
- if (a_data && (!b_data || (a_time < b_time))) {
- append(a_time, a_size, a_data);
- if (a.increment())
- a.get_event(&a_time, &a_size, &a_data);
- else
- a_data = NULL;
- } else if (b_data) {
- append(b_time, b_size, b_data);
- if (b.increment())
- b.get_event(&b_time, &b_size, &b_data);
- else
- b_data = NULL;
- } else {
+ if (!(ret = append(ev->frames, ev->subframes, ev->type, ev->size, *data))) {
+ cerr << "ERROR: Failed to write event." << endl;
break;
}
+
+ _latest_frames = ev->frames;
+ _latest_subframes = ev->subframes;
}
- _latest_stamp = max(a_time, b_time);
+ return ret;
#endif
-
- return true;
+ return false;
}
diff --git a/src/engine/EventBuffer.hpp b/src/engine/EventBuffer.hpp
index e82585d6..c2ba555e 100644
--- a/src/engine/EventBuffer.hpp
+++ b/src/engine/EventBuffer.hpp
@@ -20,9 +20,9 @@
#include "event.lv2/event.h"
#include "event.lv2/event-helpers.h"
+#include "object.lv2/object.h"
#include "interface/PortType.hpp"
#include "Buffer.hpp"
-#include "LV2EventBuffer.hpp"
namespace Ingen {
@@ -30,58 +30,59 @@ namespace Ingen {
class EventBuffer : public Buffer {
public:
EventBuffer(size_t capacity);
+ ~EventBuffer();
- void clear() { _buf->reset(); }
+ void* port_data(Shared::PortType port_type) { return _data; }
+ const void* port_data(Shared::PortType port_type) const { return _data; }
- void* port_data(Shared::PortType port_type) { return _buf; }
- const void* port_data(Shared::PortType port_type) const { return _buf; }
+ inline void rewind() const { lv2_event_begin(&_iter, _data); }
- void rewind() const { _buf->rewind(); }
+ inline void clear() {
+ _latest_frames = 0;
+ _latest_subframes = 0;
+ _data->event_count = 0;
+ _data->size = 0;
+ rewind();
+ }
void prepare_read(Context& context);
void prepare_write(Context& context);
void copy(Context& context, const Buffer* src);
- void mix(Context& contect, const Buffer* src);
- bool merge(const EventBuffer& a, const EventBuffer& b);
-
- bool increment() const { return _buf->increment(); }
- bool is_valid() const { return _buf->is_valid(); }
-
- inline uint32_t latest_frames() const { return _buf->latest_frames(); }
- inline uint32_t latest_subframes() const { return _buf->latest_subframes(); }
- inline uint32_t event_count() const { return _buf->event_count(); }
-
- inline bool get_event(uint32_t* frames,
- uint32_t* subframes,
- uint16_t* type,
- uint16_t* size,
- uint8_t** data) const {
- return _buf->get_event(frames, subframes, type, size, data);
- }
+ //void mix(Context& contect, const Buffer* src);
+ //bool merge(const EventBuffer& a, const EventBuffer& b);
- LV2_Object* get_object() const {
- return _buf->get_object();
- }
+ inline size_t event_count() const { return _data->event_count; }
+ inline uint32_t capacity() const { return _data->capacity; }
+ //inline uint32_t size() const { return _data->size; }
+ inline uint32_t latest_frames() const { return _latest_frames; }
+ inline uint32_t latest_subframes() const { return _latest_subframes; }
- LV2_Event* get_event() const {
- return _buf->get_event();
- }
+ bool increment() const;
+ bool is_valid() const;
- inline bool append(uint32_t frames,
- uint32_t subframes,
- uint16_t type,
- uint16_t size,
- const uint8_t* data) {
- return _buf->append(frames, subframes, type, size, data);
- }
+ bool get_event(uint32_t* frames,
+ uint32_t* subframes,
+ uint16_t* type,
+ uint16_t* size,
+ uint8_t** data) const;
- inline bool append(const LV2_Event_Buffer* buf) {
- return _buf->append(buf);
- }
+ LV2_Object* get_object() const;
+ LV2_Event* get_event() const;
+
+ bool append(uint32_t frames,
+ uint32_t subframes,
+ uint16_t type,
+ uint16_t size,
+ const uint8_t* data);
+
+ bool append(const EventBuffer* buf);
private:
- LV2EventBuffer* _buf; ///< Contents
+ LV2_Event_Buffer* _data; ///< Contents
+ mutable LV2_Event_Iterator _iter; ///< Iterator into _data
+ uint32_t _latest_frames; ///< Latest time of all events (frames)
+ uint32_t _latest_subframes; ///< Latest time of all events (subframes)
};
diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp
index 484e8b53..b980f2e6 100644
--- a/src/engine/InputPort.cpp
+++ b/src/engine/InputPort.cpp
@@ -21,13 +21,14 @@
#include <cassert>
#include "interface/Patch.hpp"
#include "AudioBuffer.hpp"
+#include "BufferFactory.hpp"
#include "ConnectionImpl.hpp"
#include "EventBuffer.hpp"
#include "NodeImpl.hpp"
#include "OutputPort.hpp"
#include "ProcessContext.hpp"
#include "ThreadManager.hpp"
-#include "BufferFactory.hpp"
+#include "mix.hpp"
#include "util.hpp"
using namespace std;
@@ -198,13 +199,15 @@ InputPort::pre_process(Context& context)
// Multiple connections, mix them all into our local buffers
if (_connections.size() > 1) {
for (uint32_t v = 0; v < _poly; ++v) {
- // Copy first connection
- buffer(v)->copy(context, _connections.front()->buffer(v).get());
-
- // Mix in the rest
- Connections::iterator c = _connections.begin();
- for (++c; c != _connections.end(); ++c)
- buffer(v)->mix(context, (*c)->buffer(v).get());
+ const uint32_t num_srcs = _connections.size();
+ Connections::iterator c = _connections.begin();
+ Buffer* srcs[num_srcs];
+ for (uint32_t i = 0; c != _connections.end(); ++c) {
+ assert(i < num_srcs);
+ srcs[i++] = (*c)->buffer(v).get();
+ }
+
+ mix(context, buffer(v).get(), srcs, num_srcs);
}
}
diff --git a/src/engine/LV2EventBuffer.cpp b/src/engine/LV2EventBuffer.cpp
deleted file mode 100644
index cb157368..00000000
--- a/src/engine/LV2EventBuffer.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define __STDC_LIMIT_MACROS 1
-#include <stdint.h>
-#include <iostream>
-#include "ingen-config.h"
-#include "LV2EventBuffer.hpp"
-#include "event.lv2/event.h"
-#include "event.lv2/event-helpers.h"
-
-using namespace std;
-
-namespace Ingen {
-
-
-/** Allocate a new event buffer.
- * \a capacity is in bytes (not number of events).
- */
-LV2EventBuffer::LV2EventBuffer(size_t capacity)
- : _latest_frames(0)
- , _latest_subframes(0)
-{
- if (capacity > UINT32_MAX) {
- cerr << "Event buffer size " << capacity << " too large, aborting." << endl;
- throw std::bad_alloc();
- }
-
-#ifdef HAVE_POSIX_MEMALIGN
- int ret = posix_memalign((void**)&_data, 16, sizeof(LV2_Event_Buffer) + capacity);
-#else
- _data = (LV2_Event_Buffer*)malloc(sizeof(LV2_Event_Buffer) + capacity);
- int ret = (_data != NULL) ? 0 : -1;
-#endif
-
- if (ret != 0) {
- cerr << "Failed to allocate event buffer. Aborting." << endl;
- exit(EXIT_FAILURE);
- }
-
- _data->header_size = sizeof(LV2_Event_Buffer);
- _data->data = reinterpret_cast<uint8_t*>(_data + _data->header_size);
- _data->stamp_type = 0;
- _data->event_count = 0;
- _data->capacity = (uint32_t)capacity;
- _data->size = 0;
-
- reset();
-
- //cerr << "Creating MIDI Buffer " << _data << ", capacity = " << _data->capacity << endl;
-}
-
-
-LV2EventBuffer::~LV2EventBuffer()
-{
- free(_data);
-}
-
-
-/** Increment the read position by one event.
- *
- * \return true if increment was successful, or false if end of buffer reached.
- */
-bool
-LV2EventBuffer::increment() const
-{
- if (lv2_event_is_valid(&_iter)) {
- lv2_event_increment(&_iter);
- return true;
- } else {
- return false;
- }
-}
-
-
-/** \return true iff the cursor is valid (ie get_event is safe)
- */
-bool
-LV2EventBuffer::is_valid() const
-{
- return lv2_event_is_valid(&_iter);
-}
-
-
-/** Read an event from the current position in the buffer
- *
- * \return true if read was successful, or false if end of buffer reached
- */
-bool
-LV2EventBuffer::get_event(uint32_t* frames,
- uint32_t* subframes,
- uint16_t* type,
- uint16_t* size,
- uint8_t** data) const
-{
- if (lv2_event_is_valid(&_iter)) {
- LV2_Event* ev = lv2_event_get(&_iter, data);
- *frames = ev->frames;
- *subframes = ev->subframes;
- *type = ev->type;
- *size = ev->size;
- return true;
- } else {
- return false;
- }
-}
-
-
-/** Get the object currently pointed to, or NULL if invalid.
- */
-LV2_Object*
-LV2EventBuffer::get_object() const
-{
- if (lv2_event_is_valid(&_iter)) {
- uint8_t* data;
- LV2_Event* ev = lv2_event_get(&_iter, &data);
- return LV2_OBJECT_FROM_EVENT(ev);
- }
- return NULL;
-}
-
-
-/** Get the event currently pointed to, or NULL if invalid.
- */
-LV2_Event*
-LV2EventBuffer::get_event() const
-{
- if (lv2_event_is_valid(&_iter)) {
- uint8_t* data;
- return lv2_event_get(&_iter, &data);
- }
- return NULL;
-}
-
-
-/** Append an event to the buffer.
- *
- * \a timestamp must be >= the latest event in the buffer.
- *
- * \return true on success
- */
-bool
-LV2EventBuffer::append(uint32_t frames,
- uint32_t subframes,
- uint16_t type,
- uint16_t size,
- const uint8_t* data)
-{
-#ifndef NDEBUG
- if (lv2_event_is_valid(&_iter)) {
- LV2_Event* last_event = lv2_event_get(&_iter, NULL);
- assert(last_event->frames < frames
- || (last_event->frames == frames && last_event->subframes <= subframes));
- }
-#endif
-
- /*cout << "Appending event type " << type << ", size " << size
- << " @ " << frames << "." << subframes << endl;*/
-
- if (!lv2_event_write(&_iter, frames, subframes, type, size, data)) {
- cerr << "ERROR: Failed to write event." << endl;
- return false;
- } else {
- _latest_frames = frames;
- _latest_subframes = subframes;
- return true;
- }
-}
-
-
-/** Append a buffer of events to the buffer.
- *
- * \a timestamp must be >= the latest event in the buffer.
- *
- * \return true on success
- */
-bool
-LV2EventBuffer::append(const LV2_Event_Buffer* buf)
-{
- uint8_t** data = NULL;
- bool ret = true;
-
- LV2_Event_Iterator iter;
- for (lv2_event_begin(&iter, _data); lv2_event_is_valid(&iter); lv2_event_increment(&iter)) {
- LV2_Event* ev = lv2_event_get(&iter, data);
-
-#ifndef NDEBUG
- assert((ev->frames > _latest_frames)
- || (ev->frames == _latest_frames
- && ev->subframes >= _latest_subframes));
-#endif
-
- if (!(ret = append(ev->frames, ev->subframes, ev->type, ev->size, *data))) {
- cerr << "ERROR: Failed to write event." << endl;
- break;
- }
-
- _latest_frames = ev->frames;
- _latest_subframes = ev->subframes;
- }
-
- return ret;
-}
-
-
-/** Clear this buffer and copy @a buf into it.
- * The capacity of this buffer must be >= the capacity of @a buf.
- */
-void
-LV2EventBuffer::copy(const LV2EventBuffer& buf)
-{
- assert(buf._data->header_size == _data->header_size);
- memcpy(_data, buf._data, _data->header_size + buf._data->size);
-
- _iter = buf._iter;
- _iter.buf = _data;
-
- _latest_frames = buf._latest_frames;
- _latest_subframes = buf._latest_subframes;
-}
-
-
-} // namespace Ingen
-
diff --git a/src/engine/LV2EventBuffer.hpp b/src/engine/LV2EventBuffer.hpp
deleted file mode 100644
index 26548e71..00000000
--- a/src/engine/LV2EventBuffer.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef LV2EVENTBUFFER_H
-#define LV2EVENTBUFFER_H
-
-#include "event.lv2/event.h"
-#include "event.lv2/event-helpers.h"
-#include "object.lv2/object.h"
-
-namespace Ingen {
-
-
-class LV2EventBuffer {
-public:
- LV2EventBuffer(size_t capacity);
- ~LV2EventBuffer();
-
- /*inline LV2_Event_Buffer* data() { return _data; }
- inline const LV2_Event_Buffer* data() const { return _data; }*/
-
- inline void rewind() const { lv2_event_begin(&_iter, _data); }
-
- inline void reset() {
- _latest_frames = 0;
- _latest_subframes = 0;
- _data->event_count = 0;
- _data->size = 0;
- rewind();
- }
-
- inline size_t event_count() const { return _data->event_count; }
- inline uint32_t capacity() const { return _data->capacity; }
- inline uint32_t size() const { return _data->size; }
- inline uint32_t latest_frames() const { return _latest_frames; }
- inline uint32_t latest_subframes() const { return _latest_subframes; }
-
- bool increment() const;
-
- bool is_valid() const;
-
- bool get_event(uint32_t* frames,
- uint32_t* subframes,
- uint16_t* type,
- uint16_t* size,
- uint8_t** data) const;
-
- LV2_Object* get_object() const;
- LV2_Event* get_event() const;
-
- bool append(uint32_t frames,
- uint32_t subframes,
- uint16_t type,
- uint16_t size,
- const uint8_t* data);
-
- bool append(const LV2_Event_Buffer* buf);
-
- void copy(const LV2EventBuffer& buf);
-
-private:
- LV2_Event_Buffer* _data; ///< Contents
- mutable LV2_Event_Iterator _iter; ///< Iterator into _data
- uint32_t _latest_frames; ///< Latest time of all events (frames)
- uint32_t _latest_subframes; ///< Latest time of all events (subframes)
-};
-
-
-} // namespace Ingen
-
-#endif // LV2EVENTBUFFER_H
diff --git a/src/engine/ObjectBuffer.hpp b/src/engine/ObjectBuffer.hpp
index 709864b9..64c52299 100644
--- a/src/engine/ObjectBuffer.hpp
+++ b/src/engine/ObjectBuffer.hpp
@@ -37,7 +37,7 @@ public:
const void* port_data(Shared::PortType port_type) const;
void copy(Context& context, const Buffer* src);
- void mix(Context& context, const Buffer* src) {}
+ //void mix(Context& context, const Buffer* src) {}
void resize(size_t size);
diff --git a/src/engine/wscript b/src/engine/wscript
index f619d687..004b40da 100644
--- a/src/engine/wscript
+++ b/src/engine/wscript
@@ -19,7 +19,6 @@ def build(bld):
GraphObjectImpl.cpp
InputPort.cpp
InternalPlugin.cpp
- LV2EventBuffer.cpp
MessageContext.cpp
NodeBase.cpp
NodeFactory.cpp