From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Wed, 12 Jan 2022 07:48:47 +0000 (+0530)
Subject: audio gain: round the values
X-Git-Url: https://git.rkrishnan.org/pf/simplejson/module-simplejson.encoder.html?a=commitdiff_plain;h=bdaf28cff77a18fb37136ef68643e476b5151886;p=pihpsdr.git

audio gain: round the values
---

diff --git a/rigctl.c b/rigctl.c
index a3faded..74d23e2 100644
--- a/rigctl.c
+++ b/rigctl.c
@@ -954,12 +954,12 @@ gboolean parse_extended_cmd(char *command, CLIENT *client) {
       if (command[4] == ';') {
         // send reply back
         memset(reply, '\0', 9);
-        sprintf(reply, "ZZAG%03d;", (int)(active_receiver->volume * 100.0));
+        sprintf(reply, "ZZAG%03d;", (int) round(active_receiver->volume * 100.0));
         send_resp(client->fd, reply);
       } else if (command[7] == ';') {
           command[7] = '\0';
           int gain = strtol(&command[4], NULL, 10);
-          active_receiver->volume = (double)gain / 100.0;
+          active_receiver->volume = (double)gain / 100.0f;
           update_af_gain();
       }
       break;