diff options
author | David Robillard <d@drobilla.net> | 2013-06-09 02:27:16 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-06-09 02:27:16 +0000 |
commit | 2a37fbef6832aebfcb22feefa0bb05104eb6f018 (patch) | |
tree | 5e161bce0a7e0e6c5b66659693a139bff8520ec2 /src/server/DuplexPort.cpp | |
parent | 947b2ebaee2a4a6e5b59ec90856dd66eae63b3f2 (diff) | |
download | ingen-2a37fbef6832aebfcb22feefa0bb05104eb6f018.tar.gz ingen-2a37fbef6832aebfcb22feefa0bb05104eb6f018.tar.bz2 ingen-2a37fbef6832aebfcb22feefa0bb05104eb6f018.zip |
Inherit certain properties from ports connected to patch ports.
This is a bit too hard-edged at present, but does the right thing when building
a patch from scratch at least. Something needs to be done about removing the
properties, but this is hard for outputs since the arcs aren't keyed that way.
The main problem here is that Ardour barfs on plugins with MIDI input for audio
tracks, so if you *ever* connect the control input to a MIDI anything, it will
stick and not work in an Ardour audio track. Maybe it should be just
implemented for inputs as a stop gap...
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5136 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/DuplexPort.cpp')
-rw-r--r-- | src/server/DuplexPort.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index 6049e001..0e19e939 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -53,6 +53,40 @@ DuplexPort::~DuplexPort() } } +void +DuplexPort::inherit_neighbour(const PortImpl* port, + Resource::Properties& remove, + Resource::Properties& add) +{ + /* TODO: This needs to become more sophisticated, and correct the situation + if the port is disconnected. */ + if (_type == PortType::CONTROL || _type == PortType::CV) { + if (port->minimum().get<float>() < _min.get<float>()) { + _min = port->minimum(); + remove.insert(std::make_pair(_bufs.uris().lv2_minimum, + Property(_bufs.uris().wildcard))); + add.insert(std::make_pair(_bufs.uris().lv2_minimum, + port->minimum())); + } + if (port->maximum().get<float>() > _max.get<float>()) { + _max = port->maximum(); + remove.insert(std::make_pair(_bufs.uris().lv2_maximum, + Property(_bufs.uris().wildcard))); + add.insert(std::make_pair(_bufs.uris().lv2_maximum, + port->maximum())); + } + } else if (_type == PortType::ATOM) { + for (Resource::Properties::const_iterator i = port->properties().find( + _bufs.uris().atom_supports); + i != port->properties().end() && + i->first == _bufs.uris().atom_supports; + ++i) { + set_property(i->first, i->second); + add.insert(*i); + } + } +} + bool DuplexPort::get_buffers(BufferFactory& bufs, Raul::Array<BufferRef>* buffers, |