diff options
author | David Robillard <d@drobilla.net> | 2007-01-02 02:51:41 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-01-02 02:51:41 +0000 |
commit | 84906b5777d6748c09dd5ca56169aa3366d13c71 (patch) | |
tree | 69207ea182be5c44c0a5e89d3d475ab0b39e97c5 /src/libs/engine/TypedPort.cpp | |
parent | b249234a26f3a424fcf977b1a3b8fed4d5ac7d39 (diff) | |
download | ingen-84906b5777d6748c09dd5ca56169aa3366d13c71.tar.gz ingen-84906b5777d6748c09dd5ca56169aa3366d13c71.tar.bz2 ingen-84906b5777d6748c09dd5ca56169aa3366d13c71.zip |
Initial work on dynamic (Jack) buffer resizing (still unworking).
git-svn-id: http://svn.drobilla.net/lad/ingen@229 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/TypedPort.cpp')
-rw-r--r-- | src/libs/engine/TypedPort.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/libs/engine/TypedPort.cpp b/src/libs/engine/TypedPort.cpp index 4cc184e6..d2825b17 100644 --- a/src/libs/engine/TypedPort.cpp +++ b/src/libs/engine/TypedPort.cpp @@ -100,11 +100,33 @@ template void TypedPort<MidiMessage>::allocate_buffers(); template <typename T> void -TypedPort<T>::process(SampleCount nframes, FrameTime start, FrameTime end) +TypedPort<T>::set_buffer_size(size_t size) { + _buffer_size = size; + for (size_t i=0; i < _poly; ++i) - m_buffers.at(i)->prepare(nframes); + m_buffers.at(i)->resize(size); + + connect_buffers(); } +template void TypedPort<Sample>::set_buffer_size(size_t size); +template void TypedPort<MidiMessage>::set_buffer_size(size_t size); + + +/** Update any changed buffers with the plugin this is a port on. + * + * This calls ie the LADSPA connect_port function when buffers have been changed + * due to a connection, disconnection, resize, etc. + */ +template <typename T> +void +TypedPort<T>::connect_buffers() +{ + for (size_t i=0; i < _poly; ++i) + TypedPort<T>::parent_node()->set_port_buffer(i, _index, m_buffers.at(i)->data()); +} +template void TypedPort<Sample>::connect_buffers(); +template void TypedPort<MidiMessage>::connect_buffers(); template<typename T> @@ -118,5 +140,14 @@ template void TypedPort<Sample>::clear_buffers(); template void TypedPort<MidiMessage>::clear_buffers(); +template <typename T> +void +TypedPort<T>::process(SampleCount nframes, FrameTime start, FrameTime end) +{ + for (size_t i=0; i < _poly; ++i) + m_buffers.at(i)->prepare(nframes); +} + + } // namespace Ingen |