|
|
|
@ -292,57 +292,60 @@ void handle_ui(void) |
|
|
|
|
switch (ui_main_state) |
|
|
|
|
{ |
|
|
|
|
case UI_MAIN_FILTER_FRQ: |
|
|
|
|
/* if (enc[i].read() <= 0)
|
|
|
|
|
if (enc[i].read() <= 0) |
|
|
|
|
enc[i].write(0); |
|
|
|
|
else if (enc[i].read() > ENC_FILTER_FRQ_STEPS) |
|
|
|
|
enc[i].write(ENC_FILTER_FRQ_STEPS); |
|
|
|
|
effect_filter_frq = enc[i].read(); |
|
|
|
|
if (effect_filter_frq == ENC_FILTER_FRQ_STEPS) |
|
|
|
|
{ |
|
|
|
|
/*
|
|
|
|
|
if (effect_filter_frq == ENC_FILTER_FRQ_STEPS) |
|
|
|
|
{ |
|
|
|
|
// turn "off" filter
|
|
|
|
|
mixer1.gain(0, 0.0); // filtered signal off
|
|
|
|
|
mixer1.gain(3, 1.0); // original signal on
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// turn "on" filter
|
|
|
|
|
mixer1.gain(0, 1.0); // filtered signal on
|
|
|
|
|
mixer1.gain(3, 0.0); // original signal off
|
|
|
|
|
} |
|
|
|
|
filter1.frequency(EXP_FUNC((float)map(effect_filter_frq, 0, ENC_FILTER_FRQ_STEPS, 0, 1024) / 150.0) * 10.0 + 80.0); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Setting filter frequency to: ")); |
|
|
|
|
Serial.println(EXP_FUNC((float)map(effect_filter_frq, 0, ENC_FILTER_FRQ_STEPS, 0, 1024) / 150.0) * 10.0 + 80.0, DEC); |
|
|
|
|
#endif |
|
|
|
|
*/ |
|
|
|
|
} |
|
|
|
|
filter1.frequency(EXP_FUNC((float)map(effect_filter_frq, 0, ENC_FILTER_FRQ_STEPS, 0, 1024) / 150.0) * 10.0 + 80.0); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Setting filter frequency to: ")); |
|
|
|
|
Serial.println(EXP_FUNC((float)map(effect_filter_frq, 0, ENC_FILTER_FRQ_STEPS, 0, 1024) / 150.0) * 10.0 + 80.0, DEC); |
|
|
|
|
#endif |
|
|
|
|
*/ |
|
|
|
|
break; |
|
|
|
|
case UI_MAIN_FILTER_RES: |
|
|
|
|
/* if (enc[i].read() <= 0)
|
|
|
|
|
if (enc[i].read() <= 0) |
|
|
|
|
enc[i].write(0); |
|
|
|
|
else if (enc[i].read() > ENC_FILTER_RES_STEPS) |
|
|
|
|
enc[i].write(ENC_FILTER_RES_STEPS); |
|
|
|
|
effect_filter_resonance = enc[i].read(); |
|
|
|
|
//filter1.resonance(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0));
|
|
|
|
|
filter1.resonance(EXP_FUNC(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)) * 0.044 + 0.61); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Setting filter resonance to: ")); |
|
|
|
|
Serial.println(EXP_FUNC(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)) * 0.044 + 0.61, 2); |
|
|
|
|
#endif |
|
|
|
|
*/ |
|
|
|
|
/*
|
|
|
|
|
//filter1.resonance(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0));
|
|
|
|
|
filter1.resonance(EXP_FUNC(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)) * 0.044 + 0.61); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Setting filter resonance to: ")); |
|
|
|
|
Serial.println(EXP_FUNC(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)) * 0.044 + 0.61, 2); |
|
|
|
|
#endif |
|
|
|
|
*/ |
|
|
|
|
break; |
|
|
|
|
case UI_MAIN_FILTER_OCT: |
|
|
|
|
/* if (enc[i].read() <= 0)
|
|
|
|
|
if (enc[i].read() <= 0) |
|
|
|
|
enc[i].write(0); |
|
|
|
|
else if (enc[i].read() > ENC_FILTER_OCT_STEPS) |
|
|
|
|
enc[i].write(ENC_FILTER_OCT_STEPS); |
|
|
|
|
effect_filter_octave = enc[i].read(); |
|
|
|
|
filter1.octaveControl(mapfloat(effect_filter_octave, 0, ENC_FILTER_OCT_STEPS, 0.0, 7.0)); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Setting filter octave control to: ")); |
|
|
|
|
Serial.println(mapfloat(effect_filter_octave, 0, ENC_FILTER_OCT_STEPS, 0.0, 7.0), 2); |
|
|
|
|
#endif |
|
|
|
|
*/ |
|
|
|
|
/*
|
|
|
|
|
filter1.octaveControl(mapfloat(effect_filter_octave, 0, ENC_FILTER_OCT_STEPS, 0.0, 7.0)); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Setting filter octave control to: ")); |
|
|
|
|
Serial.println(mapfloat(effect_filter_octave, 0, ENC_FILTER_OCT_STEPS, 0.0, 7.0), 2); |
|
|
|
|
#endif |
|
|
|
|
*/ |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
ui_show_effects_filter(); |
|
|
|
|