summaryrefslogtreecommitdiffstats
path: root/src/server/DuplexPort.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-10-24 19:27:39 +0000
committerDavid Robillard <d@drobilla.net>2015-10-24 19:27:39 +0000
commit732bfb33105b4a534bc17caae9a50a1ccfcd7570 (patch)
treebad9715a99f11d17342adaef372361c3697beee9 /src/server/DuplexPort.cpp
parentade7143eb2af64fd6743a64ebf1786dd5bbe1092 (diff)
downloadingen-732bfb33105b4a534bc17caae9a50a1ccfcd7570.tar.gz
ingen-732bfb33105b4a534bc17caae9a50a1ccfcd7570.tar.bz2
ingen-732bfb33105b4a534bc17caae9a50a1ccfcd7570.zip
Zero-copy to/from driver ports where possible
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5778 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/DuplexPort.cpp')
-rw-r--r--src/server/DuplexPort.cpp45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp
index 05bf1b5a..f116ae09 100644
--- a/src/server/DuplexPort.cpp
+++ b/src/server/DuplexPort.cpp
@@ -29,19 +29,18 @@ namespace Ingen {
namespace Server {
DuplexPort::DuplexPort(BufferFactory& bufs,
- BlockImpl* parent,
+ GraphImpl* parent,
const Raul::Symbol& symbol,
uint32_t index,
bool polyphonic,
- uint32_t poly,
PortType type,
- LV2_URID buffer_type,
+ LV2_URID buf_type,
+ size_t buf_size,
const Atom& value,
- size_t buffer_size,
bool is_output)
- : PortImpl(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size)
- , InputPort(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size)
- , OutputPort(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size)
+ : PortImpl(bufs, parent, symbol, index, parent->polyphony(), type, buf_type, value, buf_size)
+ , InputPort(bufs, parent, symbol, index, parent->polyphony(), type, buf_type, value, buf_size)
+ , OutputPort(bufs, parent, symbol, index, parent->polyphony(), type, buf_type, value, buf_size)
, _is_output(is_output)
{
if (polyphonic) {
@@ -78,8 +77,8 @@ DuplexPort::duplicate(Engine& engine,
DuplexPort* dup = new DuplexPort(
bufs, parent, symbol, _index,
polyphonic.type() == bufs.uris().atom_Bool && polyphonic.get<int32_t>(),
- _poly, _type, _buffer_type,
- _value, _buffer_size, _is_output);
+ _type, _buffer_type, _buffer_size,
+ _value, _is_output);
dup->set_properties(properties());
@@ -129,11 +128,28 @@ DuplexPort::get_buffers(BufferFactory& bufs,
uint32_t poly,
bool real_time) const
{
- if (_is_output) {
- return InputPort::get_buffers(bufs, voices, poly, real_time);
- } else {
- return OutputPort::get_buffers(bufs, voices, poly, real_time);
+ if (!_is_driver_port) {
+ if (_is_output) {
+ return InputPort::get_buffers(bufs, voices, poly, real_time);
+ } else {
+ return OutputPort::get_buffers(bufs, voices, poly, real_time);
+ }
}
+ return false;
+}
+
+void
+DuplexPort::set_is_driver_port(BufferFactory& bufs)
+{
+ _voices->at(0).buffer = new Buffer(bufs, buffer_type(), _value.type(), 0, true, NULL);
+ PortImpl::set_is_driver_port(bufs);
+}
+
+void
+DuplexPort::set_driver_buffer(void* buf, uint32_t capacity)
+{
+ _voices->at(0).buffer->set_buffer(buf);
+ _voices->at(0).buffer->set_capacity(capacity);
}
uint32_t
@@ -192,9 +208,8 @@ DuplexPort::post_process(Context& context)
(external perspective) is ready. */
InputPort::pre_process(context);
InputPort::pre_run(context);
- } else {
- monitor(context);
}
+ monitor(context);
}
SampleCount