From 531cd8958765315a5340ba94487d655023acd758 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 8 Oct 2007 22:39:40 +0000 Subject: OSC Blinkenports(TM). git-svn-id: http://svn.drobilla.net/lad/ingen@856 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/OSCBuffer.cpp | 3 +-- src/libs/engine/OSCBuffer.hpp | 1 + src/libs/engine/PortImpl.cpp | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/libs/engine') diff --git a/src/libs/engine/OSCBuffer.cpp b/src/libs/engine/OSCBuffer.cpp index d3d1c952..977d4e66 100644 --- a/src/libs/engine/OSCBuffer.cpp +++ b/src/libs/engine/OSCBuffer.cpp @@ -89,14 +89,13 @@ OSCBuffer::prepare_read(SampleCount nframes) { assert(!_joined_buf || data() == _joined_buf->data()); - reset(nframes); + rewind(); } void OSCBuffer::prepare_write(SampleCount nframes) { - clear(); reset(nframes); assert(!_joined_buf || data() == _joined_buf->data()); diff --git a/src/libs/engine/OSCBuffer.hpp b/src/libs/engine/OSCBuffer.hpp index d70474a2..9f352de3 100644 --- a/src/libs/engine/OSCBuffer.hpp +++ b/src/libs/engine/OSCBuffer.hpp @@ -47,6 +47,7 @@ public: void copy(const Buffer* src, size_t start_sample, size_t end_sample); uint32_t this_nframes() const { return _this_nframes; } + uint32_t event_count() const { return _buf->message_count; } inline LV2OSCBuffer* data() { return ((_joined_buf != NULL) ? _joined_buf->data() : _buf); } diff --git a/src/libs/engine/PortImpl.cpp b/src/libs/engine/PortImpl.cpp index a6911154..7ef4a82a 100644 --- a/src/libs/engine/PortImpl.cpp +++ b/src/libs/engine/PortImpl.cpp @@ -23,6 +23,7 @@ #include "interface/DataType.hpp" #include "AudioBuffer.hpp" #include "MidiBuffer.hpp" +#include "OSCBuffer.hpp" #include "BufferFactory.hpp" #include "ProcessContext.hpp" #include "SendPortActivityEvent.hpp" @@ -57,7 +58,7 @@ PortImpl::PortImpl(NodeImpl* const node, if (node->parent() == NULL) _polyphonic = false; - if (type == DataType::MIDI) + if (type == DataType::MIDI || type == DataType::OSC) _broadcast = true; // send activity blips assert(_buffers->size() > 0); @@ -174,6 +175,11 @@ PortImpl::broadcast(ProcessContext& context) const SendPortActivityEvent ev(context.engine(), context.start(), this); context.event_sink().write(sizeof(ev), &ev); } + } else if (_type == DataType::OSC) { + if (((OSCBuffer*)(*_buffers)[0])->event_count() > 0) { + const SendPortActivityEvent ev(context.engine(), context.start(), this); + context.event_sink().write(sizeof(ev), &ev); + } } } } -- cgit v1.2.1