diff options
Diffstat (limited to 'src/server/DuplexPort.cpp')
-rw-r--r-- | src/server/DuplexPort.cpp | 79 |
1 files changed, 45 insertions, 34 deletions
diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index 8297e3cc..1e07afd2 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -23,25 +23,28 @@ #include "Engine.hpp" #include "GraphImpl.hpp" #include "NodeImpl.hpp" - -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Node.hpp" -#include "ingen/Properties.hpp" -#include "ingen/URIs.hpp" -#include "ingen/types.hpp" -#include "raul/Array.hpp" +#include "PortType.hpp" + +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Node.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <lv2/urid/urid.h> +#include <raul/Array.hpp> +#include <raul/Maid.hpp> #include <algorithm> #include <map> +#include <memory> #include <utility> -namespace ingen { -namespace server { +namespace ingen::server { DuplexPort::DuplexPort(BufferFactory& bufs, GraphImpl* parent, - const Raul::Symbol& symbol, + const raul::Symbol& symbol, uint32_t index, bool polyphonic, PortType type, @@ -69,8 +72,11 @@ DuplexPort::DuplexPort(BufferFactory& bufs, _is_output = is_output; if (is_output) { if (parent->graph_type() != Node::GraphType::GRAPH) { - remove_property(bufs.uris().rdf_type, bufs.uris().lv2_InputPort.urid); - add_property(bufs.uris().rdf_type, bufs.uris().lv2_OutputPort.urid); + remove_property(bufs.uris().rdf_type, + bufs.uris().lv2_InputPort.urid_atom()); + + add_property(bufs.uris().rdf_type, + bufs.uris().lv2_OutputPort.urid_atom()); } } @@ -87,11 +93,11 @@ DuplexPort::~DuplexPort() DuplexPort* DuplexPort::duplicate(Engine& engine, - const Raul::Symbol& symbol, + const raul::Symbol& symbol, GraphImpl* parent) { BufferFactory& bufs = *engine.buffer_factory(); - const Atom polyphonic = get_property(bufs.uris().ingen_polyphonic); + const Atom& polyphonic = get_property(bufs.uris().ingen_polyphonic); auto* dup = new DuplexPort( bufs, parent, symbol, _index, @@ -141,17 +147,20 @@ DuplexPort::on_property(const URI& uri, const Atom& value) } bool -DuplexPort::get_buffers(BufferFactory& bufs, - PortImpl::GetFn get, - const MPtr<Voices>& voices, - uint32_t poly, - size_t num_in_arcs) const +DuplexPort::get_buffers(BufferFactory& bufs, + PortImpl::GetFn get, + const raul::managed_ptr<Voices>& voices, + uint32_t poly, + size_t num_in_arcs) const { if (!_is_driver_port && is_output()) { return InputPort::get_buffers(bufs, get, voices, poly, num_in_arcs); - } else if (!_is_driver_port && is_input()) { + } + + if (!_is_driver_port && is_input()) { return PortImpl::get_buffers(bufs, get, voices, poly, num_in_arcs); } + return false; } @@ -160,9 +169,12 @@ DuplexPort::setup_buffers(RunContext& ctx, BufferFactory& bufs, uint32_t poly) { if (!_is_driver_port && is_output()) { return InputPort::setup_buffers(ctx, bufs, poly); - } else if (!_is_driver_port && is_input()) { + } + + if (!_is_driver_port && is_input()) { return PortImpl::setup_buffers(ctx, bufs, poly); } + return false; } @@ -198,46 +210,46 @@ DuplexPort::prepare_poly(BufferFactory& bufs, uint32_t poly) } bool -DuplexPort::apply_poly(RunContext& context, uint32_t poly) +DuplexPort::apply_poly(RunContext& ctx, uint32_t poly) { if (!parent()->parent() || poly != parent()->parent_graph()->internal_poly()) { return false; } - return PortImpl::apply_poly(context, poly); + return PortImpl::apply_poly(ctx, poly); } void -DuplexPort::pre_process(RunContext& context) +DuplexPort::pre_process(RunContext& ctx) { if (_is_output) { /* This is a graph output, which is an input from the internal perspective. Prepare buffers for write so plugins can deliver to them */ for (uint32_t v = 0; v < _poly; ++v) { - _voices->at(v).buffer->prepare_write(context); + _voices->at(v).buffer->prepare_write(ctx); } } else { /* This is a a graph input, which is an output from the internal perspective. Do whatever a normal block's input port does to prepare input for reading. */ - InputPort::pre_process(context); - InputPort::pre_run(context); + InputPort::pre_process(ctx); + InputPort::pre_run(ctx); } } void -DuplexPort::post_process(RunContext& context) +DuplexPort::post_process(RunContext& ctx) { if (_is_output) { /* This is a graph output, which is an input from the internal perspective. Mix down input delivered by plugins so output (external perspective) is ready. */ - InputPort::pre_process(context); - InputPort::pre_run(context); + InputPort::pre_process(ctx); + InputPort::pre_run(ctx); } - monitor(context); + monitor(ctx); } SampleCount @@ -246,5 +258,4 @@ DuplexPort::next_value_offset(SampleCount offset, SampleCount end) const return PortImpl::next_value_offset(offset, end); } -} // namespace server -} // namespace ingen +} // namespace ingen::server |