Added mixer2 for controlling whole delay volume.

Replaced delay-sync with delay-volume in UI.
pull/4/head
Holger Wirtz 6 years ago
parent edcb352a6c
commit 298ae13c8c
  1. 7
      MicroDexed.ino
  2. 32
      UI.cpp
  3. 4
      UI.h
  4. 1
      config.h

@ -113,6 +113,7 @@ uint8_t effect_filter_resonance = (0.07 * ENC_FILTER_RES_STEPS / 4.3) + 0.5;
uint8_t effect_filter_octave = (1.0 * ENC_FILTER_RES_STEPS / 8.0) + 0.5;
uint8_t effect_delay_time = 0;
uint8_t effect_delay_feedback = 0;
uint8_t effect_delay_volume = 0;
bool effect_delay_sync = 0;
#ifdef MASTER_KEY_MIDI
@ -236,11 +237,11 @@ void setup()
filter1.resonance(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0));
filter1.octaveControl(mapfloat(effect_filter_octave, 0, ENC_FILTER_OCT_STEPS, 0.0, 7.0));
delay1.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME));
// mixer1 is the feedback-adding mixer, mixer2 the whole delay (with/without feedback) mixer
mixer1.gain(0, 1.0); // original signal
mixer1.gain(1, mapfloat(effect_delay_feedback, 0, 99, 0.0, 1.0)); // delay tap1 signal (feedback loop)
mixer2.gain(0, 1.0); // original signal
mixer2.gain(1, 1.0); // delay tap1
mixer1.gain(1, mapfloat(effect_delay_feedback, 0, 99, 0.0, 1.0)); // delay tap signal (feedback loop)
// fixed filter options
mixer2.gain(1, mapfloat(effect_delay_volume, 0, 99, 0.0, 1.0)); // delay tap1 signal (with added feedback)
// load default SYSEX data
load_sysex(bank, voice);

@ -179,15 +179,15 @@ void handle_ui(void)
enc_val[i] = enc[i].read();
ui_show_effects_delay();
break;
case UI_MAIN_DELAY_SYNC:
case UI_MAIN_DELAY_VOLUME:
ui_main_state = UI_MAIN_DELAY_TIME;
enc[i].write(effect_delay_time);
enc_val[i] = enc[i].read();
ui_show_effects_delay();
break;
case UI_MAIN_DELAY_FEEDBACK:
ui_main_state = UI_MAIN_DELAY_SYNC;
enc[i].write(effect_delay_sync);
ui_main_state = UI_MAIN_DELAY_VOLUME;
enc[i].write(effect_delay_volume);
enc_val[i] = enc[i].read();
ui_show_effects_delay();
break;
@ -351,16 +351,16 @@ void handle_ui(void)
Serial.println(mapfloat(float(effect_delay_feedback), 0, ENC_DELAY_FB_STEPS, 0.0, 1.0));
#endif
break;
case UI_MAIN_DELAY_SYNC:
case UI_MAIN_DELAY_VOLUME:
if (enc[i].read() <= 0)
enc[i].write(0);
else if (enc[i].read() >= 1)
enc[i].write(1);
effect_delay_sync = enc[i].read();
// Nothing to do here
else if (enc[i].read() > ENC_DELAY_VOLUME_STEPS)
enc[i].write(ENC_DELAY_VOLUME_STEPS);
effect_delay_volume = enc[i].read();
mixer2.gain(1, mapfloat(effect_delay_volume, 0, 99, 0.0, 1.0)); // delay tap1 signal (with added feedback)
#ifdef DEBUG
Serial.print(F("Setting delay sync to: "));
Serial.println(effect_delay_sync);
Serial.print(F("Setting delay volume to: "));
Serial.println(effect_delay_volume);
#endif
break;
}
@ -529,16 +529,16 @@ void ui_show_effects_delay(void)
if (ui_state != UI_EFFECTS_DELAY)
{
lcd.clear();
lcd.show(0, 0, 3, "Dly");
lcd.show(0, 0, 5, "Delay");
lcd.show(0, 6, 2, "T:");
lcd.show(0, 14, 2, "ms");
lcd.show(1, 0, 3, "FB:");
lcd.show(1, 8, 5, "Sync:");
lcd.show(1, 8, 5, "Vol:");
}
lcd.show(0, 9, 4, map(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0, 1200));
lcd.show(1, 4, 2, map(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0, 99));
lcd.show(1, 14, 1, effect_delay_sync);
lcd.show(1, 13, 2, map(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0, 99));
if (ui_main_state == UI_MAIN_DELAY_TIME)
{
@ -562,14 +562,14 @@ void ui_show_effects_delay(void)
lcd.show(1, 6, 1, " ");
}
if (ui_main_state == UI_MAIN_DELAY_SYNC)
if (ui_main_state == UI_MAIN_DELAY_VOLUME)
{
lcd.show(1, 13, 1, "[");
lcd.show(1, 12, 1, "[");
lcd.show(1, 15, 1, "]");
}
else
{
lcd.show(1, 13, 1, " ");
lcd.show(1, 12, 1, " ");
lcd.show(1, 15, 1, " ");
}

@ -57,10 +57,12 @@ extern uint8_t effect_filter_resonance;
extern uint8_t effect_filter_octave;
extern uint8_t effect_delay_time;
extern uint8_t effect_delay_feedback;
extern uint8_t effect_delay_volume;
extern bool effect_delay_sync;
extern AudioFilterStateVariable filter1;
extern AudioEffectDelay delay1;
extern AudioMixer4 mixer1;
extern AudioMixer4 mixer2;
void handle_ui(void);
void ui_show_main(void);
@ -71,7 +73,7 @@ void ui_show_effects_delay(void);
float mapfloat(float val, float in_min, float in_max, float out_min, float out_max);
enum ui_states {UI_MAIN, UI_VOLUME, UI_MIDICHANNEL, UI_EFFECTS_FILTER, UI_EFFECTS_DELAY};
enum ui_main_states {UI_MAIN_BANK, UI_MAIN_VOICE, UI_MAIN_BANK_SELECTED, UI_MAIN_VOICE_SELECTED, UI_MAIN_FILTER_FRQ, UI_MAIN_FILTER_RES, UI_MAIN_FILTER_OCT, UI_MAIN_DELAY_TIME, UI_MAIN_DELAY_FEEDBACK, UI_MAIN_DELAY_VOLUME, UI_MAIN_DELAY_SYNC};
enum ui_main_states {UI_MAIN_BANK, UI_MAIN_VOICE, UI_MAIN_BANK_SELECTED, UI_MAIN_VOICE_SELECTED, UI_MAIN_FILTER_FRQ, UI_MAIN_FILTER_RES, UI_MAIN_FILTER_OCT, UI_MAIN_DELAY_TIME, UI_MAIN_DELAY_FEEDBACK, UI_MAIN_DELAY_VOLUME};
class MyEncoder : public Encoder
{

@ -110,6 +110,7 @@
#define ENC_FILTER_OCT_STEPS 27
#define ENC_DELAY_TIME_STEPS 50
#define ENC_DELAY_FB_STEPS 35
#define ENC_DELAY_VOLUME_STEPS 50
#define TIMER_UI_HANDLING_MS 100
#define NUM_ENCODER 2
#define ENC_L_PIN_A 3

Loading…
Cancel
Save