]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Added MIDI action "VOXLEVEL"
authorc vw <dl1ycf@darc.de>
Mon, 18 Nov 2019 15:28:39 +0000 (16:28 +0100)
committerc vw <dl1ycf@darc.de>
Mon, 18 Nov 2019 15:28:39 +0000 (16:28 +0100)
midi.h
midi2.c
midi3.c

diff --git a/midi.h b/midi.h
index f84fde8ff4badd19e7237ea397b6b7e9e447af65..8d10ab9d2df358c2e44a5d27d4b1b79a72b168bb 100644 (file)
--- a/midi.h
+++ b/midi.h
@@ -91,6 +91,7 @@ enum MIDIaction {
   VFO_STEP_UP,         // VFOSTEPUP:           cycle through vfo steps upwards;
   VFO_STEP_DOWN,       // VFOSTEPDOWN:         cycle through vfo steps downwards;
   VOX,                         // VOX:                 toggle VOX on/off
+  VOXLEVEL,            // VOXLEVEL:            adjust VOX threshold
   MIDI_XIT_CLEAR,      // XITCLEAR:            clear XIT value
   XIT_VAL,             // XITVAL:              change XIT value
 };
diff --git a/midi2.c b/midi2.c
index c29024a47e89aaea9fe2e994e7522950aeb34b1e..e1ba4959aed6eb2418e51a3161b1abef8d0d332b 100644 (file)
--- a/midi2.c
+++ b/midi2.c
@@ -144,6 +144,7 @@ static struct {
        { VFO_STEP_UP,          "VFOSTEPUP"},
        { VFO_STEP_DOWN,        "VFOSTEPDOWN"},
        { VOX,                  "VOX"},
+       { VOXLEVEL,             "VOXLEVEL"},
        { MIDI_XIT_CLEAR,       "XITCLEAR"},
        { XIT_VAL,              "XITVAL"},
         { ACTION_NONE,         "NONE"},
diff --git a/midi3.c b/midi3.c
index f2c94098670f10c7fae160281e826983fe4062be..80dc87eea7bef1b31f16bd8949b5a2d27f7d011d 100644 (file)
--- a/midi3.c
+++ b/midi3.c
@@ -630,6 +630,26 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
              g_idle_add(ext_vfo_update, NULL);
            }
            break;
+       /////////////////////////////////////////////////////////// "VOXLEVEL"
+       case VOXLEVEL: // knob or wheel supported
+            switch (type) {
+              case MIDI_WHEEL:
+                // This changes the value incrementally,
+                // but stay within limits (0.0 through 1.0)
+                vox_threshold += (double) val * 0.01;
+               if (vox_threshold > 1.0) vox_threshold=1.0;
+               if (vox_threshold < 0.0) vox_threshold=0.0;
+                break;
+              case MIDI_KNOB:
+                vox_threshold = 0.01 * (double) val;
+                break;
+              default:
+                // do nothing
+                // we should not come here anyway
+                break;
+            }
+           // VOX level not shown on screen, hence no VFO update
+           break;
        /////////////////////////////////////////////////////////// "XITCLEAR"
         case MIDI_XIT_CLEAR:  // only key supported
             if (type == MIDI_KEY) {