summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-22 15:33:57 +0000
committerDavid Robillard <d@drobilla.net>2012-05-22 15:33:57 +0000
commit81884522025e2147e309b8042bbbc6ebcd927cc7 (patch)
tree39bc63bd84c647a8d889d939bde659639bb4f95e /src
parentb1d4027b58465d9cc31d6cb1be05a7ff4f202711 (diff)
downloadingen-81884522025e2147e309b8042bbbc6ebcd927cc7.tar.gz
ingen-81884522025e2147e309b8042bbbc6ebcd927cc7.tar.bz2
ingen-81884522025e2147e309b8042bbbc6ebcd927cc7.zip
Fix crash when setting nodes polyphonic.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4433 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/server/InputPort.cpp9
-rw-r--r--src/server/PatchImpl.cpp6
-rw-r--r--src/server/PortImpl.cpp15
-rw-r--r--src/server/PortImpl.hpp2
-rw-r--r--src/server/events/SetMetadata.cpp2
5 files changed, 13 insertions, 21 deletions
diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp
index ebe5d41d..3ff8cd41 100644
--- a/src/server/InputPort.cpp
+++ b/src/server/InputPort.cpp
@@ -88,8 +88,9 @@ InputPort::get_buffers(Context& context,
if (is_a(PortType::AUDIO) && num_edges == 0) {
// Audio input with no edges, use shared zero buffer
- for (uint32_t v = 0; v < poly; ++v)
+ for (uint32_t v = 0; v < poly; ++v) {
buffers->at(v) = bufs.silent_buffer();
+ }
return false;
} else if (num_edges == 1) {
@@ -97,8 +98,9 @@ InputPort::get_buffers(Context& context,
if (!_edges.front().must_mix() &&
!_edges.front().must_queue()) {
// Single non-mixing connection, use buffers directly
- for (uint32_t v = 0; v < poly; ++v)
+ for (uint32_t v = 0; v < poly; ++v) {
buffers->at(v) = _edges.front().buffer(v);
+ }
return false;
}
}
@@ -106,7 +108,8 @@ InputPort::get_buffers(Context& context,
// Otherwise, allocate local buffers
for (uint32_t v = 0; v < poly; ++v) {
- buffers->at(v) = _bufs.get(context, buffer_type(), _buffer_size);
+ buffers->at(v).reset();
+ buffers->at(v) = bufs.get(context, buffer_type(), _buffer_size);
buffers->at(v)->clear();
}
return true;
diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp
index fefc797e..43a8ea01 100644
--- a/src/server/PatchImpl.cpp
+++ b/src/server/PatchImpl.cpp
@@ -109,10 +109,6 @@ PatchImpl::prepare_internal_poly(BufferFactory& bufs, uint32_t poly)
for (Nodes::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
(*i)->prepare_poly(bufs, poly);
- for (Nodes::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
- for (uint32_t j = 0; j < (*i)->num_ports(); ++j)
- (*i)->port_impl(j)->prepare_poly_buffers(bufs);
-
return true;
}
@@ -433,7 +429,7 @@ PatchImpl::build_ports_array() const
/** Find the process order for this Patch.
*
* The process order is a flat list that the patch will execute in order
- * when it's run() method is called. Return value is a newly allocated list
+ * when its run() method is called. Return value is a newly allocated list
* which the caller is reponsible to delete. Note that this function does
* NOT actually set the process order, it is returned so it can be inserted
* at the beginning of an audio cycle (by various Events).
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index 9f2aae32..8ce8ac91 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -133,17 +133,12 @@ PortImpl::prepare_poly(BufferFactory& bufs, uint32_t poly)
if (!_prepared_buffers)
_prepared_buffers = new Raul::Array<BufferRef>(poly, *_buffers, NULL);
- return true;
-}
+ get_buffers(bufs.engine().message_context(),
+ bufs,
+ _prepared_buffers,
+ _prepared_buffers->size());
-void
-PortImpl::prepare_poly_buffers(BufferFactory& bufs)
-{
- if (_prepared_buffers)
- get_buffers(bufs.engine().message_context(),
- bufs,
- _prepared_buffers,
- _prepared_buffers->size());
+ return true;
}
bool
diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp
index 503e619f..0dbb271c 100644
--- a/src/server/PortImpl.hpp
+++ b/src/server/PortImpl.hpp
@@ -70,8 +70,6 @@ public:
*/
virtual bool prepare_poly(BufferFactory& bufs, uint32_t poly);
- virtual void prepare_poly_buffers(BufferFactory& bufs);
-
/** Apply a new polyphony value.
*
* Audio thread.
diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp
index 7bd3e7a5..e8cce384 100644
--- a/src/server/events/SetMetadata.cpp
+++ b/src/server/events/SetMetadata.cpp
@@ -142,7 +142,7 @@ SetMetadata::pre_process()
// Grab the object for applying properties, if the create-event succeeded
_object = _engine.engine_store()->find_object(Raul::Path(_subject.str()));
} else {
- _status = BAD_OBJECT_TYPE;
+ return Event::pre_process_done(BAD_OBJECT_TYPE);
}
}