|
|
|
@ -36,15 +36,12 @@ |
|
|
|
|
#include "effect_modulated_delay.h" |
|
|
|
|
#include "effect_stereo_mono.h" |
|
|
|
|
#include "effect_mono_stereo.h" |
|
|
|
|
#include "effect_dynamics.h" |
|
|
|
|
#include "PluginFx.h" |
|
|
|
|
#include "UI.hpp" |
|
|
|
|
#include "source_microdexed.h" |
|
|
|
|
|
|
|
|
|
// Audio engines
|
|
|
|
|
AudioSourceMicroDexed* MicroDexed[NUM_DEXED]; |
|
|
|
|
AudioEffectDynamics* dexed_dynamic[NUM_DEXED]; |
|
|
|
|
AudioAmplifier* dexed_level[NUM_DEXED]; |
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
AudioSynthWaveform* chorus_modulator[NUM_DEXED]; |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
@ -138,17 +135,15 @@ AudioConnection patchCord13(stereo2mono, 1, dacOut, 1); |
|
|
|
|
//
|
|
|
|
|
uint16_t nDynamic = 0; |
|
|
|
|
#if defined(USE_FX) && MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 18]; |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 14]; |
|
|
|
|
#elif defined(USE_FX) && MOD_FILTER_OUTPUT == MOD_NO_FILTER_OUTPUT |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 17]; |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 13]; |
|
|
|
|
#else |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 6]; |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 4]; |
|
|
|
|
#endif |
|
|
|
|
void create_audio_engine_chain(uint8_t instance_id) |
|
|
|
|
{ |
|
|
|
|
MicroDexed[instance_id] = new AudioSourceMicroDexed(SAMPLE_RATE); |
|
|
|
|
dexed_dynamic[instance_id] = new AudioEffectDynamics(); |
|
|
|
|
dexed_level[instance_id] = new AudioAmplifier(); |
|
|
|
|
mono2stereo[instance_id] = new AudioEffectMonoStereo(); |
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
chorus_modulator[instance_id] = new AudioSynthWaveform(); |
|
|
|
@ -163,11 +158,9 @@ void create_audio_engine_chain(uint8_t instance_id) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, microdexed_peak_mixer, instance_id); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *dexed_dynamic[instance_id], 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*dexed_dynamic[instance_id], 0, *dexed_level[instance_id], 0); |
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*dexed_level[instance_id], 0, *chorus_mixer[instance_id], 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*dexed_level[instance_id], 0, *modchorus[instance_id], 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *chorus_mixer[instance_id], 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *modchorus[instance_id], 0); |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*chorus_modulator[instance_id], 0, *modchorus_filter[instance_id], 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*modchorus_filter[instance_id], 0, *modchorus[instance_id], 1); |
|
|
|
@ -184,7 +177,7 @@ void create_audio_engine_chain(uint8_t instance_id) |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 0, reverb_mixer_r, instance_id); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 1, reverb_mixer_l, instance_id); |
|
|
|
|
#else |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*dexed_level[instance_id], 0, *mono2stereo[instance_id], 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*MicoDexed[instance_id], 0, *mono2stereo[instance_id], 0); |
|
|
|
|
#endif |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 0, master_mixer_r, instance_id); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 1, master_mixer_l, instance_id); |
|
|
|
@ -450,22 +443,11 @@ void setup() |
|
|
|
|
show_cpu_and_mem_usage(); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
MicroDexed[instance_id]->fx.Gain = 1.0; |
|
|
|
|
|
|
|
|
|
// init dynamics for dexed
|
|
|
|
|
dexed_dynamic[instance_id]->limit(); |
|
|
|
|
//dexed_dynamic[instance_id]->autoMakeupGain();
|
|
|
|
|
//dexed_dynamic[instance_id]->compression();
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// init master_mixer
|
|
|
|
|
#if NUM_DEXED > 1 |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
//master_mixer_r.gain(instance_id, pseudo_log_curve(0.5));
|
|
|
|
|
//master_mixer_l.gain(instance_id, pseudo_log_curve(0.5));
|
|
|
|
|
master_mixer_r.gain(instance_id, 1.0); |
|
|
|
|
master_mixer_l.gain(instance_id, 1.0); |
|
|
|
|
} |
|
|
|
@ -710,8 +692,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) |
|
|
|
|
#else*/ |
|
|
|
|
|
|
|
|
|
//dexed_level[instance_id]->gain(pseudo_log_curve(mapfloat(map(inValue, 0, 0x7f, 0, configuration.dexed[instance_id].sound_intensity), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX))); // That's not right... have to fix this!
|
|
|
|
|
dexed_level[instance_id]->gain(mapfloat(map(inValue, 0, 0x7f, 0, configuration.dexed[instance_id].sound_intensity), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); |
|
|
|
|
|
|
|
|
|
MicroDexed[instance_id]->fx.Gain = mapfloat(map(inValue, 0, 0x7f, 0, configuration.dexed[instance_id].sound_intensity), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX); |
|
|
|
|
//#endif
|
|
|
|
|
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sound_intensity)) |
|
|
|
|
{ |
|
|
|
@ -1774,7 +1755,6 @@ void set_fx_params(void) |
|
|
|
|
reverb_mixer_l.gain(instance_id, pseudo_log_curve(mapfloat(configuration.fx.reverb_send[instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0))); |
|
|
|
|
|
|
|
|
|
// DEXED FILTER
|
|
|
|
|
//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(); |
|
|
|
@ -1808,7 +1788,7 @@ void set_voiceconfig_params(uint8_t instance_id) |
|
|
|
|
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))); |
|
|
|
|
MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX); |
|
|
|
|
|
|
|
|
|
// PANORAMA
|
|
|
|
|
mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); |
|
|
|
@ -1844,14 +1824,16 @@ float pseudo_log_curve(float value) |
|
|
|
|
#endif |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
// return (mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0));
|
|
|
|
|
return (mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0)); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
float g = mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0); |
|
|
|
|
|
|
|
|
|
if (g == 0.0) |
|
|
|
|
return (0.001); |
|
|
|
|
else |
|
|
|
|
return (g); |
|
|
|
|
*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc
|
|
|
|
|