diff options
author | David Robillard <d@drobilla.net> | 2007-09-30 17:36:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-09-30 17:36:38 +0000 |
commit | c40ddfc0eebbcb3333d6cc9e3df7fb62ecb45941 (patch) | |
tree | 6e73d5d43284335031cee32f9225b698f315a59d /src/libs/engine/Connection.cpp | |
parent | 829075dff9fe5d0b3f243f9e40256563a5f8e09a (diff) | |
download | ingen-c40ddfc0eebbcb3333d6cc9e3df7fb62ecb45941.tar.gz ingen-c40ddfc0eebbcb3333d6cc9e3df7fb62ecb45941.tar.bz2 ingen-c40ddfc0eebbcb3333d6cc9e3df7fb62ecb45941.zip |
Better driver interface for input/output.
MIDI output (pass-through anyway, plugin->output is still screwy).
Fix crash on failure to instantiate LV2 plugin.
git-svn-id: http://svn.drobilla.net/lad/ingen@786 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/Connection.cpp')
-rw-r--r-- | src/libs/engine/Connection.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/libs/engine/Connection.cpp b/src/libs/engine/Connection.cpp index c2ecb2ec..47893acb 100644 --- a/src/libs/engine/Connection.cpp +++ b/src/libs/engine/Connection.cpp @@ -51,6 +51,9 @@ Connection::Connection(Port* src_port, Port* dst_port) /*assert((src_port->parent_node()->poly() == dst_port->parent_node()->poly()) || (src_port->parent_node()->poly() == 1 || dst_port->parent_node()->poly() == 1));*/ + if (type() == DataType::MIDI) + _must_mix = false; // FIXME: kludge + if (_must_mix) _local_buffer = BufferFactory::create(dst_port->type(), dst_port->buffer(0)->size()); @@ -81,10 +84,11 @@ Connection::set_buffer_size(size_t size) void Connection::prepare_poly(uint32_t poly) { - _must_mix = (type() == DataType::FLOAT) && (poly > 1) && ( - (_src_port->poly() != _dst_port->poly()) - || (_src_port->polyphonic() && !_dst_port->polyphonic()) - || (_src_port->parent()->polyphonic() && !_dst_port->parent()->polyphonic()) ); + if (type() == DataType::FLOAT) + _must_mix = (poly > 1) && ( + (_src_port->poly() != _dst_port->poly()) + || (_src_port->polyphonic() && !_dst_port->polyphonic()) + || (_src_port->parent()->polyphonic() && !_dst_port->parent()->polyphonic()) ); /*cerr << src_port()->path() << " * " << src_port()->poly() << " -> " << dst_port()->path() << " * " << dst_port()->poly() @@ -118,19 +122,13 @@ Connection::process(SampleCount nframes, FrameTime start, FrameTime end) * would avoid having to mix multiple times. Probably not a very common * case, but it would be faster anyway. */ - // FIXME: Implement MIDI mixing - - if (_must_mix) { - assert(type() == DataType::FLOAT); + if (_must_mix && type() == DataType::FLOAT) { const AudioBuffer* const src_buffer = (AudioBuffer*)src_port()->buffer(0); AudioBuffer* mix_buf = (AudioBuffer*)_local_buffer; const size_t copy_size = std::min(src_buffer->size(), mix_buf->size()); - /*cerr << "[Connection] Mixing " << src_port()->path() << " * " << src_port()->poly() - << " -> " << dst_port()->path() << " * " << dst_port()->poly() << endl;*/ - // Copy src buffer to start of mix buffer mix_buf->copy((AudioBuffer*)src_port()->buffer(0), 0, copy_size-1); @@ -156,7 +154,13 @@ Connection::process(SampleCount nframes, FrameTime start, FrameTime end) // Scale the buffer down. if (src_port()->poly() > 1) mix_buf->scale(1.0f/(float)src_port()->poly(), 0, _buffer_size-1); + + } else if (_must_mix && type() == DataType::MIDI) { + + cerr << "WARNING: No MIDI mixing." << endl; + } + } |