summaryrefslogtreecommitdiffstats
path: root/src/gui
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
parentc17ac70512d473fa6ab6b2f4c9fb0bd4e716d3c6 (diff)
downloadingen-d6d3cfeb3fc8dfd73998c2fee5f319b75f6757ff.tar.gz
ingen-d6d3cfeb3fc8dfd73998c2fee5f319b75f6757ff.tar.bz2
ingen-d6d3cfeb3fc8dfd73998c2fee5f319b75f6757ff.zip
Fix double-promotion warnings
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/GraphPortModule.cpp4
-rw-r--r--src/gui/NodeMenu.cpp7
-rw-r--r--src/gui/NodeModule.cpp4
-rw-r--r--src/gui/Port.cpp2
-rw-r--r--src/gui/PropertiesWindow.cpp4
5 files changed, 12 insertions, 9 deletions
diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp
index cf9858a3..a602f2f0 100644
--- a/src/gui/GraphPortModule.cpp
+++ b/src/gui/GraphPortModule.cpp
@@ -135,9 +135,9 @@ GraphPortModule::property_changed(const URI& key, const Atom& value)
const URIs& uris = app().uris();
if (value.type() == uris.forge.Float) {
if (key == uris.ingen_canvasX) {
- move_to(value.get<float>(), get_y());
+ move_to(static_cast<double>(value.get<float>()), get_y());
} else if (key == uris.ingen_canvasY) {
- move_to(get_x(), value.get<float>());
+ move_to(get_x(), static_cast<double>(value.get<float>()));
}
} else if (value.type() == uris.forge.String) {
if (key == uris.lv2_name &&
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));
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 1c62dd10..f333d3d2 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -467,9 +467,9 @@ NodeModule::property_changed(const URI& key, const Atom& value)
const URIs& uris = app().uris();
if (value.type() == uris.forge.Float) {
if (key == uris.ingen_canvasX) {
- move_to(value.get<float>(), get_y());
+ move_to(static_cast<double>(value.get<float>()), get_y());
} else if (key == uris.ingen_canvasY) {
- move_to(get_x(), value.get<float>());
+ move_to(get_x(), static_cast<double>(value.get<float>()));
}
} else if (value.type() == uris.forge.Bool) {
if (key == uris.ingen_polyphonic) {
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 4282343e..643cca5f 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -352,7 +352,7 @@ peak_color(float peak)
static const uint32_t peak_min = 0xFF561FC0;
static const uint32_t peak_max = 0xFF0A38C0;
- if (peak < 1.0) {
+ if (peak < 1.0f) {
return rgba_interpolate(min, max, peak);
} else {
return rgba_interpolate(peak_min, peak_max, fminf(peak, 2.0f) - 1.0f);
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 9912f73a..5c7a58ea 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -305,10 +305,10 @@ PropertiesWindow::create_value_widget(const URI& key,
Gtk::SpinButton* widget = manage(new Gtk::SpinButton(0.0, 4));
widget->property_numeric() = true;
widget->set_snap_to_ticks(false);
- widget->set_range(-FLT_MAX, FLT_MAX);
+ widget->set_range(-DBL_MAX, DBL_MAX);
widget->set_increments(0.1, 1.0);
if (value.is_valid()) {
- widget->set_value(value.get<float>());
+ widget->set_value(static_cast<double>(value.get<float>()));
}
widget->signal_value_changed().connect(
sigc::bind(sigc::mem_fun(this, &PropertiesWindow::on_change), key));