From 279b19258b9e83fdfca490b44bf9964fdad8ab3b Mon Sep 17 00:00:00 2001 From: "W.P. van Paassen" Date: Wed, 12 Oct 2016 20:58:40 +0200 Subject: [PATCH] Small improvement and change to comply with coding standard --- libs/surfaces/cc121/cc121.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/surfaces/cc121/cc121.cc b/libs/surfaces/cc121/cc121.cc index 5e68b7b446..800605c9f7 100644 --- a/libs/surfaces/cc121/cc121.cc +++ b/libs/surfaces/cc121/cc121.cc @@ -1215,12 +1215,13 @@ CC121::map_gain () val = control->internal_to_interface (control->get_value ()); } - float fval = (val* 16384.0); - if (fval <0.0) - fval = 0.0; - else if (fval > 16383.0) - fval = 16383.0; - int ival = (int)(fval + 0.5); + int ival = (int)((val * 16384.0f) + 0.5f); + if (ival < 0) { + ival = 0; + } + else if (ival > 16383) { + ival = 16383; + } MIDI::byte buf[3];