Fixed initialization code. Still problems with delay.

pull/32/head
Holger Wirtz 5 years ago
parent 542317117d
commit 73060ecf30
  1. 109
      MicroDexed.ino
  2. 6
      UI.hpp
  3. 40
      config.h

@ -294,8 +294,6 @@ void setup()
}
}
initial_values_from_eeprom(false);
#if defined(TEENSY_AUDIO_BOARD)
sgtl5000_1.enable();
sgtl5000_1.lineOutLevel(SGTL5000_LINEOUT_LEVEL);
@ -356,6 +354,29 @@ void setup()
#ifdef DEBUG
Serial.println(F("Internal DAC enabled."));
#endif
#endif
initial_values_from_eeprom(false);
#if defined(USE_FX)
// Init effects
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
memset(delayline, 0, sizeof(delayline[instance_id]));
if (!modchorus[instance_id]->begin(delayline[instance_id], MOD_DELAY_SAMPLE_BUFFER)) {
#ifdef DEBUG
Serial.print(F("AudioEffectModulatedDelay - begin failed ["));
Serial.print(instance_id);
Serial.println(F("]"));
#endif
while (1);
}
}
#ifdef DEBUG
Serial.print(F("MOD_DELAY_SAMPLE_BUFFER="));
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC);
Serial.println(F(" samples"));
#endif
#endif
// start SD card
@ -388,29 +409,7 @@ void setup()
change_disp_sd(true);
#endif
#if defined(USE_FX)
// Init effects
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
memset(delayline, 0, sizeof(delayline[instance_id]));
if (!modchorus[instance_id]->begin(delayline[instance_id], MOD_DELAY_SAMPLE_BUFFER)) {
#ifdef DEBUG
Serial.print(F("AudioEffectModulatedDelay - begin failed ["));
Serial.print(instance_id);
Serial.println(F("]"));
#endif
while (1);
}
}
#ifdef DEBUG
Serial.print(F("MOD_DELAY_SAMPLE_BUFFER="));
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC);
Serial.println(F(" samples"));
#endif
#endif
set_fx_params();
/*
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
// INIT PEAK MIXER
@ -429,6 +428,7 @@ void setup()
master_mixer_l.gain(3, pseudo_log_curve(configuration.fx.reverb_level / 100));
set_sys_params();
*/
// Initialize processor and memory measurements
AudioProcessorUsageMaxReset();
@ -805,7 +805,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
}
break;
case 107: // CC 107: delay volume
configuration.fx.delay_level[instance_id] = map(inValue, 0, 0x7f, DELAY_SEND_MIN, DELAY_SEND_MAX);
configuration.fx.delay_level[instance_id] = map(inValue, 0, 0x7f, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX);
delay_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)));
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_level))
{
@ -1436,6 +1436,9 @@ void initial_values_from_eeprom(bool init)
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
set_voiceconfig_params(instance_id);
/*
MicroDexed[instance_id]->setPBController(configuration.dexed[instance_id].pb_range, configuration.dexed[instance_id].pb_step);
MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign, configuration.dexed[instance_id].mw_mode);
MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign, configuration.dexed[instance_id].fc_mode);
@ -1446,33 +1449,27 @@ void initial_values_from_eeprom(bool init)
MicroDexed[instance_id]->doRefreshVoice();
MicroDexed[instance_id]->setMaxNotes(configuration.dexed[instance_id].polyphony);
MicroDexed[instance_id]->setMonoMode(configuration.sys.mono);
*/
#if defined(USE_FX)
//chorus_mixer[instance_id]->gain(0, 1.0 - pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)));
//chorus_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)));
//chorus_mixer[instance_id]->gain(0, 1.0 - mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5));
/*
chorus_mixer[instance_id]->gain(1, 1.0 - mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5));
chorus_mixer[instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5));
delay_mixer[instance_id]->gain(0, 1.0);
delay_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)));
delay_fb_mixer[instance_id]->gain(0, 1.0);
delay_fb_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)));
reverb_mixer_r.gain(instance_id, pseudo_log_curve(configuration.fx.reverb_send[instance_id] / 100.0));
reverb_mixer_l.gain(instance_id, pseudo_log_curve(configuration.fx.reverb_send[instance_id] / 100.0));
// MicroDexed[instance_id]->fx.Gain = configuration.dexed[instance_id].sound_intensity / 100.0;
MicroDexed[instance_id]->fx.Gain = 1.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(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
reverb_mixer_r.gain(instance_id, pseudo_log_curve(configuration.fx.reverb_send[instance_id] / 100.0));
reverb_mixer_l.gain(instance_id, pseudo_log_curve(configuration.fx.reverb_send[instance_id] / 100.0));
#endif
dexed_level[instance_id]->gain(pseudo_log_curve(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)));
set_voiceconfig_params(instance_id);
*/
//dexed_level[instance_id]->gain(pseudo_log_curve(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)));
}
set_sys_params();
set_fx_params();
set_sys_params();
set_volume(configuration.sys.vol, configuration.sys.mono);
@ -1749,7 +1746,7 @@ bool eeprom_get_performance()
/******************************************************************************
PARAMETER-HELPERS
******************************************************************************/
******************************************************************************/
void set_fx_params(void)
{
@ -1788,13 +1785,20 @@ void set_fx_params(void)
// DELAY
delay_mixer[instance_id]->gain(0, 1.0);
delay_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)));
delay_fx[instance_id]->delay(0, constrain(configuration.fx.delay_time[instance_id] * 10, DELAY_TIME_MIN * 10, DELAY_TIME_MAX * 10));
delay_fx[instance_id]->delay(0, constrain(configuration.fx.delay_time[instance_id], DELAY_TIME_MIN, DELAY_TIME_MAX) * 10);
delay_fb_mixer[instance_id]->gain(0, 1.0);
delay_fb_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)));
// REVERB
// REVERB SEND
reverb_mixer_r.gain(instance_id, pseudo_log_curve(configuration.fx.reverb_send[instance_id] / 100.0));
reverb_mixer_l.gain(instance_id, pseudo_log_curve(configuration.fx.reverb_send[instance_id] / 100.0));
// DEXED FILTER
//MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX);
MicroDexed[instance_id]->fx.Gain = 1.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(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
MicroDexed[instance_id]->doRefreshVoice();
}
// REVERB
@ -1809,12 +1813,20 @@ void set_fx_params(void)
void set_voiceconfig_params(uint8_t instance_id)
{
// DEXED FILTER
//MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX);
MicroDexed[instance_id]->fx.Gain = 1.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(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
// INIT PEAK MIXER
microdexed_peak_mixer.gain(instance_id, 1.0);
// Controller
MicroDexed[instance_id]->setPBController(configuration.dexed[instance_id].pb_range, configuration.dexed[instance_id].pb_step);
MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign, configuration.dexed[instance_id].mw_mode);
MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign, configuration.dexed[instance_id].fc_mode);
MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign, configuration.dexed[instance_id].bc_mode);
MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign, configuration.dexed[instance_id].at_mode);
MicroDexed[instance_id]->controllers.refresh();
MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled);
MicroDexed[instance_id]->doRefreshVoice();
MicroDexed[instance_id]->setMaxNotes(configuration.dexed[instance_id].polyphony);
MicroDexed[instance_id]->setMonoMode(configuration.sys.mono);
// Dexed output level
dexed_level[instance_id]->gain(pseudo_log_curve(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)));
@ -2171,6 +2183,7 @@ void show_configuration(void)
Serial.print(F(" Delay Time ")); Serial.println(configuration.fx.delay_time[instance_id], DEC);
Serial.print(F(" Delay Feedback ")); Serial.println(configuration.fx.delay_feedback[instance_id], DEC);
Serial.print(F(" Delay Level ")); Serial.println(configuration.fx.delay_level[instance_id], DEC);
Serial.print(F(" Reverb Send ")); Serial.println(configuration.fx.reverb_send[instance_id], DEC);
Serial.print(F(" Filter Cutoff ")); Serial.println(configuration.dexed[instance_id].filter_cutoff, DEC);
Serial.print(F(" Filter Resonance ")); Serial.println(configuration.dexed[instance_id].filter_resonance, DEC);
Serial.print(F(" Sound Intensity ")); Serial.println(configuration.dexed[instance_id].sound_intensity, DEC);

