Browse Source

Fix MIDI module learned note/CC bugs

tags/v2.1.0
Andrew Belt 2 years ago
parent
commit
d795561e97
3 changed files with 11 additions and 4 deletions
  1. +3
    -0
      src/core/CV_MIDICC.cpp
  2. +7
    -3
      src/core/MIDICC_CV.cpp
  3. +1
    -1
      src/core/plugin.hpp

+ 3
- 0
src/core/CV_MIDICC.cpp View File

@@ -86,6 +86,9 @@ struct CV_MIDICC : Module {
midiOutput.setFrame(args.frame); midiOutput.setFrame(args.frame);


for (int id = 0; id < 16; id++) { for (int id = 0; id < 16; id++) {
if (learnedCcs[id] < 0)
continue;

uint8_t value = (uint8_t) clamp(std::round(inputs[CC_INPUTS + id].getVoltage() / 10.f * 127), 0.f, 127.f); uint8_t value = (uint8_t) clamp(std::round(inputs[CC_INPUTS + id].getVoltage() / 10.f * 127), 0.f, 127.f);
midiOutput.setValue(value, learnedCcs[id]); midiOutput.setValue(value, learnedCcs[id]);
} }


+ 7
- 3
src/core/MIDICC_CV.cpp View File

@@ -50,12 +50,12 @@ struct MIDICC_CV : Module {
} }


void onReset() override { void onReset() override {
for (int8_t cc = 0; cc < 128; cc++) {
for (uint8_t cc = 0; cc < 128; cc++) {
for (int c = 0; c < 16; c++) { for (int c = 0; c < 16; c++) {
ccValues[cc][c] = 0; ccValues[cc][c] = 0;
} }
} }
for (int8_t cc = 0; cc < 32; cc++) {
for (uint8_t cc = 0; cc < 32; cc++) {
for (int c = 0; c < 16; c++) { for (int c = 0; c < 16; c++) {
msbValues[cc][c] = 0; msbValues[cc][c] = 0;
} }
@@ -83,7 +83,11 @@ struct MIDICC_CV : Module {
continue; continue;
outputs[CC_OUTPUT + id].setChannels(channels); outputs[CC_OUTPUT + id].setChannels(channels);


int cc = learnedCcs[id];
int8_t cc = learnedCcs[id];
if (cc < 0) {
outputs[CC_OUTPUT + id].clearVoltages();
continue;
}


for (int c = 0; c < channels; c++) { for (int c = 0; c < channels; c++) {
int16_t cellValue = int16_t(ccValues[cc][c]) * 128; int16_t cellValue = int16_t(ccValues[cc][c]) * 128;


+ 1
- 1
src/core/plugin.hpp View File

@@ -147,7 +147,7 @@ template <class TModule>
struct NoteChoice : LedDisplayChoice { struct NoteChoice : LedDisplayChoice {
TModule* module; TModule* module;
int id; int id;
uint8_t focusNote;
int focusNote;


NoteChoice() { NoteChoice() {
box.size.y = mm2px(6.666); box.size.y = mm2px(6.666);


Loading…
Cancel
Save