diff options
author | David Robillard <d@drobilla.net> | 2007-10-13 20:35:29 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-10-13 20:35:29 +0000 |
commit | cf63c971c2a8ee8cc2ddcddb52ce8135cd29619b (patch) | |
tree | caea057e24a2d498b8fc88a44867891e1ec3766c /src/libs/engine/InputPort.cpp | |
parent | 4d440f54870cd3934a49bab1ae98fad3f13f00d4 (diff) | |
download | ingen-cf63c971c2a8ee8cc2ddcddb52ce8135cd29619b.tar.gz ingen-cf63c971c2a8ee8cc2ddcddb52ce8135cd29619b.tar.bz2 ingen-cf63c971c2a8ee8cc2ddcddb52ce8135cd29619b.zip |
Fix sub-patch MIDI I/O.
Make buffer 'joining' (zero-copy connections) significantly less retarded.
git-svn-id: http://svn.drobilla.net/lad/ingen@882 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/InputPort.cpp')
-rw-r--r-- | src/libs/engine/InputPort.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp index b9723855..f64cf97b 100644 --- a/src/libs/engine/InputPort.cpp +++ b/src/libs/engine/InputPort.cpp @@ -152,7 +152,7 @@ InputPort::pre_process(ProcessContext& context) if (_connections.size() == 0) { for (uint32_t i=0; i < _poly; ++i) - _buffers->at(i)->prepare_read(context.nframes()); + buffer(i)->prepare_read(context.nframes()); return; } @@ -162,8 +162,10 @@ InputPort::pre_process(ProcessContext& context) if ( ! _fixed_buffers) { // If only one connection, try to use buffer directly (zero copy) if (_connections.size() == 1) { - for (uint32_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) { + //cerr << path() << " joining to " << (*_connections.begin())->buffer(i) << endl; _buffers->at(i)->join((*_connections.begin())->buffer(i)); + } do_mixdown = false; } connect_buffers(); @@ -172,22 +174,27 @@ InputPort::pre_process(ProcessContext& context) } for (uint32_t i=0; i < _poly; ++i) - _buffers->at(i)->prepare_read(context.nframes()); + buffer(i)->prepare_read(context.nframes()); + + /*cerr << path() << " poly = " << _poly << ", mixdown: " << do_mixdown + << ", fixed buffers: " << _fixed_buffers << endl; - //cerr << path() << " poly = " << _poly << ", mixdown: " << do_mixdown << endl; + if (type() == DataType::MIDI) + for (uint32_t i=0; i < _poly; ++i) + cerr << path() << " (" << buffer(i) << ") # events: " << ((MidiBuffer*)buffer(i))->event_count() << ", joined: " << _buffers->at(i)->is_joined() << endl;*/ if (!do_mixdown) { -#ifndef NDEBUG +/*#ifndef NDEBUG for (uint32_t i=0; i < _poly; ++i) - assert(_buffers->at(i)->is_joined_to((*_connections.begin())->buffer(i))); -#endif + assert(buffer(i) == (*_connections.begin())->buffer(i)); +#endif*/ return; } if (_type == DataType::CONTROL || _type == DataType::AUDIO) { for (uint32_t voice=0; voice < _poly; ++voice) { // Copy first connection - _buffers->at(voice)->copy( + buffer(voice)->copy( (*_connections.begin())->buffer(voice), 0, _buffer_size-1); // Accumulate the rest @@ -196,7 +203,7 @@ InputPort::pre_process(ProcessContext& context) Connections::iterator c = _connections.begin(); for (++c; c != _connections.end(); ++c) - ((AudioBuffer*)_buffers->at(voice))->accumulate( + ((AudioBuffer*)buffer(voice))->accumulate( ((AudioBuffer*)(*c)->buffer(voice)), 0, _buffer_size-1); } } @@ -221,7 +228,9 @@ InputPort::post_process(ProcessContext& context) // Prepare for next cycle for (uint32_t i=0; i < _poly; ++i) - _buffers->at(i)->prepare_write(context.nframes()); + buffer(i)->prepare_write(context.nframes()); + + //cerr << path() << " input post: buffer: " << buffer(0) << endl; } |