summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/engine/LV2Node.cpp35
-rw-r--r--src/libs/engine/ObjectSender.cpp5
-rw-r--r--src/libs/gui/ControlGroups.cpp6
3 files changed, 22 insertions, 24 deletions
diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp
index f45af62c..4aef8d69 100644
--- a/src/libs/engine/LV2Node.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -100,30 +100,21 @@ LV2Node::instantiate()
else
port_buffer_size = 1;
- if (port_class == SLV2_CONTROL_INPUT || port_class == SLV2_AUDIO_INPUT) {
+ if (port_class == SLV2_CONTROL_INPUT || port_class == SLV2_AUDIO_INPUT)
port = new InputPort(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size);
- _ports->at(j) = port;
- } else if (port_class == SLV2_CONTROL_OUTPUT || port_class == SLV2_AUDIO_OUTPUT) {
+ else if (port_class == SLV2_CONTROL_OUTPUT || port_class == SLV2_AUDIO_OUTPUT)
port = new OutputPort(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size);
- _ports->at(j) = port;
- } else if (port_class == SLV2_MIDI_INPUT) {
+ else if (port_class == SLV2_MIDI_INPUT)
port = new InputPort(this, port_name, j, _poly, DataType::MIDI, port_buffer_size);
- _ports->at(j) = port;
- } else if (port_class == SLV2_MIDI_OUTPUT) {
+ else if (port_class == SLV2_MIDI_OUTPUT)
port = new OutputPort(this, port_name, j, _poly, DataType::MIDI, port_buffer_size);
- _ports->at(j) = port;
- }
-
- assert(_ports->at(j) != NULL);
- //PortInfo* pi = port->port_info();
- //get_port_vals(j, pi);
+ assert(port);
+
+ if (port_class == SLV2_CONTROL_INPUT)
+ ((AudioBuffer*)port->buffer(0))->set(slv2_port_get_default_value(_lv2_plugin, id), 0);
- // Set default control val
- /*if (pi->is_control())
- ((TypedPort<Sample>*)port)->set_value(pi->default_val(), 0);
- else
- ((TypedPort<Sample>*)port)->set_value(0.0f, 0);*/
+ _ports->at(j) = port;
}
return true;
}
@@ -148,9 +139,11 @@ LV2Node::activate()
Port* const port = _ports->at(j);
set_port_buffer(i, j, port->buffer(i));
if (port->type() == DataType::FLOAT && port->buffer_size() == 1) {
- cerr << "FIXME: LV2 default value\n";
- ((AudioBuffer*)port->buffer(i))->set(0.0f, 0); // FIXME
- } else if (port->type() == DataType::FLOAT && port->buffer_size() > 1) {
+ ((AudioBuffer*)port->buffer(i))->set(
+ slv2_port_get_default_value(_lv2_plugin,
+ slv2_plugin_get_port_by_index(_lv2_plugin, j)),
+ 0);
+ } else if (port->type() == DataType::FLOAT) {
((AudioBuffer*)port->buffer(i))->set(0.0f, 0);
}
}
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index 50e47c48..db573afc 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -146,10 +146,9 @@ ObjectSender::send_port(ClientInterface* client, const Port* port)
// Send control value
if (port->type() == DataType::FLOAT && port->buffer_size() == 1) {
- Sample default_value = dynamic_cast<const AudioBuffer*>(
- port->buffer(0))->value_at(0);
+ const Sample value = dynamic_cast<const AudioBuffer*>(port->buffer(0))->value_at(0);
//cerr << port->path() << " sending default value " << default_value << endl;
- client->control_change(port->path(), default_value);
+ client->control_change(port->path(), value);
}
// Send metadata
diff --git a/src/libs/gui/ControlGroups.cpp b/src/libs/gui/ControlGroups.cpp
index 7af9011b..4de4e0c6 100644
--- a/src/libs/gui/ControlGroups.cpp
+++ b/src/libs/gui/ControlGroups.cpp
@@ -129,6 +129,12 @@ SliderControlGroup::init(ControlPanel* panel, SharedPtr<PortModel> pm)
pm->path().name().c_str()));
}
+ if (min > pm->value())
+ min = pm->value();
+
+ if (max < pm->value())
+ max = pm->value();
+
if (max <= min)
max = min + 1.0f;