Added chorus, delay and reverb level.

Added beter calculation for master_mixer.
There are still overload problems...
pull/32/head
Holger Wirtz 5 years ago
parent 0d1b9bf51b
commit c8afc7fa09
  1. 132
      MicroDexed.ino
  2. 253
      UI.hpp
  3. 21
      config.h

@ -52,7 +52,6 @@ AudioSynthWaveform chorus_modulator;
AudioAmplifier modchorus_inverter;
// FX chain left
AudioMixer4 chorus_send_mixer_l;
AudioMixer4 delay_send_mixer_l;
AudioMixer4 delay_fb_mixer_l;
AudioEffectDelay delay_l;
@ -60,6 +59,7 @@ AudioConnection patchCord1(delay_send_mixer_l, 0, delay_fb_mixer_l, 0)
AudioConnection patchCord2(delay_fb_mixer_l, delay_l);
AudioConnection patchCord3(delay_l, 0, delay_fb_mixer_l, 1); // feedback-loop
AudioConnection patchCord4(delay_fb_mixer_l, 0, master_mixer_l, DELAY);
AudioMixer4 chorus_send_mixer_l;
AudioEffectModulatedDelay modchorus_l;
AudioConnection patchCord5(chorus_modulator, 0, modchorus_l, 1);
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
@ -79,7 +79,6 @@ AudioConnection patchCord12(freeverb_l, 0, master_mixer_r, REVERB);
#endif
// FX chain right
AudioMixer4 chorus_send_mixer_r;
AudioMixer4 delay_send_mixer_r;
AudioMixer4 delay_fb_mixer_r;
AudioEffectDelay delay_r;
@ -87,6 +86,7 @@ AudioConnection patchCord13(delay_send_mixer_r, 0, delay_fb_mixer_r, 0
AudioConnection patchCord14(delay_fb_mixer_r, delay_r);
AudioConnection patchCord15(delay_r, 0, delay_fb_mixer_r, 1); // feedback-loop
AudioConnection patchCord16(delay_fb_mixer_r, 0, master_mixer_r, DELAY);
AudioMixer4 chorus_send_mixer_r;
AudioEffectModulatedDelay modchorus_r;
AudioConnection patchCord17(chorus_modulator, 0, modchorus_r, 1);
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
@ -104,8 +104,8 @@ AudioConnection patchCord22(freeverb_r, 0, master_mixer_r, REVERB);
#endif
// FX chain tail
AudioMixer4 microdexed_mixer_r;
AudioMixer4 microdexed_mixer_l;
AudioMixer4 dexed_mixer_r;
AudioMixer4 dexed_mixer_l;
AudioMixer4 master_mixer_r;
AudioMixer4 master_mixer_l;
AudioAmplifier volume_r;
@ -113,8 +113,8 @@ AudioAmplifier volume_l;
AudioEffectStereoMono stereo2mono;
AudioAnalyzePeak master_peak_r;
AudioAnalyzePeak master_peak_l;
AudioConnection patchCord23(microdexed_mixer_r, 0, master_mixer_r, DEXED);
AudioConnection patchCord24(microdexed_mixer_l, 0, master_mixer_l, DEXED);
AudioConnection patchCord23(dexed_mixer_r, 0, master_mixer_r, DEXED);
AudioConnection patchCord24(dexed_mixer_l, 0, master_mixer_l, DEXED);
AudioConnection patchCord25(master_mixer_r, volume_r);
AudioConnection patchCord26(master_mixer_l, volume_l);
AudioConnection patchCord27(volume_r, 0, stereo2mono, 0);
@ -173,16 +173,16 @@ void create_audio_connections(AudioSourceMicroDexed &dexed, AudioEffectMonoStere
dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, microdexed_peak_mixer, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, mono2stereo, 0);
dynamicConnections[nDynamic++] = new AudioConnection(pan, 0, mono2stereo, 1);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, microdexed_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, microdexed_mixer_l, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, dexed_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, dexed_mixer_l, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, chorus_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, chorus_send_mixer_l, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, delay_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, delay_send_mixer_l, instance_id);
#if defined(USE_REVERB)
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, reverb_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, reverb_send_mixer_l, instance_id);
#endif
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, delay_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, chorus_send_mixer_l, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, delay_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, chorus_send_mixer_l, instance_id);
}
bool sd_card_available = false;
@ -210,6 +210,11 @@ uint32_t peak_l = 0;
bool eeprom_update_flag = false;
config_t configuration;
uint8_t selected_dexed_instance = 0;
#if defined(USE_REVERB)
float master_mixer_level[4] = {1.0, 0.0, 0.0, 0.0};
#else
float master_mixer_level[3] = {1.0, 0.0, 0.0};
#endif
// Allocate the delay lines for chorus
int16_t delayline_r[MOD_DELAY_SAMPLE_BUFFER];
@ -424,22 +429,22 @@ void setup()
microdexed_peak_mixer.gain(instance_id, 1.0);
// INIT DEXED MIXER
microdexed_mixer_r.gain(instance_id, 1.0);
microdexed_mixer_l.gain(instance_id, 1.0);
dexed_mixer_r.gain(instance_id, 0.5);
dexed_mixer_l.gain(instance_id, 0.5);
#ifdef USE_REVERB
// INIT REVERB
reverb_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0));
reverb_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0));
reverb_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 0.5));
reverb_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 0.5));
#endif
// INIT DELAY
delay_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX, 0.0, 1.0));
delay_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX, 0.0, 1.0));
delay_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX, 0.0, 0.5));
delay_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX, 0.0, 0.5));
// INIT CHORUS
chorus_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 1.0));
chorus_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 1.0));
chorus_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 0.5));
chorus_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 0.5));
// DEXED FILTER
MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 1.0);
@ -452,16 +457,16 @@ void setup()
}
// REVERB
master_mixer_r.gain(REVERB, 1.0);
master_mixer_l.gain(REVERB, 1.0);
master_mixer_r.gain(REVERB, 0.0);
master_mixer_l.gain(REVERB, 0.0);
freeverb_r.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0));
freeverb_r.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0));
freeverb_l.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0));
freeverb_l.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0));
// DELAY
master_mixer_r.gain(DELAY, 1.0);
master_mixer_l.gain(DELAY, 1.0);
master_mixer_r.gain(DELAY, 0.0);
master_mixer_l.gain(DELAY, 0.0);
delay_r.delay(0, mapfloat(configuration.delay_time * 10, DELAY_TIME_MIN, DELAY_TIME_MAX, 0.0, float(DELAY_TIME_MAX)));
delay_l.delay(0, mapfloat(configuration.delay_time * 10, DELAY_TIME_MIN, DELAY_TIME_MAX, 0.0, float(DELAY_TIME_MAX)));
// delay_fb_mixer is the feedback-adding mixer
@ -469,8 +474,8 @@ void setup()
delay_fb_mixer_l.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
// CHORUS
master_mixer_r.gain(CHORUS, 1.0);
master_mixer_l.gain(CHORUS, 1.0);
master_mixer_r.gain(CHORUS, 0.0);
master_mixer_l.gain(CHORUS, 0.0);
switch (configuration.chorus_waveform)
{
case 0:
@ -771,16 +776,16 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
eeprom_write();
case 106: // CC 106: delay feedback
configuration.delay_feedback = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX);
delay_fb_mixer_r.gain(1, configuration.delay_feedback / 100.0 ); // amount of feedback
delay_fb_mixer_r.gain(0, 1.0 - configuration.delay_feedback / 100.0); // original signalbreak;
delay_fb_mixer_l.gain(1, configuration.delay_feedback / 100.0 ); // amount of feedback
delay_fb_mixer_l.gain(0, 1.0 - configuration.delay_feedback / 100.0); // original signalbreak;
delay_fb_mixer_r.gain(1, configuration.delay_feedback / 200.0 ); // amount of feedback
delay_fb_mixer_r.gain(0, 1.0 - configuration.delay_feedback / 200.0); // original signalbreak;
delay_fb_mixer_l.gain(1, configuration.delay_feedback / 200.0 ); // amount of feedback
delay_fb_mixer_l.gain(0, 1.0 - configuration.delay_feedback / 200.0); // original signalbreak;
eeprom_write();
break;
case 107: // CC 107: delay volume
configuration.dexed[instance_id].delay_send = map(inValue, 0, 0x7f, DELAY_SEND_MIN, DELAY_SEND_MAX);
master_mixer_r.gain(DELAY, configuration.dexed[instance_id].delay_send / 100.0);
master_mixer_l.gain(2, configuration.dexed[instance_id].delay_send / 100.0);
master_mixer_r.gain(DELAY, configuration.dexed[instance_id].delay_send / 200.0);
master_mixer_l.gain(DELAY, configuration.dexed[instance_id].delay_send / 200.0);
eeprom_write();
break;
case 120:
@ -1312,11 +1317,14 @@ void check_configuration(void)
configuration.mono = constrain(configuration.mono, MONO_MIN, MONO_MAX);
configuration.reverb_roomsize = constrain(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX);
configuration.reverb_damping = constrain(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX);
configuration.reverb_level = constrain(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX);
configuration.chorus_frequency = constrain(configuration.chorus_frequency, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX);
configuration.chorus_waveform = constrain(configuration.chorus_waveform, CHORUS_WAVEFORM_MIN, CHORUS_WAVEFORM_MAX);
configuration.chorus_depth = constrain(configuration.chorus_depth, CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX);
configuration.chorus_level = constrain(configuration.chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX);
configuration.delay_time = constrain(configuration.delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX);
configuration.delay_feedback = constrain(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX);
configuration.delay_level = constrain(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX);
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel, MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
@ -1349,6 +1357,12 @@ void check_configuration(void)
configuration.dexed[instance_id].portamento_time = constrain(configuration.dexed[instance_id].portamento_time, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX);
configuration.dexed[instance_id].op_enabled = constrain(configuration.dexed[instance_id].op_enabled, OP_ENABLED_MIN, OP_ENABLED_MAX);
}
set_master_mixer_gain(CHORUS, configuration.chorus_level / 100.0);
set_master_mixer_gain(DELAY, configuration.delay_level / 100.0);
#if defined(USE_REVERB)
set_master_mixer_gain(REVERB, configuration.reverb_level / 100.0);
#endif
}
void init_configuration(void)
@ -1365,11 +1379,14 @@ void init_configuration(void)
configuration.mono = MONO_DEFAULT;
configuration.reverb_roomsize = REVERB_ROOMSIZE_DEFAULT;
configuration.reverb_damping = REVERB_DAMPING_DEFAULT;
configuration.reverb_level = REVERB_LEVEL_DEFAULT;
configuration.chorus_frequency = CHORUS_FREQUENCY_DEFAULT;
configuration.chorus_waveform = CHORUS_WAVEFORM_DEFAULT;
configuration.chorus_depth = CHORUS_DEPTH_DEFAULT;
configuration.chorus_level = CHORUS_LEVEL_DEFAULT;
configuration.delay_time = DELAY_TIME_DEFAULT;
configuration.delay_feedback = DELAY_FEEDBACK_DEFAULT;
configuration.delay_level = DELAY_LEVEL_DEFAULT;
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL;
@ -1443,6 +1460,54 @@ uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https:/
return (crc);
}
void set_master_mixer_gain(uint8_t type, float level)
{
master_mixer_level[type] = constrain(level, 0.0, 1.0);
#if defined(USE_REVERB)
const uint8_t num_fx = 4;
#else
const uint8_t num_fx = 3;
#endif
float new_level[num_fx];
new_level[CHORUS] = master_mixer_level[CHORUS] / float(num_fx);
new_level[DELAY] = master_mixer_level[DELAY] / float(num_fx);
#if defined(USE_REVERB)
new_level[REVERB] = master_mixer_level[REVERB] / float(num_fx);
new_level[DEXED] = 1.0 - new_level[CHORUS] - new_level[DELAY] - new_level[REVERB];
#else
new_level[DEXED] = 1.0 - new_level[CHORUS] - new_level[DELAY];
#endif
master_mixer_r.gain(DEXED, new_level[DEXED]);
master_mixer_l.gain(DEXED, new_level[DEXED]);
master_mixer_r.gain(CHORUS, new_level[CHORUS]);
master_mixer_l.gain(CHORUS, new_level[CHORUS]);
master_mixer_r.gain(DELAY, new_level[DELAY]);
master_mixer_l.gain(DELAY, new_level[DELAY]);
#if defined(USE_REVERB)
master_mixer_r.gain(REVERB, new_level[REVERB]);
master_mixer_l.gain(REVERB, new_level[REVERB]);
#endif
#ifdef DEBUG
Serial.print(F("Volumes for master_mixer: DEXED="));
Serial.print(new_level[DEXED], 2);
Serial.print(F(" CHORUS="));
Serial.print(new_level[CHORUS], 2);
Serial.print(F(" DELAY="));
Serial.print(new_level[DELAY], 2);
#if defined(USE_REVERB)
Serial.print(F(" REVERB="));
Serial.print(new_level[REVERB], 2);
#endif
Serial.println();
#endif
}
/******************************************************************************
DEBUG HELPER
******************************************************************************/
@ -1507,11 +1572,14 @@ void show_configuration(void)
Serial.print(F("Mono ")); Serial.println(configuration.mono, DEC);
Serial.print(F("Reverb Roomsize ")); Serial.println(configuration.reverb_roomsize, DEC);
Serial.print(F("Reverb Damping ")); Serial.println(configuration.reverb_damping, DEC);
Serial.print(F("Reverb Level ")); Serial.println(configuration.reverb_level, DEC);
Serial.print(F("Chorus Frequency ")); Serial.println(configuration.chorus_frequency, DEC);
Serial.print(F("Chorus Waveform ")); Serial.println(configuration.chorus_waveform, DEC);
Serial.print(F("Chorus Depth ")); Serial.println(configuration.chorus_depth, DEC);
Serial.print(F("Chorus Level ")); Serial.println(configuration.chorus_level, DEC);
Serial.print(F("Delay Time ")); Serial.println(configuration.delay_time, DEC);
Serial.print(F("Delay Feedback ")); Serial.println(configuration.delay_feedback, DEC);
Serial.print(F("Delay Level ")); Serial.println(configuration.delay_level, DEC);
Serial.flush();
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{

253
UI.hpp

@ -57,6 +57,7 @@ extern void strip_extension(char* s, char *target);
extern void eeprom_write(void);
extern bool get_voice_names_from_bank(uint8_t b, uint8_t instance_id);
extern bool load_sysex(uint8_t b, uint8_t v);
extern void set_master_mixer_gain(uint8_t type, float level);
#ifdef DISPLAY_LCD_SPI
extern void change_disp_sd(bool d);
#endif
@ -139,13 +140,16 @@ void UI_func_sound(uint8_t param);
void UI_func_reverb_roomsize(uint8_t param);
void UI_func_reverb_damping(uint8_t param);
void UI_func_reverb_send(uint8_t param);
void UI_func_reverb_level(uint8_t param);
void UI_func_chorus_frequency(uint8_t param);
void UI_func_chorus_waveform(uint8_t param);
void UI_func_chorus_depth(uint8_t param);
void UI_func_chorus_send(uint8_t param);
void UI_func_chorus_level(uint8_t param);
void UI_func_delay_time(uint8_t param);
void UI_func_delay_feedback(uint8_t param);
void UI_func_delay_send(uint8_t param);
void UI_func_delay_level(uint8_t param);
void UI_func_filter_cutoff(uint8_t param);
void UI_func_filter_resonance(uint8_t param);
void UI_func_transpose(uint8_t param);
@ -278,18 +282,21 @@ LCDML_add(83, LCDML_0, 2, "Effect", NULL);
LCDML_add(84, LCDML_0_2, 1, "Reverb", NULL);
LCDML_add(85, LCDML_0_2_1, 1, "Roomsize", UI_func_reverb_roomsize);
LCDML_add(86, LCDML_0_2_1, 2, "Damping", UI_func_reverb_damping);
LCDML_add(87, LCDML_0_2, 2, "Chorus", NULL);
LCDML_add(88, LCDML_0_2_2, 1, "Frequency", UI_func_chorus_frequency);
LCDML_add(89, LCDML_0_2_2, 2, "Waveform", UI_func_chorus_waveform);
LCDML_add(90, LCDML_0_2_2, 3, "Depth", UI_func_chorus_depth);
LCDML_add(91, LCDML_0_2, 3, "Delay", NULL);
LCDML_add(92, LCDML_0_2_3, 1, "Time", UI_func_delay_time);
LCDML_add(93, LCDML_0_2_3, 2, "Feedback", UI_func_delay_feedback);
LCDML_add(94, LCDML_0, 3, "Store", NULL);
LCDML_add(95, LCDML_0, 4, "System", NULL);
LCDML_add(96, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(97, LCDML_0, 5, "Info", UI_func_information);
#define _LCDML_DISP_cnt 97
LCDML_add(87, LCDML_0_2_1, 3, "Level", UI_func_reverb_level);
LCDML_add(88, LCDML_0_2, 2, "Chorus", NULL);
LCDML_add(89, LCDML_0_2_2, 1, "Frequency", UI_func_chorus_frequency);
LCDML_add(90, LCDML_0_2_2, 2, "Waveform", UI_func_chorus_waveform);
LCDML_add(91, LCDML_0_2_2, 3, "Depth", UI_func_chorus_depth);
LCDML_add(92, LCDML_0_2_2, 4, "Level", UI_func_chorus_level);
LCDML_add(93, LCDML_0_2, 3, "Delay", NULL);
LCDML_add(94, LCDML_0_2_3, 1, "Time", UI_func_delay_time);
LCDML_add(95, LCDML_0_2_3, 2, "Feedback", UI_func_delay_feedback);
LCDML_add(96, LCDML_0_2_3, 3, "Level", UI_func_delay_level);
LCDML_add(97, LCDML_0, 3, "Store", NULL);
LCDML_add(98, LCDML_0, 4, "System", NULL);
LCDML_add(99, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(100, LCDML_0, 5, "Info", UI_func_information);
#define _LCDML_DISP_cnt 100
#define MENU_ID_OF_INSTANCE_2 42
#else
LCDML_add(0, LCDML_0, 1, "Setup", NULL);
@ -337,18 +344,21 @@ LCDML_add(41, LCDML_0, 2, "Effect", NULL);
LCDML_add(42, LCDML_0_2, 1, "Reverb", NULL);
LCDML_add(43, LCDML_0_2_1, 1, "Roomsize", UI_func_reverb_roomsize);
LCDML_add(44, LCDML_0_2_1, 2, "Damping", UI_func_reverb_damping);
LCDML_add(45, LCDML_0_2, 2, "Chorus", NULL);
LCDML_add(46, LCDML_0_2_2, 1, "Frequency", UI_func_chorus_frequency);
LCDML_add(47, LCDML_0_2_2, 2, "Waveform", UI_func_chorus_waveform);
LCDML_add(48, LCDML_0_2_2, 3, "Depth", UI_func_chorus_depth);
LCDML_add(49, LCDML_0_2, 3, "Delay", NULL);
LCDML_add(50, LCDML_0_2_3, 1, "Time", UI_func_delay_time);
LCDML_add(51, LCDML_0_2_3, 2, "Feedback", UI_func_delay_feedback);
LCDML_add(52, LCDML_0, 3, "Store", NULL);
LCDML_add(53, LCDML_0, 4, "System", NULL);
LCDML_add(54, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(55, LCDML_0, 5, "Info", UI_func_information);
#define _LCDML_DISP_cnt 55
LCDML_add(45, LCDML_0_2_1, 3, "Level", UI_func_reverb_level);
LCDML_add(46, LCDML_0_2, 2, "Chorus", NULL);
LCDML_add(47, LCDML_0_2_2, 1, "Frequency", UI_func_chorus_frequency);
LCDML_add(48, LCDML_0_2_2, 2, "Waveform", UI_func_chorus_waveform);
LCDML_add(49, LCDML_0_2_2, 3, "Depth", UI_func_chorus_depth);
LCDML_add(50, LCDML_0_2_2, 4, "Level", UI_func_chorus_level);
LCDML_add(51, LCDML_0_2, 3, "Delay", NULL);
LCDML_add(52, LCDML_0_2_3, 1, "Time", UI_func_delay_time);
LCDML_add(53, LCDML_0_2_3, 2, "Feedback", UI_func_delay_feedback);
LCDML_add(54, LCDML_0_2_3, 3, "Level", UI_func_delay_level);
LCDML_add(55, LCDML_0, 3, "Store", NULL);
LCDML_add(56, LCDML_0, 4, "System", NULL);
LCDML_add(57, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(58, LCDML_0, 5, "Info", UI_func_information);
#define _LCDML_DISP_cnt 58
#define MENU_ID_OF_INSTANCE_2 41
#endif
// create menu
@ -1089,8 +1099,8 @@ void UI_func_reverb_send(uint8_t param)
}
}
reverb_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].reverb_send / 100.0);
reverb_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].reverb_send / 100.0);
reverb_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].reverb_send / 200.0);
reverb_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].reverb_send / 200.0);
}
lcd.setCursor(0, 1);
@ -1113,6 +1123,65 @@ void UI_func_reverb_send(uint8_t param)
#endif
}
void UI_func_reverb_level(uint8_t param)
{
#ifdef USE_REVERB
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Reverb Level"));
#ifdef DEBUG
Serial.println(F("Entering UI_func_reverb_level()"));
Serial.print(F("reverb_level="));
Serial.println(configuration.reverb_level, DEC);
#endif
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
{
if (configuration.reverb_level < REVERB_LEVEL_MAX)
{
configuration.reverb_level++;
}
}
else if (LCDML.BT_checkUp())
{
if (configuration.reverb_level > REVERB_LEVEL_MIN)
{
configuration.reverb_level--;
}
}
set_master_mixer_gain(REVERB, configuration.reverb_level / 100.0);
}
lcd.setCursor(0, 1);
lcd_display_int(configuration.reverb_level, 3, true, true, false);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
#ifdef DEBUG
Serial.println(F("Leaving UI_func_reverb_level()"));
Serial.print(F("configuration.reverb_levelg="));
Serial.println(configuration.reverb_level, DEC);
#endif
eeprom_write();
}
#else
UI_function_not_enabled();
#endif
}
void UI_func_chorus_frequency(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
@ -1307,8 +1376,8 @@ void UI_func_chorus_send(uint8_t param)
}
}
chorus_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].chorus_send / 100.0);
chorus_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].chorus_send / 100.0);
chorus_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].chorus_send / 200.0);
chorus_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].chorus_send / 200.0);
}
lcd.setCursor(0, 1);
@ -1322,6 +1391,65 @@ void UI_func_chorus_send(uint8_t param)
}
}
void UI_func_chorus_level(uint8_t param)
{
#ifdef USE_REVERB
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Chorus Level"));
#ifdef DEBUG
Serial.println(F("Entering UI_func_chorus_level()"));
Serial.print(F("chorus_level="));
Serial.println(configuration.chorus_level, DEC);
#endif
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
{
if (configuration.chorus_level < CHORUS_LEVEL_MAX)
{
configuration.chorus_level++;
}
}
else if (LCDML.BT_checkUp())
{
if (configuration.chorus_level > CHORUS_LEVEL_MIN)
{
configuration.chorus_level--;
}
}
set_master_mixer_gain(CHORUS, configuration.chorus_level / 100.0);
}
lcd.setCursor(0, 1);
lcd_display_int(configuration.chorus_level, 3, true, true, false);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
#ifdef DEBUG
Serial.println(F("Leaving UI_func_chorus_level()"));
Serial.print(F("configuration.chorus_level="));
Serial.println(configuration.chorus_level, DEC);
#endif
eeprom_write();
}
#else
UI_function_not_enabled();
#endif
}
void UI_func_delay_time(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
@ -1402,8 +1530,8 @@ void UI_func_delay_feedback(uint8_t param)
}
}
delay_fb_mixer_r.gain(1, configuration.delay_feedback / 100.0 ); // amount of feedback
delay_fb_mixer_l.gain(1, configuration.delay_feedback / 100.0 ); // amount of feedback
delay_fb_mixer_r.gain(1, configuration.delay_feedback / 200.0 ); // amount of feedback
delay_fb_mixer_l.gain(1, configuration.delay_feedback / 200.0 ); // amount of feedback
//delay_fb_mixer.gain(0, 1.0 - configuration.delay_feedback / 200.0); // original signal
}
@ -1455,8 +1583,8 @@ void UI_func_delay_send(uint8_t param)
}
}
delay_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].delay_send / 100.0);
delay_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].delay_send / 100.0);
delay_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].delay_send / 200.0);
delay_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].delay_send / 200.0);
}
lcd.setCursor(0, 1);
@ -1470,6 +1598,65 @@ void UI_func_delay_send(uint8_t param)
}
}
void UI_func_delay_level(uint8_t param)
{
#ifdef USE_REVERB
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Delay Level"));
#ifdef DEBUG
Serial.println(F("Entering UI_func_delay_level()"));
Serial.print(F("delay_level="));
Serial.println(configuration.delay_level, DEC);
#endif
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
{
if (configuration.delay_level < DELAY_LEVEL_MAX)
{
configuration.delay_level++;
}
}
else if (LCDML.BT_checkUp())
{
if (configuration.delay_level > DELAY_LEVEL_MIN)
{
configuration.delay_level--;
}
}
set_master_mixer_gain(DELAY, configuration.delay_level / 100.0);
}
lcd.setCursor(0, 1);
lcd_display_int(configuration.delay_level, 3, true, true, false);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
#ifdef DEBUG
Serial.println(F("Leaving UI_func_delay_level()"));
Serial.print(F("configuration.delay_levelg="));
Serial.println(configuration.delay_level, DEC);
#endif
eeprom_write();
}
#else
UI_function_not_enabled();
#endif
}
void UI_func_filter_cutoff(uint8_t param)
{
uint8_t instance_id = 0;
@ -2885,7 +3072,7 @@ void UI_func_OP2(uint8_t param)
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
UI_handle_OP(param, 0, instance_id);
UI_handle_OP(param, 1, instance_id);
}
void UI_func_OP3(uint8_t param)

