From: c vw Date: Mon, 4 Nov 2019 15:35:21 +0000 (+0100) Subject: MIDI_CTUN: use function in ext.c; FilterUP/Down moves in other direction X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/(%5B%5E?a=commitdiff_plain;h=c5e06614126dcce0067f1f825658b538544818da;p=pihpsdr.git MIDI_CTUN: use function in ext.c; FilterUP/Down moves in other direction --- diff --git a/midi3.c b/midi3.c index 790ce82..47569ab 100644 --- a/midi3.c +++ b/midi3.c @@ -164,30 +164,25 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) { case MIDI_CTUN: // only key supported // toggle CTUN if (type == MIDI_KEY) { - new=active_receiver->id; - if(!vfo[new].ctun) { - vfo[new].ctun=1; - vfo[new].offset=0; - } else { - vfo[new].ctun=0; - } - vfo[new].ctun_frequency=vfo[new].frequency; - set_offset(active_receiver,vfo[new].offset); - g_idle_add(ext_vfo_update, NULL); + g_idle_add(ext_ctun_update, NULL); } break; case FILTER_DOWN: case FILTER_UP: + // + // In filter.c, the filters are sorted such that the widest one comes first + // Therefore let FILTER_UP move down. + // switch (type) { case MIDI_KEY: - new=(action == FILTER_UP) ? 1 : -1; + new=(action == FILTER_UP) ? -1 : 1; break; case MIDI_WHEEL: - new=val > 0 ? 1 : -1; + new=val > 0 ? -1 : 1; break; case MIDI_KNOB: - // cycle through all the filters - new = ((FILTERS-1) * val) / 100 - vfo[active_receiver->id].filter; + // cycle through all the filters: val=100 maps to filter #0 + new = ((FILTERS-1) * (val-100)) / 100 - vfo[active_receiver->id].filter; break; default: // do not change filter setting