@ -176,7 +176,8 @@ const uint8_t special_chars[18][8] = {
{B00000, B11111, B11111, B11111, B11111, B11111, B11111, B11111}, // [14] Level 7
{B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111}, // [15] Level 8
{B00100, B00110, B00101, B00101, B01101, B11101, B11100, B11000}, // [16] Note
{B01110, B10001, B10001, B11111, B11011, B11011, B11111, B00000} // [17] Disabled 2nd instance symbol
//{B01110, B10001, B10001, B11111, B11011, B11011, B11111, B00000} // [17] Disabled 2nd instance symbol
{B01110, B10001, B10001, B01110, B00100, B00100, B00110, B00110} // [17] Disabled 2nd instance symbol
};
enum { SCROLLBAR, BLOCKBAR, METERBAR };
@ -1265,7 +1266,8 @@ void UI_func_delay_time(uint8_t param)
lcd_display_bar_int("Delay Time", configuration.fx.delay_time[selected_instance_id], 10.0, DELAY_TIME_MIN, DELAY_TIME_MAX, 3, false, false, true);
delay_fx[selected_instance_id]->delay(0, configuration.fx.delay_time[selected_instance_id] * 10);
delay_fx[selected_instance_id]->delay(0, constrain(configuration.fx.delay_time[selected_instance_id], DELAY_TIME_MIN, DELAY_TIME_MAX) * 10);
Serial.print("--------------->"); Serial.println(constrain(configuration.fx.delay_time[selected_instance_id], DELAY_TIME_MIN, DELAY_TIME_MAX) * 10, DEC);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********

