summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine/Buffer.hpp6
-rw-r--r--src/engine/InputPort.cpp4
-rw-r--r--src/engine/InputPort.hpp4
-rw-r--r--src/engine/PortImpl.hpp4
-rw-r--r--src/engine/events/Disconnect.cpp26
-rw-r--r--src/engine/events/Disconnect.hpp5
6 files changed, 24 insertions, 25 deletions
diff --git a/src/engine/Buffer.hpp b/src/engine/Buffer.hpp
index 6449d885..56682228 100644
--- a/src/engine/Buffer.hpp
+++ b/src/engine/Buffer.hpp
@@ -74,9 +74,9 @@ public:
}
protected:
- BufferFactory& _factory;
- PortType _type;
- size_t _size;
+ BufferFactory& _factory;
+ PortType _type;
+ size_t _size;
friend class BufferFactory;
virtual ~Buffer() {}
diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp
index 03855275..80058632 100644
--- a/src/engine/InputPort.cpp
+++ b/src/engine/InputPort.cpp
@@ -75,7 +75,9 @@ InputPort::apply_poly(Maid& maid, uint32_t poly)
* \return true iff buffers are locally owned by the port
*/
bool
-InputPort::get_buffers(BufferFactory& bufs, Raul::Array<BufferFactory::Ref>* buffers, uint32_t poly)
+InputPort::get_buffers(BufferFactory& bufs,
+ Raul::Array<BufferFactory::Ref>* buffers,
+ uint32_t poly)
{
size_t num_connections = (ThreadManager::thread_is(THREAD_PROCESS))
? _connections.size() : _num_connections;
diff --git a/src/engine/InputPort.hpp b/src/engine/InputPort.hpp
index 819ca8bf..04fd2653 100644
--- a/src/engine/InputPort.hpp
+++ b/src/engine/InputPort.hpp
@@ -66,7 +66,9 @@ public:
bool apply_poly(Raul::Maid& maid, uint32_t poly);
- bool get_buffers(BufferFactory& bufs, Raul::Array<BufferFactory::Ref>* buffers, uint32_t poly);
+ bool get_buffers(BufferFactory& bufs,
+ Raul::Array<BufferFactory::Ref>* buffers,
+ uint32_t poly);
void pre_process(Context& context);
void post_process(Context& context);
diff --git a/src/engine/PortImpl.hpp b/src/engine/PortImpl.hpp
index bf743d94..a8f3a63e 100644
--- a/src/engine/PortImpl.hpp
+++ b/src/engine/PortImpl.hpp
@@ -94,7 +94,9 @@ public:
/** Empty buffer contents completely (ie silence) */
virtual void clear_buffers();
- virtual bool get_buffers(BufferFactory& bufs, Raul::Array<BufferFactory::Ref>* buffers, uint32_t poly) = 0;
+ virtual bool get_buffers(BufferFactory& bufs,
+ Raul::Array<BufferFactory::Ref>* buffers,
+ uint32_t poly) = 0;
void setup_buffers(BufferFactory& bufs, uint32_t poly) {
get_buffers(bufs, _buffers, poly);
diff --git a/src/engine/events/Disconnect.cpp b/src/engine/events/Disconnect.cpp
index 9de5d0fd..33a65ed8 100644
--- a/src/engine/events/Disconnect.cpp
+++ b/src/engine/events/Disconnect.cpp
@@ -55,7 +55,6 @@ Disconnect::Disconnect(
, _buffers(NULL)
, _internal(false)
, _reconnect_dst_port(true)
- , _clear_dst_port(false)
{
}
@@ -76,7 +75,6 @@ Disconnect::Disconnect(
, _buffers(NULL)
, _internal(true)
, _reconnect_dst_port(reconnect_dst_port)
- , _clear_dst_port(false)
{
}
@@ -161,7 +159,16 @@ Disconnect::pre_process()
_buffers = new Raul::Array<BufferFactory::Ref>(_dst_input_port->poly());
_dst_input_port->get_buffers(*_engine.buffer_factory(),
_buffers, _dst_input_port->poly());
- _clear_dst_port = true;
+
+ const bool is_control = _dst_input_port->is_a(PortType::CONTROL);
+ const float value = is_control ? _dst_input_port->value().get_float() : 0;
+ for (uint32_t i = 0; i < _buffers->size(); ++i) {
+ if (is_control) {
+ PtrCast<AudioBuffer>(_buffers->at(i))->set_value(value, 0, 0);
+ } else {
+ _buffers->at(i)->clear();
+ }
+ }
}
if (!_internal && _patch->enabled())
@@ -184,19 +191,6 @@ Disconnect::execute(ProcessContext& context)
else
_dst_input_port->setup_buffers(*_engine.buffer_factory(), _dst_input_port->poly());
_dst_input_port->connect_buffers();
- if (_clear_dst_port) {
- for (uint32_t v = 0; v < _dst_input_port->poly(); ++v) {
- if (_dst_input_port->is_a(PortType::CONTROL)) {
- IntrusivePtr<AudioBuffer> abuf(PtrCast<AudioBuffer>(
- _dst_input_port->buffer(v)));
- if (abuf)
- abuf->set_value(_dst_input_port->value().get_float(),
- context.start(), context.start());
- } else {
- _dst_input_port->buffer(v)->clear();
- }
- }
- }
} else {
_dst_input_port->recycle_buffers();
}
diff --git a/src/engine/events/Disconnect.hpp b/src/engine/events/Disconnect.hpp
index f7e965e0..9c741293 100644
--- a/src/engine/events/Disconnect.hpp
+++ b/src/engine/events/Disconnect.hpp
@@ -91,9 +91,8 @@ private:
Raul::Array<BufferFactory::Ref>* _buffers;
- bool _internal;
- bool _reconnect_dst_port;
- bool _clear_dst_port;
+ bool _internal;
+ bool _reconnect_dst_port;
};
} // namespace Events