summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/gui/Port.cpp22
-rw-r--r--src/libs/gui/Port.hpp2
2 files changed, 24 insertions, 0 deletions
diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp
index cd13d89d..aa63af14 100644
--- a/src/libs/gui/Port.cpp
+++ b/src/libs/gui/Port.cpp
@@ -66,5 +66,27 @@ Port::renamed()
}
+void
+Port::set_control(float value)
+{
+ if (_port_model->is_control()) {
+ float min = 0.0f;
+ float max = 1.0f;
+
+ const Atom& min_atom = _port_model->get_metadata("ingen:minimum");
+ const Atom& max_atom = _port_model->get_metadata("ingen:maximum");
+ if (min_atom.type() == Atom::FLOAT && max_atom.type() == Atom::FLOAT) {
+ min = min_atom.get_float();
+ max = max_atom.get_float();
+ }
+
+ App::instance().engine()->set_port_value(_port_model->path(),
+ min + (value * (max-min)));
+
+ FlowCanvas::Port::set_control(value);
+ }
+}
+
+
} // namespace GUI
} // namespace Ingen
diff --git a/src/libs/gui/Port.hpp b/src/libs/gui/Port.hpp
index b381c44b..d91c963a 100644
--- a/src/libs/gui/Port.hpp
+++ b/src/libs/gui/Port.hpp
@@ -43,6 +43,8 @@ public:
SharedPtr<PortModel> model() const { return _port_model; }
+ virtual void set_control(float value);
+
private:
void on_menu_destroy();