diff options
author | David Robillard <d@drobilla.net> | 2010-02-09 20:49:36 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-09 20:49:36 +0000 |
commit | 9ec88674048c4d4d82383623b38c31927340143d (patch) | |
tree | f879bdad4e5d23ded70c3c4e679cc6001a962d28 /src | |
parent | adc6671c0a4c747c4bb30a13c51054e8a319a145 (diff) | |
download | ingen-9ec88674048c4d4d82383623b38c31927340143d.tar.gz ingen-9ec88674048c4d4d82383623b38c31927340143d.tar.bz2 ingen-9ec88674048c4d4d82383623b38c31927340143d.zip |
Fix port value broadcasting to work with all types.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2438 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/ObjectBuffer.cpp | 4 | ||||
-rw-r--r-- | src/engine/PortImpl.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/engine/ObjectBuffer.cpp b/src/engine/ObjectBuffer.cpp index a391bb99..a4108ba1 100644 --- a/src/engine/ObjectBuffer.cpp +++ b/src/engine/ObjectBuffer.cpp @@ -41,7 +41,7 @@ using namespace Shared; ObjectBuffer::ObjectBuffer(BufferFactory& factory, size_t capacity) : Buffer(factory, PortType(PortType::VALUE), capacity) { - assert(capacity >= sizeof(LV2_Object)); + capacity += sizeof(LV2_Object); #ifdef HAVE_POSIX_MEMALIGN const int ret = posix_memalign((void**)&_buf, 16, capacity); @@ -88,7 +88,7 @@ ObjectBuffer::resize(size_t size) const uint32_t contents_size = sizeof(LV2_Object) + _buf->size; _buf = (LV2_Object*)realloc(_buf, sizeof(LV2_Object) + size); - _size = size; + _size = size + sizeof(LV2_Object); // If we shrunk and chopped the current contents, clear corrupt data if (size < contents_size) diff --git a/src/engine/PortImpl.cpp b/src/engine/PortImpl.cpp index 5766e80f..6ee4c0e1 100644 --- a/src/engine/PortImpl.cpp +++ b/src/engine/PortImpl.cpp @@ -57,7 +57,7 @@ PortImpl::PortImpl(BufferFactory& bufs, , _value(value) , _broadcast(false) , _set_by_user(false) - , _last_broadcasted_value(_value.type() == Atom::FLOAT ? _value.get_float() : 0.0f) // default? + , _last_broadcasted_value(value) , _context(Context::AUDIO) , _buffers(new Array<BufferFactory::Ref>(poly)) , _prepared_buffers(NULL) @@ -197,7 +197,7 @@ PortImpl::broadcast_value(Context& context, bool force) break; } - if (val.type() == Atom::FLOAT && (force || val != _last_broadcasted_value)) { + if (val.is_valid() && (force || val != _last_broadcasted_value)) { _last_broadcasted_value = val; const Events::SendPortValue ev(context.engine(), context.start(), this, true, 0, val); context.event_sink().write(sizeof(ev), &ev); |