Fixes for filter parameter change.

pull/15/head^2
Holger Wirtz 5 years ago
parent 1128f1c8ae
commit 308335d2b0
  1. 38
      MicroDexed.ino
  2. 14
      UI.hpp
  3. 6
      config.h

@ -419,8 +419,8 @@ void setup()
soften_filter_res[instance_id].init(configuration.dexed[instance_id].filter_resonance); soften_filter_res[instance_id].init(configuration.dexed[instance_id].filter_resonance);
soften_filter_cut[instance_id].init(configuration.dexed[instance_id].filter_cutoff); soften_filter_cut[instance_id].init(configuration.dexed[instance_id].filter_cutoff);
MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].loudness, LOUDNESS_MIN, LOUDNESS_MAX, 0.0, 1.0); MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].loudness, LOUDNESS_MIN, LOUDNESS_MAX, 0.0, 1.0);
MicroDexed[instance_id]->fx.Reso = mapfloat(FILTER_RESONANCE_MAX - configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0); MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0);
MicroDexed[instance_id]->fx.Cutoff = mapfloat(FILTER_CUTOFF_MAX - configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0); MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
MicroDexed[instance_id]->doRefreshVoice(); MicroDexed[instance_id]->doRefreshVoice();
} }
@ -527,38 +527,40 @@ void loop()
// check for value changes and unused voices // check for value changes and unused voices
soften_volume.tick(); soften_volume.tick();
for (uint8_t i = 0; i < NUM_DEXED; i++) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{ {
active_voices = MicroDexed[i]->getNumNotesPlaying(); active_voices = MicroDexed[instance_id]->getNumNotesPlaying();
soften_filter_res[i].tick(); soften_filter_res[instance_id].tick();
soften_filter_cut[i].tick(); soften_filter_cut[instance_id].tick();
if (soften_filter_res[i].running()) if (soften_filter_res[instance_id].running())
{ {
// soften filter resonance value // soften filter resonance value
MicroDexed[i]->fx.Reso = (FILTER_RESONANCE_MAX - soften_filter_res[i].value()) / 100.0; configuration.dexed[instance_id].filter_resonance=soften_filter_res[instance_id].value();
MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Filter-Resonance: ")); Serial.print(F("Filter-Resonance: "));
Serial.print(MicroDexed[i]->fx.Reso, 5); Serial.print(MicroDexed[instance_id]->fx.Reso, 5);
Serial.print(F(" Filter-Resonance step: ")); Serial.print(F(" Filter-Resonance step: "));
Serial.print(soften_filter_res[i].steps()); Serial.print(soften_filter_res[instance_id].steps());
Serial.print(F(" Filter-Resonance diff: ")); Serial.print(F(" Filter-Resonance diff: "));
Serial.println(soften_filter_res[i].diff(), 5); Serial.println(soften_filter_res[instance_id].diff(), 5);
#endif #endif
} }
// soften filter cutoff value // soften filter cutoff value
if (soften_filter_cut[i].running()) if (soften_filter_cut[instance_id].running())
{ {
MicroDexed[i]->fx.Cutoff = (FILTER_CUTOFF_MAX - soften_filter_cut[i].value()) / 100.0; configuration.dexed[instance_id].filter_cutoff=soften_filter_cut[instance_id].value();
MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Filter-Cutoff: ")); Serial.print(F("Filter-Cutoff: "));
Serial.print(MicroDexed[i]->fx.Cutoff, 5); Serial.print(MicroDexed[instance_id]->fx.Cutoff, 5);
Serial.print(F(" Filter-Cutoff step: ")); Serial.print(F(" Filter-Cutoff step: "));
Serial.print(soften_filter_cut[i].steps()); Serial.print(soften_filter_cut[instance_id].steps());
Serial.print(F(" Filter-Cutoff diff: ")); Serial.print(F(" Filter-Cutoff diff: "));
Serial.println(soften_filter_cut[i].diff(), 5); Serial.println(soften_filter_cut[instance_id].diff(), 5);
#endif #endif
} }
} }
@ -679,12 +681,12 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
case 103: // CC 103: filter resonance case 103: // CC 103: filter resonance
configuration.dexed[instance_id].filter_resonance = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); configuration.dexed[instance_id].filter_resonance = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX);
//MicroDexed[instance_id]->fx.Reso = (100 - configuration.dexed[instance_id].filter_resonance) / 100.0; //MicroDexed[instance_id]->fx.Reso = (100 - configuration.dexed[instance_id].filter_resonance) / 100.0;
soften_filter_res[instance_id].update(soften_filter_res[instance_id].value() + configuration.dexed[instance_id].filter_resonance, SOFTEN_VALUE_CHANGE_STEPS); soften_filter_res[instance_id].update(configuration.dexed[instance_id].filter_resonance, SOFTEN_VALUE_CHANGE_STEPS);
break; break;
case 104: // CC 104: filter cutoff case 104: // CC 104: filter cutoff
configuration.dexed[instance_id].filter_cutoff = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); configuration.dexed[instance_id].filter_cutoff = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX);
//MicroDexed[instance_id]->fx.Cutoff = (100 - configuration.dexed[instance_id].filter_cutoff) / 100.0; //MicroDexed[instance_id]->fx.Cutoff = (100 - configuration.dexed[instance_id].filter_cutoff) / 100.0;
soften_filter_cut[instance_id].update(soften_filter_cut[instance_id].value() + configuration.dexed[instance_id].filter_cutoff, SOFTEN_VALUE_CHANGE_STEPS); soften_filter_cut[instance_id].update(configuration.dexed[instance_id].filter_cutoff, SOFTEN_VALUE_CHANGE_STEPS);
break; break;
case 105: // CC 105: delay time case 105: // CC 105: delay time
configuration.delay_time = map(inValue, 0, 0x7f, DELAY_TIME_MIN, DELAY_TIME_MAX); configuration.delay_time = map(inValue, 0, 0x7f, DELAY_TIME_MIN, DELAY_TIME_MAX);

