diff options
author | David Robillard <d@drobilla.net> | 2014-01-04 01:49:32 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-01-04 01:49:32 +0000 |
commit | 732b2f88813a601d4048322fdcbe2081112366b2 (patch) | |
tree | 97d5bf41c9537b263440cc6f36d20e30adf87f2c /src | |
parent | 4efec8317113579075fb79d2043df234eb4bff38 (diff) | |
download | ingen-732b2f88813a601d4048322fdcbe2081112366b2.tar.gz ingen-732b2f88813a601d4048322fdcbe2081112366b2.tar.bz2 ingen-732b2f88813a601d4048322fdcbe2081112366b2.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/Port.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
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>() == (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) { |