]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Made the table for the processing of the "legacy input file"
authorc vw <dl1ycf@darc.de>
Wed, 11 Aug 2021 14:58:46 +0000 (16:58 +0200)
committerc vw <dl1ycf@darc.de>
Wed, 11 Aug 2021 14:58:46 +0000 (16:58 +0200)
local to midi2.c

midi.h
midi2.c

diff --git a/midi.h b/midi.h
index 9a4e562abbd5f03327bd8718d8123d79fa7eaea8..dbd971edf725134f012cafdebc62535e9d169e1e 100644 (file)
--- a/midi.h
+++ b/midi.h
@@ -64,13 +64,6 @@ enum MIDIevent {
 //
 // Data structure for Layer-2
 //
-typedef struct _old_action_table {
-  enum ACTION action;
-  const char *str;
-  enum ACTIONtype type;
-} OLD_ACTION_TABLE;
-
-extern OLD_ACTION_TABLE OLD_ActionTable[];
 
 //
 // There is linked list of all specified MIDI events for a given "Note" value,
diff --git a/midi2.c b/midi2.c
index 00b400de1cc796341a7d59f8250527ec0c1f3741..a5dc7d24b8b77b8a041c55b24282109c66769823 100644 (file)
--- a/midi2.c
+++ b/midi2.c
@@ -186,107 +186,119 @@ void MidiAddCommand(int note, struct desc *desc) {
 
 //
 // maintained so old midi configurations can be loaded
+// the sole purpose of this table is to map names in
+// the midi.props file to actions
 //
-OLD_ACTION_TABLE OLD_ActionTable[] = {
-       { NO_ACTION,            "NONE",         TYPE_NONE},
-       { A_TO_B,               "A2B",          MIDI_KEY},
-        { AF_GAIN,             "AFGAIN",       MIDI_KNOB|MIDI_WHEEL},
-       { AGC,                  "AGCATTACK",    MIDI_KEY},
-        { AGC_GAIN,            "AGCVAL",       MIDI_KNOB|MIDI_WHEEL},
-        { ANF,                 "ANF",          MIDI_KEY},
-        { ATTENUATION,                 "ATT",          MIDI_KNOB|MIDI_WHEEL},
-       { B_TO_A,                       "B2A",          MIDI_KEY},
-       { BAND_10,         "BAND10",    MIDI_KEY},
-        { BAND_12,         "BAND12",   MIDI_KEY},
-        { BAND_1240,       "BAND1240", MIDI_KEY},
-        { BAND_144,        "BAND144",  MIDI_KEY},
-        { BAND_15,         "BAND15",   MIDI_KEY},
-        { BAND_160,        "BAND160",  MIDI_KEY},
-        { BAND_17,         "BAND17",   MIDI_KEY},
-        { BAND_20,         "BAND20",   MIDI_KEY},
-        { BAND_220,        "BAND220",  MIDI_KEY},
-        { BAND_2300,       "BAND2300", MIDI_KEY},
-        { BAND_30,         "BAND30",   MIDI_KEY},
-        { BAND_3400,       "BAND3400", MIDI_KEY},
-        { BAND_40,         "BAND40",   MIDI_KEY},
-        { BAND_430,        "BAND430",  MIDI_KEY},
-        { BAND_6,          "BAND6",    MIDI_KEY},
-        { BAND_60,         "BAND60",   MIDI_KEY},
-        { BAND_70,         "BAND70",   MIDI_KEY},
-        { BAND_80,         "BAND80",   MIDI_KEY},
-        { BAND_902,        "BAND902",  MIDI_KEY},
-        { BAND_AIR,        "BANDAIR",  MIDI_KEY},
-        { BAND_MINUS,      "BANDDOWN", MIDI_KEY},
-        { BAND_GEN,        "BANDGEN",  MIDI_KEY},
-        { BAND_PLUS,       "BANDUP",   MIDI_KEY},
-        { BAND_WWV,        "BANDWWV",  MIDI_KEY},
-        { COMPRESSION,         "COMPRESS",     MIDI_KEY},
-       { CTUN,                 "CTUN",         MIDI_KEY},
-       { VFO,                  "CURRVFO",      MIDI_WHEEL},
-       { CW_LEFT,              "CWL",          MIDI_KEY},
-       { CW_RIGHT,             "CWR",          MIDI_KEY},
-       { CW_SPEED,             "CWSPEED",      MIDI_KNOB|MIDI_WHEEL},
-       { DIV_GAIN_COARSE,      "DIVCOARSEGAIN",        MIDI_KNOB|MIDI_WHEEL},
-       { DIV_PHASE_COARSE,     "DIVCOARSEPHASE",       MIDI_KNOB|MIDI_WHEEL},
-       { DIV_GAIN_FINE,        "DIVFINEGAIN",  MIDI_KNOB|MIDI_WHEEL},
-       { DIV_PHASE_FINE,       "DIVFINEPHASE", MIDI_KNOB|MIDI_WHEEL},
-       { DIV_GAIN,             "DIVGAIN",      MIDI_KNOB|MIDI_WHEEL},
-       { DIV_PHASE,            "DIVPHASE",     MIDI_KNOB|MIDI_WHEEL},
-       { DIV,                  "DIVTOGGLE",    MIDI_KEY},
-       { DUPLEX,               "DUP",          MIDI_KEY},
-        { FILTER_MINUS,        "FILTERDOWN",   MIDI_KEY},
-        { FILTER_PLUS,         "FILTERUP",     MIDI_KEY},
-       { MENU_FILTER,          "MENU_FILTER",  MIDI_KEY},
-       { MENU_MODE,            "MENU_MODE",    MIDI_KEY},
-       { LOCK,                 "LOCK",         MIDI_KEY},
-        { MIC_GAIN,            "MICGAIN",      MIDI_KNOB|MIDI_WHEEL},
-       { MODE_MINUS,           "MODEDOWN",     MIDI_KEY|MIDI_KNOB|MIDI_WHEEL},
-       { MODE_PLUS,            "MODEUP",       MIDI_KEY|MIDI_KNOB|MIDI_WHEEL},
-        { MOX,                         "MOX",  MIDI_KEY},
-       { MUTE,                 "MUTE", MIDI_KEY},
-       { NB,                   "NOISEBLANKER", MIDI_KEY},
-       { NR,                   "NOISEREDUCTION",       MIDI_KEY},
-       { NUMPAD_0,             "NUMPAD0",      MIDI_KEY},
-       { NUMPAD_1,             "NUMPAD1",      MIDI_KEY},
-       { NUMPAD_2,             "NUMPAD2",      MIDI_KEY},
-       { NUMPAD_3,             "NUMPAD3",      MIDI_KEY},
-       { NUMPAD_4,             "NUMPAD4",      MIDI_KEY},
-       { NUMPAD_5,             "NUMPAD5",      MIDI_KEY},
-       { NUMPAD_6,             "NUMPAD6",      MIDI_KEY},
-       { NUMPAD_7,             "NUMPAD7",      MIDI_KEY},
-       { NUMPAD_8,             "NUMPAD8",      MIDI_KEY},
-       { NUMPAD_9,             "NUMPAD9",      MIDI_KEY},
-       { NUMPAD_CL,            "NUMPADCL",     MIDI_KEY},
-       { NUMPAD_ENTER,         "NUMPADENTER",  MIDI_KEY},
-        { PAN,                 "PAN",  MIDI_KNOB|MIDI_WHEEL},
-        { PANADAPTER_HIGH,             "PANHIGH",      MIDI_KNOB|MIDI_WHEEL},
-        { PANADAPTER_LOW,              "PANLOW",       MIDI_KNOB|MIDI_WHEEL},
-        { PREAMP,              "PREAMP",       MIDI_KEY},
-       { PS,                   "PURESIGNAL",   MIDI_KEY},
-       { RF_GAIN,              "RFGAIN",       MIDI_KNOB|MIDI_WHEEL},
-        { DRIVE,               "RFPOWER",      MIDI_KNOB|MIDI_WHEEL},
-       { RIT_CLEAR,            "RITCLEAR",     MIDI_KEY},
-       { RIT_STEP,             "RITSTEP",      MIDI_KNOB|MIDI_WHEEL},
-        { RIT_ENABLE,          "RITTOGGLE",    MIDI_KEY},
-        { RIT,                 "RITVAL",       MIDI_KNOB|MIDI_WHEEL},
-        { SAT,                 "SAT",  MIDI_KEY},
-        { SNB,                         "SNB",  MIDI_KEY},
-       { SPLIT,                "SPLIT",        MIDI_KEY},
-       { SWAP_RX,              "SWAPRX",       MIDI_KEY},
-       { A_SWAP_B,             "SWAPVFO",      MIDI_KEY},
-        { TUNE,                "TUNE", MIDI_KEY},
-        { VFOA,                "VFOA", MIDI_WHEEL},
-        { VFOB,                "VFOB", MIDI_WHEEL},
-       { VFO_STEP_MINUS,       "VFOSTEPDOWN",  MIDI_KEY},
-       { VFO_STEP_PLUS,        "VFOSTEPUP",    MIDI_KEY},
-       { VOX,                  "VOX",  MIDI_KEY},
-       { VOXLEVEL,             "VOXLEVEL",     MIDI_KNOB|MIDI_WHEEL},
-       { XIT_CLEAR,            "XITCLEAR",     MIDI_KEY},
-       { XIT,                  "XITVAL",       MIDI_KNOB|MIDI_WHEEL},
-       { ZOOM,                 "ZOOM", MIDI_KNOB|MIDI_WHEEL},
-       { ZOOM_MINUS,           "ZOOMDOWN",     MIDI_KEY},
-       { ZOOM_PLUS,            "ZOOMUP",       MIDI_KEY},
-        { NO_ACTION,   "NONE", TYPE_NONE}
+// THIS TABLE IS ONLY USED IN keyword2action()
+//
+typedef struct _old_mapping {
+  enum ACTION action;
+  const char *str;
+} OLD_MAPPING;
+
+
+static OLD_MAPPING OLD_Mapping[] = {
+       { NO_ACTION,            "NONE"                  },
+       { A_TO_B,               "A2B"                   },
+        { AF_GAIN,             "AFGAIN"                },
+       { AGC,                  "AGCATTACK"             },
+        { AGC_GAIN,            "AGCVAL"                },
+        { ANF,                 "ANF"                   },
+        { ATTENUATION,                 "ATT"                   },
+       { B_TO_A,               "B2A"                   },
+       { BAND_10,              "BAND10"                },
+        { BAND_12,             "BAND12"                },
+        { BAND_1240,           "BAND1240"              },
+        { BAND_144,            "BAND144"               },
+        { BAND_15,             "BAND15"                },
+        { BAND_160,            "BAND160"               },
+        { BAND_17,             "BAND17"                },
+        { BAND_20,             "BAND20"                },
+        { BAND_220,            "BAND220"               },
+        { BAND_2300,           "BAND2300"              },
+        { BAND_30,             "BAND30"                },
+        { BAND_3400,           "BAND3400"              },
+        { BAND_40,             "BAND40"                },
+        { BAND_430,            "BAND430"               },
+        { BAND_6,              "BAND6"                 },
+        { BAND_60,             "BAND60"                },
+        { BAND_70,             "BAND70"                },
+        { BAND_80,             "BAND80"                },
+        { BAND_902,            "BAND902"               },
+        { BAND_AIR,            "BANDAIR"               },
+        { BAND_MINUS,          "BANDDOWN"              },
+        { BAND_GEN,            "BANDGEN"               },
+        { BAND_PLUS,           "BANDUP"                },
+        { BAND_WWV,            "BANDWWV"               },
+        { COMPRESSION,         "COMPRESS"              },
+       { CTUN,                 "CTUN"                  },
+       { VFO,                  "CURRVFO"               },
+       { CW_LEFT,              "CWL"                   },
+       { CW_KEYER,             "CW(Keyer)"             },
+       { CW_RIGHT,             "CWR"                   },
+       { CW_SPEED,             "CWSPEED"               },
+       { DIV_GAIN_COARSE,      "DIVCOARSEGAIN"         },
+       { DIV_PHASE_COARSE,     "DIVCOARSEPHASE"        },
+       { DIV_GAIN_FINE,        "DIVFINEGAIN"           },
+       { DIV_PHASE_FINE,       "DIVFINEPHASE"          },
+       { DIV_GAIN,             "DIVGAIN"               },
+       { DIV_PHASE,            "DIVPHASE"              },
+       { DIV,                  "DIVTOGGLE"             },
+       { DUPLEX,               "DUP"                   },
+        { FILTER_MINUS,        "FILTERDOWN"            },
+        { FILTER_PLUS,         "FILTERUP"              },
+       { MENU_FILTER,          "MENU_FILTER"           },
+       { MENU_MODE,            "MENU_MODE"             },
+       { LOCK,                 "LOCK"                  },
+        { MIC_GAIN,            "MICGAIN"               },
+       { MODE_MINUS,           "MODEDOWN"              },
+       { MODE_PLUS,            "MODEUP"                },
+        { MOX,                         "MOX"                   },
+       { MUTE,                 "MUTE"                  },
+       { NB,                   "NOISEBLANKER"          },
+       { NR,                   "NOISEREDUCTION"        },
+       { NUMPAD_0,             "NUMPAD0"               },
+       { NUMPAD_1,             "NUMPAD1"               },
+       { NUMPAD_2,             "NUMPAD2"               },
+       { NUMPAD_3,             "NUMPAD3"               },
+       { NUMPAD_4,             "NUMPAD4"               },
+       { NUMPAD_5,             "NUMPAD5"               },
+       { NUMPAD_6,             "NUMPAD6"               },
+       { NUMPAD_7,             "NUMPAD7"               },
+       { NUMPAD_8,             "NUMPAD8"               },
+       { NUMPAD_9,             "NUMPAD9"               },
+       { NUMPAD_CL,            "NUMPADCL"              },
+       { NUMPAD_ENTER,         "NUMPADENTER"           },
+        { PAN,                 "PAN"                   },
+        { PANADAPTER_HIGH,             "PANHIGH"               },
+        { PANADAPTER_LOW,              "PANLOW"                },
+        { PREAMP,              "PREAMP"                },
+       { PTT,                  "PTT"                   },
+       { PS,                   "PURESIGNAL"            },
+       { RF_GAIN,              "RFGAIN"                },
+        { DRIVE,               "RFPOWER"               },
+       { RIT_CLEAR,            "RITCLEAR"              },
+       { RIT_STEP,             "RITSTEP"               },
+        { RIT_ENABLE,          "RITTOGGLE"             },
+        { RIT,                         "RITVAL"                },
+        { SAT,                 "SAT"                   },
+        { SNB,                         "SNB"                   },
+       { SPLIT,                "SPLIT"                 },
+       { SWAP_RX,              "SWAPRX"                },
+       { A_SWAP_B,             "SWAPVFO"               },
+        { TUNE,                "TUNE"                  },
+        { VFOA,                "VFOA"                  },
+        { VFOB,                "VFOB"                  },
+       { VFO_STEP_MINUS,       "VFOSTEPDOWN"           },
+       { VFO_STEP_PLUS,        "VFOSTEPUP"             },
+       { VOX,                  "VOX"                   },
+       { VOXLEVEL,             "VOXLEVEL"              },
+       { XIT_CLEAR,            "XITCLEAR"              },
+       { XIT,                  "XITVAL"                },
+       { ZOOM,                 "ZOOM"                  },
+       { ZOOM_MINUS,           "ZOOMDOWN"              },
+       { ZOOM_PLUS,            "ZOOMUP"                },
+        { NO_ACTION,           "NONE"                  }
 };
 
 /*
@@ -296,8 +308,8 @@ OLD_ACTION_TABLE OLD_ActionTable[] = {
 static int keyword2action(char *s) {
     int i=0;
 
-    for (i=0; i< (sizeof(OLD_ActionTable) / sizeof(OLD_ActionTable[0])); i++) {
-       if (!strcmp(s, OLD_ActionTable[i].str)) return OLD_ActionTable[i].action;
+    for (i=0; i< (sizeof(OLD_Mapping) / sizeof(OLD_Mapping[0])); i++) {
+       if (!strcmp(s, OLD_Mapping[i].str)) return OLD_Mapping[i].action;
     }
     fprintf(stderr,"MIDI: action keyword %s NOT FOUND.\n", s);
     return NO_ACTION;