@ -1456,15 +1456,10 @@ void UI_func_filter_cutoff(uint8_t param)
} }
} }
soften_filter_cut[instance_id].update(constrain(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX), SOFTEN_VALUE_CHANGE_STEPS);
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.dexed[instance_id].filter_cutoff, 3, true, true, false); lcd_display_int(configuration.dexed[instance_id].filter_cutoff, 3, true, true, false);
Serial.print(LCDML.FUNC_getID(), DEC);
Serial.print(instance_id, DEC);
Serial.print(" value: ");
Serial.println(configuration.dexed[instance_id].filter_cutoff / 100.0, 3);
//MicroDexed[instance_id]->fx.Cutoff = (100 - configuration.dexed[instance_id].filter_cutoff) / 100.0;
soften_filter_cut[instance_id].update(soften_filter_cut[instance_id].value() + configuration.dexed[instance_id].filter_cutoff, SOFTEN_VALUE_CHANGE_STEPS);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1509,11 +1504,10 @@ void UI_func_filter_resonance(uint8_t param)
} }
} }
soften_filter_res[instance_id].update(constrain(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX), SOFTEN_VALUE_CHANGE_STEPS);
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.dexed[instance_id].filter_resonance, 3, true, true, false); lcd_display_int(configuration.dexed[instance_id].filter_resonance, 3, true, true, false);
//MicroDexed[instance_id]->fx.Reso = (100 - configuration.dexed[instance_id].filter_resonance) / 100.0;
soften_filter_res[instance_id].update(soften_filter_res[instance_id].value() + configuration.dexed[instance_id].filter_resonance--, SOFTEN_VALUE_CHANGE_STEPS);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********

@ -324,13 +324,11 @@ enum { DEXED, REVERB, DELAY, CHORUS };
#define FILTER_CUTOFF_MIN 0 #define FILTER_CUTOFF_MIN 0
#define FILTER_CUTOFF_MAX 100 #define FILTER_CUTOFF_MAX 100
#define FILTER_CUTOFF_DEFAULT 100 #define FILTER_CUTOFF_DEFAULT 0
#define FILTER_CUTOFF_ENC_STEPS 1
#define FILTER_RESONANCE_MIN 0 #define FILTER_RESONANCE_MIN 0
#define FILTER_RESONANCE_MAX 100 #define FILTER_RESONANCE_MAX 100
#define FILTER_RESONANCE_DEFAULT 100 #define FILTER_RESONANCE_DEFAULT 0
#define FILTER_RESONANCE_ENC_STEPS 1
#define LOUDNESS_MIN 0 #define LOUDNESS_MIN 0
#define LOUDNESS_MAX 100 #define LOUDNESS_MAX 100

Loading…
Cancel
Save