From 732b2f88813a601d4048322fdcbe2081112366b2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 4 Jan 2014 01:49:32 +0000 Subject: Fast path for Port::on_value_changed when value is non-float or unchanged. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5253 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/Port.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 1cc7f208..ad03bc3b 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -155,14 +155,21 @@ Port::moved() void Port::on_value_changed(double value) { - const Atom atom = _app.forge().make(float(value)); - if (atom != model()->value()) { - Ingen::World* const world = _app.world(); - _app.interface()->set_property(model()->uri(), - world->uris().ingen_value, - atom); + const URIs& uris = _app.uris(); + const Atom& current_value = model()->value(); + if (current_value.type() != uris.forge.Float) { + return; // Non-float, unsupported + } + + if (current_value.get() == (float)value) { + return; // No change } + const Atom atom = _app.forge().make(float(value)); + _app.interface()->set_property(model()->uri(), + _app.world()->uris().ingen_value, + atom); + if (_entered) { GraphBox* box = get_graph_box(); if (box) { -- cgit v1.2.1