@ -343,22 +343,6 @@
#define INSTANCE_HIGHEST_NOTE_MAX 108
#define INSTANCE_HIGHEST_NOTE_DEFAULT 108
#define REVERB_ROOMSIZE_MIN 0
#define REVERB_ROOMSIZE_MAX 100
#define REVERB_ROOMSIZE_DEFAULT 0
#define REVERB_DAMPING_MIN 0
#define REVERB_DAMPING_MAX 100
#define REVERB_DAMPING_DEFAULT 0
#define REVERB_SEND_MIN 0
#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
@ -371,10 +355,6 @@
#define CHORUS_DEPTH_MAX 100
#define CHORUS_DEPTH_DEFAULT 0
#define CHORUS_SEND_MIN 0
#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
@ -387,14 +367,26 @@
#define DELAY_FEEDBACK_MAX 100
#define DELAY_FEEDBACK_DEFAULT 0
#define DELAY_SEND_MIN 0
#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 REVERB_ROOMSIZE_MIN 0
#define REVERB_ROOMSIZE_MAX 100
#define REVERB_ROOMSIZE_DEFAULT 0
#define REVERB_DAMPING_MIN 0
#define REVERB_DAMPING_MAX 100
#define REVERB_DAMPING_DEFAULT 0
#define REVERB_LEVEL_MIN 0
#define REVERB_LEVEL_MAX 100
#define REVERB_LEVEL_DEFAULT 0
#define REVERB_SEND_MIN 0
#define REVERB_SEND_MAX 100
#define REVERB_SEND_DEFAULT 0
#define FILTER_CUTOFF_MIN 0
#define FILTER_CUTOFF_MAX 100
#define FILTER_CUTOFF_DEFAULT 0

Loading…
Cancel
Save