@ -95,7 +95,7 @@
#else
#define AUDIO_MEM 384
#endif
#define REDUCE_LOUDNESS 1
#define REDUCE_LOUDNESS 3
#else // IF TEENSY_AUDIO_BOARD
#define SGTL5000_LINEOUT_LEVEL 29
#if AUDIO_BLOCK_SAMPLES == 64
@ -104,7 +104,7 @@
#define AUDIO_MEM 384
#endif
#define DELAY_MAX_TIME 600
#define REDUCE_LOUDNESS 1
#define REDUCE_LOUDNESS 3
#endif
#define DELAY_MAX_TIME 600
#define SAMPLE_RATE 44100
@ -248,7 +248,7 @@ enum { DEXED, REVERB, DELAY, CHORUS };
// Audio
#ifdef TGA_AUDIO_BOARD
#define REDUCE_LOUDNESS 2
#define REDUCE_LOUDNESS 3
#endif
// Some optimizations
@ -297,6 +297,10 @@ enum { DEXED, REVERB, DELAY, CHORUS };
#define REVERB_SEND_MAX 100
#define REVERB_SEND_DEFAULT 0
#define REVERB_LEVEL_MIN 0
#define REVERB_LEVEL_MAX 100
#define REVERB_LEVEL_DEFAULT 0
#define CHORUS_FREQUENCY_MIN 0
#define CHORUS_FREQUENCY_MAX 100
#define CHORUS_FREQUENCY_DEFAULT 0
@ -313,6 +317,10 @@ enum { DEXED, REVERB, DELAY, CHORUS };
#define CHORUS_SEND_MAX 100
#define CHORUS_SEND_DEFAULT 0
#define CHORUS_LEVEL_MIN 0
#define CHORUS_LEVEL_MAX 100
#define CHORUS_LEVEL_DEFAULT 0
#define DELAY_TIME_MIN 0
#define DELAY_TIME_MAX DELAY_MAX_TIME
#define DELAY_TIME_DEFAULT 0
@ -325,6 +333,10 @@ enum { DEXED, REVERB, DELAY, CHORUS };
#define DELAY_SEND_MAX 100
#define DELAY_SEND_DEFAULT 0
#define DELAY_LEVEL_MIN 0
#define DELAY_LEVEL_MAX 100
#define DELAY_LEVEL_DEFAULT 0
#define FILTER_CUTOFF_MIN 0
#define FILTER_CUTOFF_MAX 100
#define FILTER_CUTOFF_DEFAULT 0
@ -468,11 +480,14 @@ typedef struct {
uint8_t mono;
uint8_t reverb_roomsize;
uint8_t reverb_damping;
uint8_t reverb_level;
uint8_t chorus_frequency;
uint8_t chorus_waveform;
uint8_t chorus_depth;
uint8_t chorus_level;
uint8_t delay_time;
uint8_t delay_feedback;
uint8_t delay_level;
dexed_t dexed[NUM_DEXED];
} config_t;

Loading…
Cancel
Save