summaryrefslogtreecommitdiffstats
path: root/src/gui/NodeMenu.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-02 11:02:58 +0200
committerDavid Robillard <d@drobilla.net>2020-08-02 12:51:09 +0200
commitd6d3cfeb3fc8dfd73998c2fee5f319b75f6757ff (patch)
tree8f2b25c77c66a012912cd8c89d571ef068e114b9 /src/gui/NodeMenu.cpp
parentc17ac70512d473fa6ab6b2f4c9fb0bd4e716d3c6 (diff)
downloadingen-d6d3cfeb3fc8dfd73998c2fee5f319b75f6757ff.tar.gz
ingen-d6d3cfeb3fc8dfd73998c2fee5f319b75f6757ff.tar.bz2
ingen-d6d3cfeb3fc8dfd73998c2fee5f319b75f6757ff.zip
Fix double-promotion warnings
Diffstat (limited to 'src/gui/NodeMenu.cpp')
-rw-r--r--src/gui/NodeMenu.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index e2478592..3e9057fc 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -175,9 +175,12 @@ NodeMenu::on_menu_randomize()
const SPtr<const BlockModel> bm = block();
for (const auto& p : bm->ports()) {
if (p->is_input() && _app->can_control(p.get())) {
- float min = 0.0f, max = 1.0f;
+ float min = 0.0f;
+ float max = 1.0f;
bm->port_value_range(p, min, max, _app->sample_rate());
- const float val = g_random_double_range(0.0, 1.0) * (max - min) + min;
+
+ const float r = static_cast<float>(g_random_double_range(0.0, 1.0));
+ const float val = r * (max - min) + min;
_app->set_property(p->uri(),
_app->uris().ingen_value,
_app->forge().make(val));