summaryrefslogtreecommitdiffstats
path: root/src/engine/PortImpl.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-20 21:52:36 +0000
committerDavid Robillard <d@drobilla.net>2010-02-20 21:52:36 +0000
commit46e5de590817756b21a7a5d99bd4963df343f455 (patch)
tree7d7b3b63297b24d84e5b42cc8aeb22d4212738b5 /src/engine/PortImpl.hpp
parentb96a4015ae39b5bdd9afbd82898c0168a0a8e613 (diff)
downloadingen-46e5de590817756b21a7a5d99bd4963df343f455.tar.gz
ingen-46e5de590817756b21a7a5d99bd4963df343f455.tar.bz2
ingen-46e5de590817756b21a7a5d99bd4963df343f455.zip
Heavy overhaul of buffer management and polyphony.
* Working polyphony when nodes are instantiated at desired polyphony level (dynamic still doesn't work) * Use shared silent buffer for disconnected audio inputs (save memory) * Eliminate redundant patch compiling on delete and disconnect-all events that have child events * Fix a ton of crash bugs and other issues I've since forgotten git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2468 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/PortImpl.hpp')
-rw-r--r--src/engine/PortImpl.hpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/engine/PortImpl.hpp b/src/engine/PortImpl.hpp
index ceb556c1..ee61b367 100644
--- a/src/engine/PortImpl.hpp
+++ b/src/engine/PortImpl.hpp
@@ -35,7 +35,6 @@ namespace Ingen {
class NodeImpl;
class Buffer;
-class ProcessContext;
class BufferFactory;
@@ -55,7 +54,12 @@ public:
/** A port's parent is always a node, so static cast should be safe */
NodeImpl* parent_node() const { return (NodeImpl*)_parent; }
- bool set_polyphonic(Raul::Maid& maid, bool p);
+ /** Set the buffers array for this port.
+ *
+ * Audio thread. Returned value must be freed by caller.
+ * \a buffers must be poly() long
+ */
+ Raul::Array<BufferFactory::Ref>* set_buffers(Raul::Array<BufferFactory::Ref>* buffers);
/** Prepare for a new (external) polyphony value.
*
@@ -66,7 +70,6 @@ public:
/** Apply a new polyphony value.
*
* Audio thread.
- *
* \a poly Must be < the most recent value passed to prepare_poly.
*/
virtual bool apply_poly(Raul::Maid& maid, uint32_t poly);
@@ -75,7 +78,7 @@ public:
void set_value(const Raul::Atom& v) { _value = v; }
inline BufferFactory::Ref buffer(uint32_t voice) const {
- return _buffers->at(voice);
+ return _buffers->at((_poly == 1) ? 0 : voice);
}
inline BufferFactory::Ref prepared_buffer(uint32_t voice) const {
return _prepared_buffers->at(voice);
@@ -83,24 +86,36 @@ public:
/** Called once per process cycle */
virtual void pre_process(Context& context) = 0;
- virtual void process(ProcessContext& context) {};
virtual void post_process(Context& context) = 0;
/** Empty buffer contents completely (ie silence) */
virtual void clear_buffers();
+
+ virtual void 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);
+ }
+
virtual void connect_buffers();
+ virtual void recycle_buffers();
virtual bool is_input() const = 0;
virtual bool is_output() const = 0;
- uint32_t index() const { return _index; }
- uint32_t poly() const { return _poly; }
- Shared::PortType type() const { return _type; }
- size_t buffer_size() const {
- return (_type == Shared::PortType::CONTROL) ? 1 : _buffer_size;
+ uint32_t index() const { return _index; }
+ Shared::PortType type() const { return _type; }
+
+ size_t buffer_size() const { return _buffer_size; }
+
+ uint32_t poly() const {
+ return _poly;
+ }
+ uint32_t prepared_poly() const {
+ return (_prepared_buffers) ? _prepared_buffers->size() : 1;
}
- void set_buffer_size(BufferFactory& factory, size_t size);
+ void set_buffer_size(Context& context, BufferFactory& bufs, size_t size);
void broadcast(bool b) { _broadcast = b; }
bool broadcast() { return _broadcast; }