Started to exchange USE_REVERB with USE_FX to completely disable the

fx-chain for more performance.
pull/32/head
Holger Wirtz 4 years ago
parent b27cd00895
commit f53a6d0d96
  1. 38
      MicroDexed.ino
  2. 32
      UI.hpp
  3. 16
      config.h

@ -56,6 +56,7 @@ AudioAmplifier volume_l;
AudioEffectStereoMono stereo2mono;
AudioAnalyzePeak master_peak_r;
AudioAnalyzePeak master_peak_l;
#if defined(USE_FX)
AudioMixer4 delay_send_mixer_r;
AudioMixer4 delay_send_mixer_l;
AudioMixer4 delay_fb_mixer_r;
@ -70,13 +71,13 @@ AudioEffectModulatedDelay modchorus_l;
AudioFilterBiquad modchorus_filter_r;
AudioFilterBiquad modchorus_filter_l;
#endif
#if defined(USE_REVERB)
AudioMixer4 reverb_send_mixer_r;
AudioMixer4 reverb_send_mixer_l;
AudioEffectFreeverb freeverb_l;
AudioEffectFreeverb freeverb_r;
#endif
#if defined(USE_FX)
// FX chain left
AudioConnection patchCord1(delay_send_mixer_l, 0, delay_fb_mixer_l, 0);
AudioConnection patchCord2(delay_fb_mixer_l, delay_l);
@ -89,9 +90,7 @@ AudioConnection patchCord7(modchorus_filter_l, modchorus_inverter);
#else
AudioConnection patchCord6(modchorus_l, modchorus_inverter);
#endif
#if defined(USE_REVERB)
AudioConnection patchCord8(reverb_send_mixer_l, freeverb_l);
#endif
// FX chain right
AudioConnection patchCord9(delay_send_mixer_r, 0, delay_fb_mixer_r, 0);
@ -102,10 +101,10 @@ AudioConnection patchCord13(chorus_modulator, 0, modchorus_r, 1);
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
AudioConnection patchCord14(modchorus_r, modchorus_filter_r);
#endif
#if defined(USE_REVERB)
AudioConnection patchCord15(reverb_send_mixer_r, freeverb_r);
#endif
#if defined(USE_FX)
// FX chain tail
AudioConnection patchCord16(delay_fb_mixer_r, 0, master_mixer_r, DELAY);
AudioConnection patchCord17(delay_fb_mixer_l, 0, master_mixer_l, DELAY);
@ -116,7 +115,6 @@ AudioConnection patchCord19(modchorus_inverter, 0, master_mixer_l, CHO
AudioConnection patchCord18(modchorus_r, 0, master_mixer_r, CHORUS);
AudioConnection patchCord19(modchorus_inverter, 0, master_mixer_l, CHORUS);
#endif
#if defined(USE_REVERB)
AudioConnection patchCord20(freeverb_r, 0, master_mixer_r, REVERB);
AudioConnection patchCord21(freeverb_l, 0, master_mixer_l, REVERB);
#endif
@ -170,10 +168,10 @@ AudioConnection patchCord34(stereo2mono, 1, dacOut, 1);
// Dynamic patching of MicroDexed objects
//
uint8_t nDynamic = 0;
#if defined(USE_REVERB)
#if defined(USE_FX)
AudioConnection * dynamicConnections[NUM_DEXED * 10];
#else
AudioConnection * dynamicConnections[NUM_DEXED * 8];
AudioConnection * dynamicConnections[NUM_DEXED * 4];
#endif
void create_audio_connections(AudioSourceMicroDexed &dexed, AudioEffectMonoStereo &mono2stereo, uint8_t instance_id)
{
@ -181,11 +179,11 @@ void create_audio_connections(AudioSourceMicroDexed &dexed, AudioEffectMonoStere
dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, mono2stereo, 0);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, dexed_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, dexed_mixer_l, instance_id);
#if defined(USE_FX)
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, chorus_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, chorus_send_mixer_l, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, delay_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, 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, 1, reverb_send_mixer_l, instance_id);
#endif
@ -218,15 +216,12 @@ 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
#if defined(USE_FX)
// Allocate the delay lines for chorus
int16_t delayline_r[MOD_DELAY_SAMPLE_BUFFER];
int16_t delayline_l[MOD_DELAY_SAMPLE_BUFFER];
#endif
#ifdef ENABLE_LCD_UI
/***********************************************************************
@ -416,6 +411,8 @@ void setup()
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
#if defined(USE_FX)
// Init effects
memset(delayline_r, 0, sizeof(delayline_r));
if (!modchorus_r.begin(delayline_r, MOD_DELAY_SAMPLE_BUFFER)) {
@ -431,6 +428,7 @@ void setup()
Serial.print(F("MOD_DELAY_SAMPLE_BUFFER="));
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC);
Serial.println(F(" samples"));
#endif
#endif
master_mixer_r.gain(DEXED, 1.0);
@ -439,10 +437,8 @@ void setup()
master_mixer_l.gain(CHORUS, mapfloat(configuration.chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0));
master_mixer_r.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
#if defined(USE_REVERB)
master_mixer_r.gain(REVERB, mapfloat(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(REVERB, mapfloat(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0));
#endif
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
@ -453,11 +449,9 @@ void setup()
dexed_mixer_r.gain(instance_id, 1.0);
dexed_mixer_l.gain(instance_id, 1.0);
#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));
#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));
@ -476,7 +470,8 @@ void setup()
// PANORAMA
mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
}
#if defined(USE_FX)
// DELAY
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)));
@ -518,7 +513,6 @@ void setup()
modchorus_filter_l.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3);
#endif
#if defined(USE_REVERB)
// REVERB
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));
@ -1300,10 +1294,8 @@ void initial_values_from_eeprom(bool init)
delay_fb_mixer_r.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
delay_fb_mixer_l.gain(0, 1.0); // original signal
delay_fb_mixer_l.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
#if defined(USE_REVERB)
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);
#endif
MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled);
@ -1320,10 +1312,8 @@ void initial_values_from_eeprom(bool init)
master_mixer_l.gain(CHORUS, mapfloat(configuration.chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0));
master_mixer_r.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
#if defined(USE_REVERB)
master_mixer_r.gain(REVERB, mapfloat(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(REVERB, mapfloat(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0));
#endif
set_volume(configuration.vol, configuration.mono);
}
@ -1387,10 +1377,8 @@ void check_configuration(void)
master_mixer_l.gain(CHORUS, mapfloat(configuration.delay_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0));
master_mixer_r.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
#if defined(USE_REVERB)
master_mixer_r.gain(REVERB, mapfloat(configuration.delay_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(REVERB, mapfloat(configuration.delay_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0));
#endif
}
void init_configuration(void)

@ -61,14 +61,13 @@ extern bool load_sysex(uint8_t b, uint8_t v);
#ifdef DISPLAY_LCD_SPI
extern void change_disp_sd(bool d);
#endif
#ifdef USE_FX
extern AudioEffectDelay delay_r;
extern AudioEffectDelay delay_l;
#ifdef USE_REVERB
extern AudioEffectFreeverb freeverb_r;
extern AudioEffectFreeverb freeverb_l;
extern AudioMixer4 reverb_send_mixer_r;
extern AudioMixer4 reverb_send_mixer_l;
#endif
extern AudioEffectModulatedDelay modchorus_r;
extern AudioEffectModulatedDelay modchorus_l;
extern AudioSynthWaveform chorus_modulator;
@ -78,6 +77,7 @@ extern AudioMixer4 delay_send_mixer_r;
extern AudioMixer4 delay_send_mixer_l;
extern AudioMixer4 delay_fb_mixer_r;
extern AudioMixer4 delay_fb_mixer_l;
#endif
extern AudioMixer4 master_mixer_r;
extern AudioMixer4 master_mixer_l;
extern AudioAmplifier volume_r;
@ -137,6 +137,7 @@ void encoder_left_button_long(void);
void encoder_left_button_short(void);
void lcdml_voice_menu_control(void);
void UI_func_sound(uint8_t param);
#ifdef USE_FX
void UI_func_reverb_roomsize(uint8_t param);
void UI_func_reverb_damping(uint8_t param);
void UI_func_reverb_send(uint8_t param);
@ -150,6 +151,7 @@ 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);
#endif
void UI_func_filter_cutoff(uint8_t param);
void UI_func_filter_resonance(uint8_t param);
void UI_func_transpose(uint8_t param);
@ -942,9 +944,9 @@ void lcdml_menu_display(void)
MENU
***********************************************************************/
#ifdef USE_FX
void UI_func_reverb_roomsize(uint8_t param)
{
#ifdef USE_REVERB
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
@ -997,14 +999,10 @@ void UI_func_reverb_roomsize(uint8_t param)
#endif
eeprom_write();
}
#else
UI_function_not_enabled();
#endif
}
void UI_func_reverb_damping(uint8_t param)
{
#ifdef USE_REVERB
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
@ -1057,14 +1055,10 @@ void UI_func_reverb_damping(uint8_t param)
#endif
eeprom_write();
}
#else
UI_function_not_enabled();
#endif
}
void UI_func_reverb_send(uint8_t param)
{
#ifdef USE_REVERB
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
@ -1127,14 +1121,10 @@ void UI_func_reverb_send(uint8_t param)
#endif
eeprom_write();
}
#else
UI_function_not_enabled();
#endif
}
void UI_func_reverb_level(uint8_t param)
{
#ifdef USE_REVERB
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
@ -1187,9 +1177,6 @@ void UI_func_reverb_level(uint8_t param)
#endif
eeprom_write();
}
#else
UI_function_not_enabled();
#endif
}
void UI_func_chorus_frequency(uint8_t param)
@ -1403,7 +1390,6 @@ 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
@ -1456,9 +1442,6 @@ void UI_func_chorus_level(uint8_t param)
#endif
eeprom_write();
}
#else
UI_function_not_enabled();
#endif
}
void UI_func_delay_time(uint8_t param)
@ -1611,7 +1594,6 @@ 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
@ -1664,10 +1646,8 @@ void UI_func_delay_level(uint8_t param)
#endif
eeprom_write();
}
#else
UI_function_not_enabled();
#endif
}
#endif
void UI_func_filter_cutoff(uint8_t param)
{

@ -84,8 +84,8 @@
#define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE
#define MOD_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT
#define MOD_FILTER_CUTOFF_HZ 3000
// REVERB ENABLE/DISABLE
#define USE_REVERB 1
// FX-CHAIN ENABLE/DISABLE
#define USE_FX 1
//*************************************************************************************************
//* AUDIO SOFTWARE SETTINGS
@ -228,20 +228,18 @@ enum { DEXED, CHORUS, DELAY, REVERB};
#if defined(__MK66FX1M0__) // Teensy-3.6
// Teensy-3.6 settings
#define MIDI_DEVICE_USB_HOST 1
#if defined(USE_REVERB) && (F_CPU >= 240000000)
#define MAX_NOTES 16
#elif defined(USE_REVERB)
#define MAX_NOTES 8
#else
#if defined(USE_FX)
#define MAX_NOTES 11
#else
#define MAX_NOTES 16
#endif
#endif
#if defined (__MK64FX512__)
// Teensy-3.5 settings
#undef MIDI_DEVICE_USB_HOST
#define MAX_NOTES 6
#undef USE_REVERB
#define MAX_NOTES 11
#undef USE_FX
#endif
#define TRANSPOSE_FIX 24

Loading…
Cancel
Save