|
|
@ -130,9 +130,9 @@ uint8_t midi_timing_counter = 0; // 24 per qarter |
|
|
|
elapsedMillis midi_timing_timestep; |
|
|
|
elapsedMillis midi_timing_timestep; |
|
|
|
uint16_t midi_timing_quarter = 0; |
|
|
|
uint16_t midi_timing_quarter = 0; |
|
|
|
elapsedMillis long_button_pressed; |
|
|
|
elapsedMillis long_button_pressed; |
|
|
|
//SoftenValue <uint8_t> effect_filter_volume[NUM_DEXED](SOFTEN_VALUE_CHANGE_STEPS);
|
|
|
|
SoftenValue <float> soften_volume; |
|
|
|
//SoftenValue <uint8_t> soften_filter_res[NUM_DEXED](SOFTEN_VALUE_CHANGE_STEPS);
|
|
|
|
SoftenValue <float> soften_filter_res[NUM_DEXED]; |
|
|
|
//SoftenValue <uint8_t> soften_filter_cut[NUM_DEXED](SOFTEN_VALUE_CHANGE_STEPS);
|
|
|
|
SoftenValue <float> soften_filter_cut[NUM_DEXED]; |
|
|
|
uint8_t effect_filter_cutoff = 0; |
|
|
|
uint8_t effect_filter_cutoff = 0; |
|
|
|
uint8_t effect_filter_resonance = 0; |
|
|
|
uint8_t effect_filter_resonance = 0; |
|
|
|
uint8_t effect_delay_time = 0; |
|
|
|
uint8_t effect_delay_time = 0; |
|
|
@ -147,9 +147,6 @@ elapsedMillis cpu_mem_millis; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
config_t configuration = {0xffff, 0, 0, VOLUME, 0.5f, 0, DEFAULT_MIDI_CHANNEL}; |
|
|
|
config_t configuration = {0xffff, 0, 0, VOLUME, 0.5f, 0, DEFAULT_MIDI_CHANNEL}; |
|
|
|
bool eeprom_update_flag = false; |
|
|
|
bool eeprom_update_flag = false; |
|
|
|
value_change_t soften_volume = {0.0, 0}; |
|
|
|
|
|
|
|
value_change_t soften_filter_res = {0.0, 0}; |
|
|
|
|
|
|
|
value_change_t soften_filter_cut = {0.0, 0}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Allocate the delay lines for left and right channels
|
|
|
|
// Allocate the delay lines for left and right channels
|
|
|
|
short delayline[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
short delayline[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
@ -348,13 +345,16 @@ void setup() |
|
|
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < NUM_DEXED; i++) |
|
|
|
for (uint8_t i = 0; i < NUM_DEXED; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
soften_filter_res[i].init(1.0, 0.0, 1.0); |
|
|
|
|
|
|
|
soften_filter_cut[i].init(1.0, 0.0, 1.0); |
|
|
|
MicroDexed[i]->fx.Gain = 1.0; |
|
|
|
MicroDexed[i]->fx.Gain = 1.0; |
|
|
|
MicroDexed[i]->fx.Reso = 1.0 - float(effect_filter_resonance) / ENC_FILTER_RES_STEPS; |
|
|
|
MicroDexed[i]->fx.Reso = 1.0; |
|
|
|
MicroDexed[i]->fx.Cutoff = 1.0 - float(effect_filter_cutoff) / ENC_FILTER_CUT_STEPS; |
|
|
|
MicroDexed[i]->fx.Cutoff = 1.0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// set initial volume and pan (read from EEPROM)
|
|
|
|
// set initial volume and pan (read from EEPROM)
|
|
|
|
set_volume(configuration.vol, configuration.pan); |
|
|
|
set_volume(configuration.vol, configuration.pan); |
|
|
|
|
|
|
|
soften_volume.init(configuration.vol, 0.0, 1.0); |
|
|
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
// Initialize processor and memory measurements
|
|
|
|
// Initialize processor and memory measurements
|
|
|
@ -447,62 +447,56 @@ void loop() |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
control_rate = 0; |
|
|
|
control_rate = 0; |
|
|
|
|
|
|
|
|
|
|
|
// Shutdown unused voices
|
|
|
|
// check for value changes and unused voices
|
|
|
|
|
|
|
|
soften_volume.tick(); |
|
|
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < NUM_DEXED; i++) |
|
|
|
for (uint8_t i = 0; i < NUM_DEXED; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
active_voices = MicroDexed[i]->getNumNotesPlaying(); |
|
|
|
active_voices = MicroDexed[i]->getNumNotesPlaying(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check for value changes
|
|
|
|
soften_filter_res[i].tick(); |
|
|
|
if (soften_volume.steps > 0) |
|
|
|
soften_filter_cut[i].tick(); |
|
|
|
{ |
|
|
|
|
|
|
|
// soften volume value
|
|
|
|
if (soften_filter_res[i].running()) |
|
|
|
soften_volume.steps--; |
|
|
|
|
|
|
|
set_volume(configuration.vol + soften_volume.diff, configuration.pan); |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.print(F("Volume: ")); |
|
|
|
|
|
|
|
Serial.print(configuration.vol, 5); |
|
|
|
|
|
|
|
Serial.print(F(" Volume step: ")); |
|
|
|
|
|
|
|
Serial.print(soften_volume.steps); |
|
|
|
|
|
|
|
Serial.print(F(" Volume diff: ")); |
|
|
|
|
|
|
|
Serial.println(soften_volume.diff, 5); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (soften_filter_res.steps > 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// soften filter resonance value
|
|
|
|
|
|
|
|
soften_filter_res.steps--; |
|
|
|
|
|
|
|
for (uint8_t i = 0; i < NUM_DEXED; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
MicroDexed[i]->fx.Reso = MicroDexed[i]->fx.Reso + soften_filter_res.diff; |
|
|
|
// soften filter resonance value
|
|
|
|
|
|
|
|
MicroDexed[i]->fx.Reso = soften_filter_res[i].value(); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("Filter-Resonance: ")); |
|
|
|
Serial.print(F("Filter-Resonance: ")); |
|
|
|
Serial.print(MicroDexed[i]->fx.Reso, 5); |
|
|
|
Serial.print(MicroDexed[i]->fx.Reso, 5); |
|
|
|
Serial.print(F(" Filter-Resonance step: ")); |
|
|
|
Serial.print(F(" Filter-Resonance step: ")); |
|
|
|
Serial.print(soften_filter_res.steps); |
|
|
|
Serial.print(soften_filter_res[i].steps()); |
|
|
|
Serial.print(F(" Filter-Resonance diff: ")); |
|
|
|
Serial.print(F(" Filter-Resonance diff: ")); |
|
|
|
Serial.println(soften_filter_res.diff, 5); |
|
|
|
Serial.println(soften_filter_res[i].diff(), 5); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (soften_filter_cut.steps > 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// soften filter cutoff value
|
|
|
|
// soften filter cutoff value
|
|
|
|
soften_filter_cut.steps--; |
|
|
|
if (soften_filter_cut[i].running()) |
|
|
|
for (uint8_t i = 0; i < NUM_DEXED; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
MicroDexed[i]->fx.Cutoff = MicroDexed[i]->fx.Cutoff + soften_filter_cut.diff; |
|
|
|
MicroDexed[i]->fx.Cutoff = soften_filter_cut[i].value(); |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("Filter-Cutoff: ")); |
|
|
|
Serial.print(F("Filter-Cutoff: ")); |
|
|
|
Serial.print(MicroDexed[i]->fx.Cutoff, 5); |
|
|
|
Serial.print(MicroDexed[i]->fx.Cutoff, 5); |
|
|
|
Serial.print(F(" Filter-Cutoff step: ")); |
|
|
|
Serial.print(F(" Filter-Cutoff step: ")); |
|
|
|
Serial.print(soften_filter_cut.steps); |
|
|
|
Serial.print(soften_filter_cut[i].steps()); |
|
|
|
Serial.print(F(" Filter-Cutoff diff: ")); |
|
|
|
Serial.print(F(" Filter-Cutoff diff: ")); |
|
|
|
Serial.println(soften_filter_cut.diff, 5); |
|
|
|
Serial.println(soften_filter_cut[i].diff(), 5); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (soften_volume.running()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
set_volume(soften_volume.value(), configuration.pan); |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.print(F("Volume: ")); |
|
|
|
|
|
|
|
Serial.print(configuration.vol, 5); |
|
|
|
|
|
|
|
Serial.print(F(" step: ")); |
|
|
|
|
|
|
|
Serial.print(soften_volume.steps()); |
|
|
|
|
|
|
|
Serial.print(F(" diff: ")); |
|
|
|
|
|
|
|
Serial.println(soften_volume.diff(), 5); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|