diff options
author | David Robillard <d@drobilla.net> | 2010-02-23 05:14:20 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-23 05:14:20 +0000 |
commit | ca809494991686b253679ecf0c0b8b4bf48aa22d (patch) | |
tree | c51e4e764c12e9fe899f20830b08bebaa82f784e /src | |
parent | 3893203399c1b67fb70729558e51f014b863b307 (diff) | |
download | ingen-ca809494991686b253679ecf0c0b8b4bf48aa22d.tar.gz ingen-ca809494991686b253679ecf0c0b8b4bf48aa22d.tar.bz2 ingen-ca809494991686b253679ecf0c0b8b4bf48aa22d.zip |
Working dynamic polyphony in the root patch.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2483 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/ConnectionImpl.cpp | 1 | ||||
-rw-r--r-- | src/engine/NodeBase.cpp | 1 | ||||
-rw-r--r-- | src/engine/PatchImpl.cpp | 4 | ||||
-rw-r--r-- | src/engine/PortImpl.cpp | 16 |
4 files changed, 18 insertions, 4 deletions
diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp index 4a154809..e555509d 100644 --- a/src/engine/ConnectionImpl.cpp +++ b/src/engine/ConnectionImpl.cpp @@ -146,7 +146,6 @@ ConnectionImpl::process(Context& context) for (uint32_t v = 0; v < num_srcs; ++v) srcs[v] = src_port()->buffer(v).get(); - _local_buffer->clear(); mix(context, _local_buffer.get(), srcs, num_srcs); } } diff --git a/src/engine/NodeBase.cpp b/src/engine/NodeBase.cpp index 3881ebe0..ca9103da 100644 --- a/src/engine/NodeBase.cpp +++ b/src/engine/NodeBase.cpp @@ -270,7 +270,6 @@ NodeBase::set_port_buffer(uint32_t voice, uint32_t port_num, BufferFactory::Ref { /*debug << path() << " set port " << port_num << " voice " << voice << " buffer " << buf << endl;*/ - assert(voice < _polyphony); } diff --git a/src/engine/PatchImpl.cpp b/src/engine/PatchImpl.cpp index 165f708f..77408275 100644 --- a/src/engine/PatchImpl.cpp +++ b/src/engine/PatchImpl.cpp @@ -140,6 +140,10 @@ PatchImpl::apply_internal_poly(BufferFactory& bufs, Raul::Maid& maid, uint32_t p } } + const bool polyphonic = parent_patch() && (_internal_poly == parent_patch()->internal_poly()); + for (List<PortImpl*>::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) + (*i)->setup_buffers(bufs, polyphonic ? poly : 1); + _internal_poly = poly; return true; diff --git a/src/engine/PortImpl.cpp b/src/engine/PortImpl.cpp index 7bb81bbe..dac3fef0 100644 --- a/src/engine/PortImpl.cpp +++ b/src/engine/PortImpl.cpp @@ -108,7 +108,10 @@ PortImpl::prepare_poly(BufferFactory& bufs, uint32_t poly) if (_type != PortType::CONTROL && _type != PortType::AUDIO) return false; - if (_prepared_buffers && _prepared_buffers->size() < poly) { + if (_poly == poly) + return true; + + if (_prepared_buffers && _prepared_buffers->size() != poly) { delete _prepared_buffers; _prepared_buffers = NULL; } @@ -130,7 +133,10 @@ PortImpl::apply_poly(Maid& maid, uint32_t poly) if (_type != PortType::CONTROL && _type != PortType::AUDIO) return false; - assert(poly <= _prepared_buffers->size()); + if (!_prepared_buffers) + return true; + + assert(poly == _prepared_buffers->size()); _poly = poly; @@ -139,6 +145,12 @@ PortImpl::apply_poly(Maid& maid, uint32_t poly) assert(_buffers == _prepared_buffers); _prepared_buffers = NULL; + if (_type == PortType::CONTROL) + for (uint32_t v = 0; v < _poly; ++v) + if (_buffers->at(v)) + boost::static_pointer_cast<AudioBuffer>(_buffers->at(v))->set_value( + _value.get_float(), 0, 0); + assert(_buffers->size() >= poly); assert(this->poly() == poly); assert(!_prepared_buffers); |