summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-09-02 02:18:36 +0000
committerDavid Robillard <d@drobilla.net>2014-09-02 02:18:36 +0000
commit84ea08aab648697b766a8b98949f13a0b4d61a95 (patch)
tree1c767fe7104f51835418118b42b9691accdabd87 /src
parenta2792bd09212eed55bba1aa30dc09043a6955486 (diff)
downloadingen-84ea08aab648697b766a8b98949f13a0b4d61a95.tar.gz
ingen-84ea08aab648697b766a8b98949f13a0b4d61a95.tar.bz2
ingen-84ea08aab648697b766a8b98949f13a0b4d61a95.zip
Fix polyphonic subgraph outputs in a monophonic parent graph.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5464 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/server/ArcImpl.cpp4
-rw-r--r--src/server/DuplexPort.cpp34
-rw-r--r--src/server/DuplexPort.hpp6
-rw-r--r--src/server/InputPort.cpp2
-rw-r--r--src/server/InputPort.hpp2
-rw-r--r--src/server/OutputPort.cpp7
-rw-r--r--src/server/OutputPort.hpp2
-rw-r--r--src/server/PortImpl.hpp4
8 files changed, 46 insertions, 15 deletions
diff --git a/src/server/ArcImpl.cpp b/src/server/ArcImpl.cpp
index e53f1880..928ea1ea 100644
--- a/src/server/ArcImpl.cpp
+++ b/src/server/ArcImpl.cpp
@@ -64,10 +64,10 @@ ArcImpl::buffer(uint32_t voice, SampleCount offset) const
if (_tail->buffer(0)->is_sequence()) {
if (_head->type() == PortType::CONTROL) {
- _tail->update_values(offset); // Update value buffer
+ _tail->update_values(offset, voice); // Update value buffer
return _tail->value_buffer(voice); // Return value buffer
} else if (_head->type() == PortType::CV) {
- _tail->update_values(offset); // Update initial value
+ _tail->update_values(offset, voice); // Update initial value
// Return full tail buffer below
}
}
diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp
index 0713c35a..1dd1672f 100644
--- a/src/server/DuplexPort.cpp
+++ b/src/server/DuplexPort.cpp
@@ -48,6 +48,11 @@ DuplexPort::DuplexPort(BufferFactory& bufs,
set_property(bufs.uris().ingen_polyphonic, bufs.forge().make(true));
}
+ if (!parent->parent() ||
+ _poly != parent->parent_graph()->internal_poly()) {
+ _poly = 1;
+ }
+
// Set default control range
if (!is_output && value.type() == bufs.uris().atom_Float) {
set_property(bufs.uris().lv2_minimum, bufs.forge().make(0.0f));
@@ -118,7 +123,29 @@ DuplexPort::get_buffers(BufferFactory& bufs,
uint32_t
DuplexPort::max_tail_poly(Context& context) const
{
- return parent_graph()->internal_poly_process();
+ return std::max(_poly, parent_graph()->internal_poly_process());
+}
+
+bool
+DuplexPort::prepare_poly(BufferFactory& bufs, uint32_t poly)
+{
+ if (!parent()->parent() ||
+ poly != parent()->parent_graph()->internal_poly()) {
+ return false;
+ }
+
+ return PortImpl::prepare_poly(bufs, poly);
+}
+
+bool
+DuplexPort::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly)
+{
+ if (!parent()->parent() ||
+ poly != parent()->parent_graph()->internal_poly()) {
+ return false;
+ }
+
+ return PortImpl::apply_poly(context, maid, poly);
}
void
@@ -136,6 +163,7 @@ DuplexPort::pre_process(Context& context)
perspective. Do whatever a normal block's input port does to
prepare input for reading. */
InputPort::pre_process(context);
+ InputPort::pre_run(context);
}
}
@@ -160,9 +188,9 @@ DuplexPort::next_value_offset(SampleCount offset, SampleCount end) const
}
void
-DuplexPort::update_values(SampleCount offset)
+DuplexPort::update_values(SampleCount offset, uint32_t voice)
{
- return OutputPort::update_values(offset);
+ return OutputPort::update_values(offset, voice);
}
} // namespace Server
diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp
index d231cebd..a247841e 100644
--- a/src/server/DuplexPort.hpp
+++ b/src/server/DuplexPort.hpp
@@ -64,6 +64,10 @@ public:
uint32_t max_tail_poly(Context& context) const;
+ bool prepare_poly(BufferFactory& bufs, uint32_t poly);
+
+ bool apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly);
+
bool get_buffers(BufferFactory& bufs,
Raul::Array<Voice>* voices,
uint32_t poly,
@@ -73,7 +77,7 @@ public:
void post_process(Context& context);
SampleCount next_value_offset(SampleCount offset, SampleCount end) const;
- void update_values(SampleCount offset);
+ void update_values(SampleCount offset, uint32_t voice);
bool is_input() const { return !_is_output; }
bool is_output() const { return _is_output; }
diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp
index 3e345f8d..a1910b4f 100644
--- a/src/server/InputPort.cpp
+++ b/src/server/InputPort.cpp
@@ -216,7 +216,7 @@ InputPort::next_value_offset(SampleCount offset, SampleCount end) const
}
void
-InputPort::update_values(SampleCount offset)
+InputPort::update_values(SampleCount offset, uint32_t voice)
{
}
diff --git a/src/server/InputPort.hpp b/src/server/InputPort.hpp
index d3bcd0be..7d0a1429 100644
--- a/src/server/InputPort.hpp
+++ b/src/server/InputPort.hpp
@@ -106,7 +106,7 @@ public:
void post_process(Context& context);
SampleCount next_value_offset(SampleCount offset, SampleCount end) const;
- void update_values(SampleCount offset);
+ void update_values(SampleCount offset, uint32_t voice);
size_t num_arcs() const { return _num_arcs; } ///< Pre-process thread
void increment_num_arcs() { ++_num_arcs; }
diff --git a/src/server/OutputPort.cpp b/src/server/OutputPort.cpp
index 395885ee..6d80dad2 100644
--- a/src/server/OutputPort.cpp
+++ b/src/server/OutputPort.cpp
@@ -79,10 +79,9 @@ OutputPort::next_value_offset(SampleCount offset, SampleCount end) const
}
void
-OutputPort::update_values(SampleCount offset)
+OutputPort::update_values(SampleCount offset, uint32_t voice)
{
- for (uint32_t v = 0; v < _poly; ++v)
- _voices->at(v).buffer->update_value_buffer(offset);
+ _voices->at(voice).buffer->update_value_buffer(offset);
}
void
@@ -90,9 +89,9 @@ OutputPort::post_process(Context& context)
{
for (uint32_t v = 0; v < _poly; ++v) {
update_set_state(context, v);
+ update_values(0, v);
}
- update_values(0);
monitor(context);
}
diff --git a/src/server/OutputPort.hpp b/src/server/OutputPort.hpp
index 24017059..79cb3762 100644
--- a/src/server/OutputPort.hpp
+++ b/src/server/OutputPort.hpp
@@ -55,7 +55,7 @@ public:
void post_process(Context& context);
SampleCount next_value_offset(SampleCount offset, SampleCount end) const;
- void update_values(SampleCount offset);
+ void update_values(SampleCount offset, uint32_t voice);
bool is_input() const { return false; }
bool is_output() const { return true; }
diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp
index ccefa0f1..f084a6e5 100644
--- a/src/server/PortImpl.hpp
+++ b/src/server/PortImpl.hpp
@@ -211,8 +211,8 @@ public:
virtual SampleCount next_value_offset(SampleCount offset,
SampleCount end) const;
- /** Update value buffer to be current as of `offset`. */
- virtual void update_values(SampleCount offset) = 0;
+ /** Update value buffer for `voice` to be current as of `offset`. */
+ virtual void update_values(SampleCount offset, uint32_t voice) = 0;
void force_monitor_update() { _force_monitor_update = true; }