|
|
|
@ -35,112 +35,154 @@ |
|
|
|
|
#include "dexed_sysex.h" |
|
|
|
|
#include "effect_modulated_delay.h" |
|
|
|
|
#include "effect_stereo_mono.h" |
|
|
|
|
#include "effect_mono_stereo.h" |
|
|
|
|
#include "PluginFx.h" |
|
|
|
|
#include "UI.hpp" |
|
|
|
|
#include "source_microdexed.h" |
|
|
|
|
|
|
|
|
|
// Audio engines
|
|
|
|
|
AudioAnalyzePeak peak1; |
|
|
|
|
AudioSourceMicroDexed* MicroDexed[NUM_DEXED]; |
|
|
|
|
AudioEffectDelay delay1; |
|
|
|
|
AudioEffectModulatedDelay modchorus; |
|
|
|
|
AudioSynthWaveform modulator; |
|
|
|
|
AudioMixer4 chorus_mixer; |
|
|
|
|
AudioMixer4 delay_mixer; |
|
|
|
|
AudioMixer4 delay_fb_mixer; |
|
|
|
|
AudioMixer4 master_mixer_r; |
|
|
|
|
AudioMixer4 master_mixer_l; |
|
|
|
|
AudioAmplifier volume_r; |
|
|
|
|
AudioAmplifier volume_l; |
|
|
|
|
AudioEffectMonoStereo* mono2stereo[NUM_DEXED]; |
|
|
|
|
AudioSynthWaveformDc* pan[NUM_DEXED]; |
|
|
|
|
|
|
|
|
|
// single used objects
|
|
|
|
|
AudioAnalyzePeak microdexed_peak; |
|
|
|
|
AudioMixer4 microdexed_peak_mixer; |
|
|
|
|
AudioSynthWaveform chorus_modulator; |
|
|
|
|
AudioAmplifier modchorus_inverter; |
|
|
|
|
#if defined(AUDIO_DEVICE_USB) |
|
|
|
|
AudioOutputUSB usb1; |
|
|
|
|
|
|
|
|
|
// FX chain left
|
|
|
|
|
AudioMixer4 chorus_send_mixer_l; |
|
|
|
|
AudioMixer4 delay_send_mixer_l; |
|
|
|
|
AudioMixer4 delay_fb_mixer_l; |
|
|
|
|
AudioEffectDelay delay_l; |
|
|
|
|
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); |
|
|
|
|
AudioEffectModulatedDelay modchorus_l; |
|
|
|
|
AudioConnection patchCord5(chorus_modulator, 0, modchorus_l, 1); |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
|
AudioFilterBiquad modchorus_filter_l; |
|
|
|
|
AudioConnection patchCord6(modchorus_l, modchorus_filter_l); |
|
|
|
|
AudioConnection patchCord7(modchorus_filter_l, modchorus_inverter); |
|
|
|
|
AudioConnection patchCord8(modchorus_inverter_l, 0, master_mixer_l, CHORUS ); |
|
|
|
|
#else |
|
|
|
|
AudioConnection patchCord9(modchorus_l, modchorus_inverter); |
|
|
|
|
AudioConnection patchCord10(modchorus_inverter, 0, master_mixer_l, CHORUS); |
|
|
|
|
#endif |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
AudioMixer4 reverb_send_mixer_l; |
|
|
|
|
AudioEffectFreeverb freeverb_l; |
|
|
|
|
AudioConnection patchCord11(reverb_send_mixer_l, freeverb_l); |
|
|
|
|
AudioConnection patchCord12(freeverb_l, 0, master_mixer_r, REVERB); |
|
|
|
|
#endif |
|
|
|
|
AudioEffectStereoMono stereomono1; |
|
|
|
|
|
|
|
|
|
// Audio connections
|
|
|
|
|
AudioConnection patchCord1(modulator, 0, modchorus, 1); |
|
|
|
|
AudioConnection patchCord2(chorus_mixer, 0, modchorus, 0); |
|
|
|
|
AudioConnection patchCord3(delay_mixer, 0, delay_fb_mixer, 0); |
|
|
|
|
AudioConnection patchCord4(delay_fb_mixer, delay1); |
|
|
|
|
AudioConnection patchCord5(delay1, 0, delay_fb_mixer, 1); |
|
|
|
|
AudioConnection patchCord6(delay1, 0, master_mixer_r, 2); |
|
|
|
|
AudioConnection patchCord7(delay1, 0, master_mixer_l, 2); |
|
|
|
|
AudioConnection patchCord8(master_mixer_r, volume_r); |
|
|
|
|
AudioConnection patchCord9(master_mixer_l, volume_l); |
|
|
|
|
AudioConnection patchCord10(volume_r, 0, stereomono1, 0); |
|
|
|
|
AudioConnection patchCord11(volume_l, 0, stereomono1, 1); |
|
|
|
|
|
|
|
|
|
// FX chain right
|
|
|
|
|
AudioMixer4 chorus_send_mixer_r; |
|
|
|
|
AudioMixer4 delay_send_mixer_r; |
|
|
|
|
AudioMixer4 delay_fb_mixer_r; |
|
|
|
|
AudioEffectDelay delay_r; |
|
|
|
|
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); |
|
|
|
|
AudioEffectModulatedDelay modchorus_r; |
|
|
|
|
AudioConnection patchCord17(chorus_modulator, 0, modchorus_r, 1); |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
|
AudioFilterBiquad modchorus_filter; |
|
|
|
|
AudioConnection patchCord12(modchorus, modchorus_filter); |
|
|
|
|
AudioConnection patchCord13(modchorus_filter, 0, master_mixer_r, 3); |
|
|
|
|
AudioConnection patchCord14(modchorus_filter, modchorus_inverter); |
|
|
|
|
AudioConnection patchCord15(modchorus_inverter, 0, master_mixer_l, 3); |
|
|
|
|
AudioFilterBiquad modchorus_filter_r; |
|
|
|
|
AudioConnection patchCord18(modchorus_r, modchorus_filter_r); |
|
|
|
|
AudioConnection patchCord19(modchorus_filter_r, 0, master_mixer_r, CHORUS ); |
|
|
|
|
#else |
|
|
|
|
AudioConnection patchCord16(modchorus, 0, master_mixer_r, 3); |
|
|
|
|
AudioConnection patchCord17(modchorus, modchorus_inverter); |
|
|
|
|
AudioConnection patchCord18(modchorus_inverter, 0, master_mixer_l, 3); |
|
|
|
|
AudioConnection patchCord20(modchorus_r, 0, master_mixer_r, CHORUS); |
|
|
|
|
#endif |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
AudioMixer4 reverb_mixer; |
|
|
|
|
AudioEffectFreeverbStereo freeverbs1; |
|
|
|
|
AudioConnection patchCord19(reverb_mixer, 0, freeverbs1, 0); |
|
|
|
|
AudioConnection patchCord20(freeverbs1, 0, master_mixer_r, 1); |
|
|
|
|
AudioConnection patchCord21(freeverbs1, 1, master_mixer_l, 1); |
|
|
|
|
AudioMixer4 reverb_send_mixer_r; |
|
|
|
|
AudioEffectFreeverb freeverb_r; |
|
|
|
|
AudioConnection patchCord21(reverb_send_mixer_r, freeverb_r); |
|
|
|
|
AudioConnection patchCord22(freeverb_r, 0, master_mixer_r, REVERB); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// FX chain tail
|
|
|
|
|
AudioMixer4 microdexed_mixer_r; |
|
|
|
|
AudioMixer4 microdexed_mixer_l; |
|
|
|
|
AudioMixer4 master_mixer_r; |
|
|
|
|
AudioMixer4 master_mixer_l; |
|
|
|
|
AudioAmplifier volume_r; |
|
|
|
|
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 patchCord25(master_mixer_r, volume_r); |
|
|
|
|
AudioConnection patchCord26(master_mixer_l, volume_l); |
|
|
|
|
AudioConnection patchCord27(volume_r, 0, stereo2mono, 0); |
|
|
|
|
AudioConnection patchCord28(volume_l, 0, stereo2mono, 1); |
|
|
|
|
AudioConnection patchCord29(volume_r, master_peak_r); |
|
|
|
|
AudioConnection patchCord30(volume_l, master_peak_l); |
|
|
|
|
AudioConnection patchCord31(microdexed_peak_mixer, microdexed_peak); |
|
|
|
|
|
|
|
|
|
// Outputs
|
|
|
|
|
#ifdef AUDIO_DEVICE_USB |
|
|
|
|
AudioConnection patchCord22(stereomono1, 0, usb1, 0); |
|
|
|
|
AudioConnection patchCord23(stereomono1, 1, usb1, 1); |
|
|
|
|
AudioOutputUSB usb1; |
|
|
|
|
AudioConnection patchCord32(stereo2mono, 0, usb1, 0); |
|
|
|
|
AudioConnection patchCord33(stereo2mono, 1, usb1, 1); |
|
|
|
|
#endif |
|
|
|
|
#if defined(TEENSY_AUDIO_BOARD) |
|
|
|
|
AudioOutputI2S i2s1; |
|
|
|
|
AudioConnection patchCord24(stereomono1, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord25(stereomono1, 1, i2s1, 1); |
|
|
|
|
AudioConnection patchCord34(stereo2mono, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord35(stereo2mono, 1, i2s1, 1); |
|
|
|
|
AudioControlSGTL5000 sgtl5000_1; |
|
|
|
|
#elif defined (I2S_AUDIO_ONLY) |
|
|
|
|
AudioOutputI2S i2s1; |
|
|
|
|
AudioConnection patchCord26(stereomono1, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord27(stereomono1, 1, i2s1, 1); |
|
|
|
|
AudioConnection patchCord36(stereo2mono, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord37(stereo2mono, 1, i2s1, 1); |
|
|
|
|
#elif defined(TGA_AUDIO_BOARD) |
|
|
|
|
AudioOutputI2S i2s1; |
|
|
|
|
AudioConnection patchCord28(stereomono1, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord29(stereomono1, 1, i2s1, 1); |
|
|
|
|
AudioConnection patchCord38(stereo2mono, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord39(stereo2mono, 1, i2s1, 1); |
|
|
|
|
AudioControlWM8731master wm8731_1; |
|
|
|
|
#elif defined(PT8211_AUDIO) |
|
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
|
AudioConnection patchCord30(stereomono1, 0, pt8211_1, 0); |
|
|
|
|
AudioConnection patchCord31(stereomono1, 1, pt8211_1, 1); |
|
|
|
|
AudioConnection patchCord40(stereo2mono, 0, pt8211_1, 0); |
|
|
|
|
AudioConnection patchCord41(stereo2mono, 1, pt8211_1, 1); |
|
|
|
|
#elif defined(TEENSY_DAC_SYMMETRIC) |
|
|
|
|
AudioOutputAnalogStereo dacOut; |
|
|
|
|
AudioMixer4 invMixer; |
|
|
|
|
AudioConnection patchCord32(stereomono1, 0, dacOut , 0); |
|
|
|
|
AudioConnection patchCord33(stereomono1, 1, invMixer, 0); |
|
|
|
|
AudioConnection patchCord34(invMixer, 0, dacOut , 1); |
|
|
|
|
AudioConnection patchCord42(stereo2mono, 0, dacOut , 0); |
|
|
|
|
AudioConnection patchCord43(stereo2mono, 1, invMixer, 0); |
|
|
|
|
AudioConnection patchCord44(invMixer, 0, dacOut , 1); |
|
|
|
|
#else |
|
|
|
|
AudioOutputAnalogStereo dacOut; |
|
|
|
|
AudioConnection patchCord35(stereomono1, 0, dacOut, 0); |
|
|
|
|
AudioConnection patchCord36(stereomono1, 1, dacOut, 1); |
|
|
|
|
AudioConnection patchCord45(stereo2mono, 0, dacOut, 0); |
|
|
|
|
AudioConnection patchCord46(stereo2mono, 1, dacOut, 1); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Dynamic patching
|
|
|
|
|
// Dynamic patching of MicroDexed objects
|
|
|
|
|
//
|
|
|
|
|
uint8_t nDynamic = 0; |
|
|
|
|
#ifdef USE_REVERB |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 7]; |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 11]; |
|
|
|
|
#else |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 6]; |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 9]; |
|
|
|
|
#endif |
|
|
|
|
void create_audio_connections(AudioSourceMicroDexed &d, uint8_t instance_id) |
|
|
|
|
void create_audio_connections(AudioSourceMicroDexed &dexed, AudioEffectMonoStereo &mono2stereo, AudioSynthWaveformDc &pan, uint8_t instance_id) |
|
|
|
|
{ |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(d, peak1); |
|
|
|
|
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); |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(d, 0, reverb_mixer, instance_id); |
|
|
|
|
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(d, 0, delay_mixer, instance_id); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(d, 0, chorus_mixer, instance_id); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(d, 0 , master_mixer_r, 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(d, 0 , master_mixer_l, 0); |
|
|
|
|
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; |
|
|
|
@ -161,13 +203,17 @@ uint8_t active_voices = 0; |
|
|
|
|
elapsedMillis cpu_mem_millis; |
|
|
|
|
#endif |
|
|
|
|
//uint32_t overload = 0;
|
|
|
|
|
uint32_t peak = 0; |
|
|
|
|
uint32_t peak_dexed = 0; |
|
|
|
|
float peak_dexed_value = 0.0; |
|
|
|
|
uint32_t peak_r = 0; |
|
|
|
|
uint32_t peak_l = 0; |
|
|
|
|
bool eeprom_update_flag = false; |
|
|
|
|
config_t configuration; |
|
|
|
|
uint8_t selected_dexed_instance = 0; |
|
|
|
|
|
|
|
|
|
// Allocate the delay lines for chorus
|
|
|
|
|
int16_t delayline[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
|
int16_t delayline_r[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
|
int16_t delayline_l[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_LCD_UI |
|
|
|
|
/***********************************************************************
|
|
|
|
@ -217,14 +263,27 @@ void setup() |
|
|
|
|
|
|
|
|
|
setup_midi_devices(); |
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < NUM_DEXED; i++) |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
if (instance_id < MAX_DEXED) |
|
|
|
|
{ |
|
|
|
|
Serial.print(F("Creating MicroDexed instance ")); |
|
|
|
|
Serial.print(i, DEC); |
|
|
|
|
MicroDexed[i] = new AudioSourceMicroDexed(SAMPLE_RATE); |
|
|
|
|
create_audio_connections(*MicroDexed[i], i); |
|
|
|
|
Serial.print(instance_id, DEC); |
|
|
|
|
MicroDexed[instance_id] = new AudioSourceMicroDexed(SAMPLE_RATE); |
|
|
|
|
mono2stereo[instance_id] = new AudioEffectMonoStereo(); |
|
|
|
|
pan[instance_id] = new AudioSynthWaveformDc(); |
|
|
|
|
create_audio_connections(*MicroDexed[instance_id], *mono2stereo[instance_id], *pan[instance_id], instance_id); |
|
|
|
|
Serial.println(F("... created")); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Serial.print(F("Ignoring instance ")); |
|
|
|
|
Serial.print(instance_id, DEC); |
|
|
|
|
Serial.print(F(" (maximum allowed: ")); |
|
|
|
|
Serial.print(MAX_DEXED, DEC); |
|
|
|
|
Serial.println(F(")")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Init EEPROM if both buttons are pressed at startup
|
|
|
|
|
/* if (digitalRead(BUT_R_PIN) == LOW)
|
|
|
|
@ -340,9 +399,14 @@ void setup() |
|
|
|
|
change_disp_sd(true); |
|
|
|
|
#endif |
|
|
|
|
// Init effects
|
|
|
|
|
memset(delayline, 0, sizeof(delayline)); |
|
|
|
|
if (!modchorus.begin(delayline, MOD_DELAY_SAMPLE_BUFFER)) { |
|
|
|
|
Serial.println(F("AudioEffectModulatedDelay - begin failed")); |
|
|
|
|
memset(delayline_r, 0, sizeof(delayline_r)); |
|
|
|
|
if (!modchorus_r.begin(delayline_r, MOD_DELAY_SAMPLE_BUFFER)) { |
|
|
|
|
Serial.println(F("AudioEffectModulatedDelay - begin failed (R)")); |
|
|
|
|
while (1); |
|
|
|
|
} |
|
|
|
|
memset(delayline_l, 0, sizeof(delayline_l)); |
|
|
|
|
if (!modchorus_l.begin(delayline_l, MOD_DELAY_SAMPLE_BUFFER)) { |
|
|
|
|
Serial.println(F("AudioEffectModulatedDelay - begin failed (L)")); |
|
|
|
|
while (1); |
|
|
|
|
} |
|
|
|
|
#ifdef DEBUG |
|
|
|
@ -350,76 +414,102 @@ void setup() |
|
|
|
|
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC); |
|
|
|
|
Serial.println(F(" samples")); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
master_mixer_r.gain(DEXED, 1.0); |
|
|
|
|
master_mixer_l.gain(DEXED, 1.0); |
|
|
|
|
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
// INIT PEAK MIXER
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
#ifdef USE_REVERB |
|
|
|
|
// INIT REVERB
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
reverb_mixer.gain(instance_id, mapfloat(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0)); |
|
|
|
|
master_mixer_r.gain(REVERB, 1.0); |
|
|
|
|
master_mixer_l.gain(REVERB, 1.0); |
|
|
|
|
freeverbs1.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); |
|
|
|
|
freeverbs1.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_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, 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
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
delay_mixer.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, 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)); |
|
|
|
|
|
|
|
|
|
// 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)); |
|
|
|
|
|
|
|
|
|
// DEXED FILTER
|
|
|
|
|
MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 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(); |
|
|
|
|
|
|
|
|
|
// PANORAMA
|
|
|
|
|
pan[instance_id]->amplitude(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// REVERB
|
|
|
|
|
master_mixer_r.gain(REVERB, 1.0); |
|
|
|
|
master_mixer_l.gain(REVERB, 1.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); |
|
|
|
|
delay1.delay(0, mapfloat(configuration.delay_time * 10, DELAY_TIME_MIN, DELAY_TIME_MAX, 0.0, float(DELAY_TIME_MAX))); |
|
|
|
|
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
|
|
|
|
|
//delay_fb_mixer.gain(0, 1.0 - (mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0))); // original signal
|
|
|
|
|
delay_fb_mixer.gain(0, 1.0); // original signal
|
|
|
|
|
delay_fb_mixer.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
|
|
|
|
|
delay_fb_mixer_r.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
|
|
|
|
|
|
|
|
|
|
// INIT CHORUS
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
chorus_mixer.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 1.0)); |
|
|
|
|
// CHORUS
|
|
|
|
|
master_mixer_r.gain(CHORUS, 1.0); |
|
|
|
|
master_mixer_l.gain(CHORUS, 1.0); |
|
|
|
|
switch (configuration.chorus_waveform) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
modulator.begin(WAVEFORM_TRIANGLE); |
|
|
|
|
chorus_modulator.begin(WAVEFORM_TRIANGLE); |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
modulator.begin(WAVEFORM_SINE); |
|
|
|
|
chorus_modulator.begin(WAVEFORM_SINE); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
modulator.begin(WAVEFORM_TRIANGLE); |
|
|
|
|
chorus_modulator.begin(WAVEFORM_TRIANGLE); |
|
|
|
|
} |
|
|
|
|
modulator.phase(0); |
|
|
|
|
modulator.frequency(configuration.chorus_frequency / 10.0); |
|
|
|
|
modulator.amplitude(mapfloat(configuration.chorus_depth, CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX, 0.0, 1.0)); |
|
|
|
|
modulator.offset(0.0); |
|
|
|
|
chorus_modulator.phase(0); |
|
|
|
|
chorus_modulator.frequency(configuration.chorus_frequency / 10.0); |
|
|
|
|
chorus_modulator.amplitude(mapfloat(configuration.chorus_depth, CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX, 0.0, 1.0)); |
|
|
|
|
chorus_modulator.offset(0.0); |
|
|
|
|
#if MOD_FILTER_OUTPUT == MOD_BUTTERWORTH_FILTER_OUTPUT |
|
|
|
|
// Butterworth filter, 12 db/octave
|
|
|
|
|
modchorus_filter.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707); |
|
|
|
|
modchorus_filter_r.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707); |
|
|
|
|
modchorus_filter_l.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707); |
|
|
|
|
#elif MOD_FILTER_OUTPUT == MOD_LINKWITZ_RILEY_FILTER_OUTPUT |
|
|
|
|
// Linkwitz-Riley filter, 48 dB/octave
|
|
|
|
|
modchorus_filter.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
|
modchorus_filter.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
|
modchorus_filter.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
|
modchorus_filter.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
|
modchorus_filter_r.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
|
modchorus_filter_r.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
|
modchorus_filter_r.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
|
modchorus_filter_r.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
|
modchorus_filter_l.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
|
modchorus_filter_l.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
|
modchorus_filter_l.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
|
modchorus_filter_l.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// MONO/STEREO
|
|
|
|
|
if (configuration.mono == 0) |
|
|
|
|
modchorus_inverter.gain(-1.0); // stereo mode
|
|
|
|
|
else |
|
|
|
|
modchorus_inverter.gain(1.0); // mono mode
|
|
|
|
|
|
|
|
|
|
// Filter
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 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(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// set initial volume and pan (read from EEPROM)
|
|
|
|
|
set_volume(configuration.vol, configuration.pan, configuration.mono); |
|
|
|
|
// set initial volume
|
|
|
|
|
set_volume(configuration.vol, configuration.mono); |
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
|
// Initialize processor and memory measurements
|
|
|
|
@ -527,10 +617,17 @@ void loop() |
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
|
if (cpu_mem_millis >= SHOW_CPU_LOAD_MSEC) |
|
|
|
|
{ |
|
|
|
|
if (peak1.available()) |
|
|
|
|
if (master_peak_r.available()) |
|
|
|
|
if (master_peak_r.read() > 0.99) |
|
|
|
|
peak_r++; |
|
|
|
|
if (master_peak_l.available()) |
|
|
|
|
if (master_peak_l.read() > 0.99) |
|
|
|
|
peak_l++; |
|
|
|
|
if (microdexed_peak.available()) |
|
|
|
|
{ |
|
|
|
|
if (peak1.read() > 0.99) |
|
|
|
|
peak++; |
|
|
|
|
peak_dexed_value = microdexed_peak.read(); |
|
|
|
|
if (peak_dexed_value > 0.99) |
|
|
|
|
peak_dexed++; |
|
|
|
|
} |
|
|
|
|
cpu_mem_millis -= SHOW_CPU_LOAD_MSEC; |
|
|
|
|
show_cpu_and_mem_usage(); |
|
|
|
@ -587,6 +684,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) |
|
|
|
|
if (inValue < MAX_BANKS - 1) |
|
|
|
|
{ |
|
|
|
|
configuration.dexed[instance_id].bank = inValue; |
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
@ -613,6 +711,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) |
|
|
|
|
case 5: // Portamento time
|
|
|
|
|
configuration.dexed[instance_id].portamento_time = inValue; |
|
|
|
|
MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
case 7: // Instance Volume
|
|
|
|
|
#ifdef DEBUG |
|
|
|
@ -620,19 +719,22 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) |
|
|
|
|
#endif |
|
|
|
|
configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 0x7f, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); |
|
|
|
|
MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 1.0); |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
case 10: // Pan
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("PANORAMA CC")); |
|
|
|
|
#endif |
|
|
|
|
configuration.pan = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX); |
|
|
|
|
set_volume(configuration.vol, configuration.pan, configuration.mono); |
|
|
|
|
configuration.dexed[instance_id].pan = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX); |
|
|
|
|
pan[instance_id]->amplitude(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
case 32: // BankSelect LSB
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("BANK-SELECT CC")); |
|
|
|
|
#endif |
|
|
|
|
configuration.dexed[instance_id].bank = inValue; |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
case 64: |
|
|
|
|
MicroDexed[instance_id]->setSustain(inValue > 63); |
|
|
|
@ -650,27 +752,36 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) |
|
|
|
|
break; |
|
|
|
|
case 65: |
|
|
|
|
MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
case 103: // CC 103: filter resonance
|
|
|
|
|
configuration.dexed[instance_id].filter_resonance = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); |
|
|
|
|
MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0); |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
case 104: // CC 104: filter cutoff
|
|
|
|
|
configuration.dexed[instance_id].filter_cutoff = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); |
|
|
|
|
MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0); |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
case 105: // CC 105: delay time
|
|
|
|
|
configuration.delay_time = map(inValue, 0, 0x7f, DELAY_TIME_MIN, DELAY_TIME_MAX); |
|
|
|
|
delay1.delay(0, configuration.delay_time * 10); |
|
|
|
|
delay_r.delay(0, configuration.delay_time * 10); |
|
|
|
|
delay_l.delay(0, configuration.delay_time * 10); |
|
|
|
|
eeprom_write(); |
|
|
|
|
case 106: // CC 106: delay feedback
|
|
|
|
|
configuration.delay_feedback = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX); |
|
|
|
|
delay_fb_mixer.gain(1, configuration.delay_feedback / 100.0 ); // amount of feedback
|
|
|
|
|
delay_fb_mixer.gain(0, 1.0 - configuration.delay_feedback / 100.0); // original signalbreak;
|
|
|
|
|
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;
|
|
|
|
|
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); |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
case 120: |
|
|
|
|
MicroDexed[instance_id]->panic(); |
|
|
|
@ -683,12 +794,13 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) |
|
|
|
|
break; |
|
|
|
|
case 126: |
|
|
|
|
MicroDexed[instance_id]->setMonoMode(true); |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
case 127: |
|
|
|
|
MicroDexed[instance_id]->setMonoMode(false); |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1073,73 +1185,55 @@ bool checkMidiChannel(byte inChannel, uint8_t instance_id) |
|
|
|
|
VOLUME HELPER |
|
|
|
|
******************************************************************************/ |
|
|
|
|
|
|
|
|
|
void set_volume(uint8_t v, int8_t p, uint8_t m) |
|
|
|
|
void set_volume(uint8_t v, uint8_t m) |
|
|
|
|
{ |
|
|
|
|
float tmp2; |
|
|
|
|
|
|
|
|
|
configuration.vol = v; |
|
|
|
|
|
|
|
|
|
if (configuration.vol > 100) |
|
|
|
|
configuration.vol = 100; |
|
|
|
|
|
|
|
|
|
//configuration.dexed[instance_id].pan = p; // TODO: Fixing pan per Dexed
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
configuration.pan = p; |
|
|
|
|
} |
|
|
|
|
configuration.mono = m; |
|
|
|
|
|
|
|
|
|
uint16_t tmp = v / 100.0 * 1023.0 + 0.5; |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
tmp2 = mapfloat(configuration.pan - 20, PANORAMA_MIN, PANORAMA_MAX, 0.0, 1.0); |
|
|
|
|
} |
|
|
|
|
float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Setting volume: VOL=")); |
|
|
|
|
Serial.print(v, DEC); |
|
|
|
|
Serial.print(F("[")); |
|
|
|
|
Serial.print(tmp3, 3); |
|
|
|
|
Serial.print(F("] PAN=")); |
|
|
|
|
Serial.print(p - 20, DEC); |
|
|
|
|
Serial.print(F("[")); |
|
|
|
|
Serial.print(tmp2, 3); |
|
|
|
|
Serial.print(F("] ")); |
|
|
|
|
Serial.print(tmp3 * sinf(tmp2 * PI / 2), 3); |
|
|
|
|
Serial.print(F("/")); |
|
|
|
|
Serial.println(tmp3 * cosf(tmp2 * PI / 2), 3); |
|
|
|
|
Serial.println(v, DEC); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// float v = (float)(a * (a + 2))/(float)(1 << 20); // (pseudo-) logarithmic curve for volume control
|
|
|
|
|
// http://files.csound-tutorial.net/floss_manual/Release03/Cs_FM_03_ScrapBook/b-panning-and-spatialization.html
|
|
|
|
|
volume_r.gain(tmp3 * sinf(tmp2 * PI / 2)); |
|
|
|
|
volume_l.gain(tmp3 * cosf(tmp2 * PI / 2)); |
|
|
|
|
volume_r.gain(v); |
|
|
|
|
volume_l.gain(v); |
|
|
|
|
|
|
|
|
|
switch (m) |
|
|
|
|
{ |
|
|
|
|
case 0: // stereo
|
|
|
|
|
stereomono1.stereo(true); |
|
|
|
|
stereo2mono.stereo(true); |
|
|
|
|
modchorus_inverter.gain(-1.0); // stereo mode
|
|
|
|
|
break; |
|
|
|
|
case 1: // mono both
|
|
|
|
|
stereomono1.stereo(false); |
|
|
|
|
stereo2mono.stereo(false); |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
configuration.pan = PANORAMA_DEFAULT; |
|
|
|
|
configuration.dexed[instance_id].pan = PANORAMA_DEFAULT; |
|
|
|
|
} |
|
|
|
|
modchorus_inverter.gain(1.0); // stereo mode
|
|
|
|
|
break; |
|
|
|
|
case 2: // mono right
|
|
|
|
|
volume_l.gain(0.0); |
|
|
|
|
stereomono1.stereo(false); |
|
|
|
|
configuration.pan = PANORAMA_DEFAULT; |
|
|
|
|
stereo2mono.stereo(false); |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
configuration.dexed[instance_id].pan = 0.0; |
|
|
|
|
pan[instance_id]->amplitude(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); |
|
|
|
|
} |
|
|
|
|
modchorus_inverter.gain(1.0); // stereo mode
|
|
|
|
|
break; |
|
|
|
|
case 3: // mono left
|
|
|
|
|
volume_r.gain(0.0); |
|
|
|
|
stereomono1.stereo(false); |
|
|
|
|
configuration.pan = PANORAMA_DEFAULT; |
|
|
|
|
stereo2mono.stereo(false); |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
configuration.dexed[instance_id].pan = 1.0; |
|
|
|
|
pan[instance_id]->amplitude(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); |
|
|
|
|
} |
|
|
|
|
modchorus_inverter.gain(1.0); // stereo mode
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -1215,7 +1309,6 @@ void check_configuration(void) |
|
|
|
|
configuration.instance_mode = constrain(configuration.instance_mode, INSTANCE_MODE_MIN, INSTANCE_MODE_MAX); |
|
|
|
|
configuration.instance_splitpoint = constrain(configuration.instance_splitpoint, INSTANCE_SPLITPOINT_MAX, INSTANCE_SPLITPOINT_MAX); |
|
|
|
|
configuration.vol = constrain(configuration.vol, VOLUME_MIN, VOLUME_MAX); |
|
|
|
|
configuration.pan = constrain(configuration.pan, PANORAMA_MIN, PANORAMA_MAX); |
|
|
|
|
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); |
|
|
|
@ -1235,6 +1328,7 @@ void check_configuration(void) |
|
|
|
|
configuration.dexed[instance_id].filter_cutoff = constrain(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); |
|
|
|
|
configuration.dexed[instance_id].filter_resonance = constrain(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); |
|
|
|
|
configuration.dexed[instance_id].sound_intensity = constrain(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); |
|
|
|
|
configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX); |
|
|
|
|
configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose, TRANSPOSE_MIN, TRANSPOSE_MAX); |
|
|
|
|
configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune, TUNE_MIN, TUNE_MAX); |
|
|
|
|
configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony, POLYPHONY_MIN, POLYPHONY_MAX); |
|
|
|
@ -1268,7 +1362,6 @@ void init_configuration(void) |
|
|
|
|
configuration.instance_mode = INSTANCE_MODE_DEFAULT; |
|
|
|
|
configuration.instance_splitpoint = INSTANCE_SPLITPOINT_DEFAULT; |
|
|
|
|
configuration.vol = VOLUME_DEFAULT; |
|
|
|
|
configuration.pan = PANORAMA_DEFAULT; |
|
|
|
|
configuration.mono = MONO_DEFAULT; |
|
|
|
|
configuration.reverb_roomsize = REVERB_ROOMSIZE_DEFAULT; |
|
|
|
|
configuration.reverb_damping = REVERB_DAMPING_DEFAULT; |
|
|
|
@ -1288,6 +1381,7 @@ void init_configuration(void) |
|
|
|
|
configuration.dexed[instance_id].filter_cutoff = FILTER_CUTOFF_DEFAULT; |
|
|
|
|
configuration.dexed[instance_id].filter_resonance = FILTER_RESONANCE_DEFAULT; |
|
|
|
|
configuration.dexed[instance_id].sound_intensity = SOUND_INTENSITY_DEFAULT; |
|
|
|
|
configuration.dexed[instance_id].pan = PANORAMA_DEFAULT; |
|
|
|
|
configuration.dexed[instance_id].transpose = TRANSPOSE_DEFAULT; |
|
|
|
|
configuration.dexed[instance_id].tune = TUNE_DEFAULT; |
|
|
|
|
configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT; |
|
|
|
@ -1367,25 +1461,31 @@ void show_cpu_and_mem_usage(void) |
|
|
|
|
sum_overload += MicroDexed[instance_id]->overload; |
|
|
|
|
MicroDexed[instance_id]->render_time_max = 0; |
|
|
|
|
} |
|
|
|
|
Serial.print(F("CPU: ")); |
|
|
|
|
Serial.print(F("CPU:")); |
|
|
|
|
Serial.print(AudioProcessorUsage(), 2); |
|
|
|
|
Serial.print(F("% CPU MAX: ")); |
|
|
|
|
Serial.print(F("%|CPUMAX:")); |
|
|
|
|
Serial.print(AudioProcessorUsageMax(), 2); |
|
|
|
|
Serial.print(F("% MEM: ")); |
|
|
|
|
Serial.print(F("%|MEM:")); |
|
|
|
|
Serial.print(AudioMemoryUsage(), DEC); |
|
|
|
|
Serial.print(F(" MEM MAX: ")); |
|
|
|
|
Serial.print(F("|MEMMAX:")); |
|
|
|
|
Serial.print(AudioMemoryUsageMax(), DEC); |
|
|
|
|
Serial.print(F(" RENDER_TIME_MAX: ")); |
|
|
|
|
Serial.print(F("|RENDERTIMEMAX:")); |
|
|
|
|
Serial.print(sum_render_time_max, DEC); |
|
|
|
|
Serial.print(F(" XRUN: ")); |
|
|
|
|
Serial.print(F("|XRUN:")); |
|
|
|
|
Serial.print(sum_xrun, DEC); |
|
|
|
|
Serial.print(F(" OVERLOAD: ")); |
|
|
|
|
Serial.print(F("|OVERLOAD:")); |
|
|
|
|
Serial.print(sum_overload, DEC); |
|
|
|
|
Serial.print(F(" PEAK: ")); |
|
|
|
|
Serial.print(peak, DEC); |
|
|
|
|
Serial.print(F(" BLOCKSIZE: ")); |
|
|
|
|
Serial.print(F("|PEAKR:")); |
|
|
|
|
Serial.print(peak_r, DEC); |
|
|
|
|
Serial.print(F("|PEAKL:")); |
|
|
|
|
Serial.print(peak_l, DEC); |
|
|
|
|
Serial.print(F("|PEAKMD:")); |
|
|
|
|
Serial.print(peak_dexed, DEC); |
|
|
|
|
Serial.print(F("|ACTPEAKMD:")); |
|
|
|
|
Serial.print(peak_dexed_value, 1); |
|
|
|
|
Serial.print(F("|BLOCKSIZE:")); |
|
|
|
|
Serial.print(AUDIO_BLOCK_SAMPLES, DEC); |
|
|
|
|
Serial.print(F(" ACTIVE_VOICES: ")); |
|
|
|
|
Serial.print(F("|ACTVOICES:")); |
|
|
|
|
Serial.print(active_voices, DEC); |
|
|
|
|
Serial.println(); |
|
|
|
|
Serial.flush(); |
|
|
|
@ -1404,7 +1504,6 @@ void show_configuration(void) |
|
|
|
|
Serial.print(F("Instance Mode ")); Serial.println(configuration.instance_mode, DEC); |
|
|
|
|
Serial.print(F("Instance Splitpoint ")); Serial.println(configuration.instance_splitpoint, DEC); |
|
|
|
|
Serial.print(F("Volume ")); Serial.println(configuration.vol, DEC); |
|
|
|
|
Serial.print(F("Panorama ")); Serial.println(configuration.pan, DEC); |
|
|
|
|
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); |
|
|
|
@ -1428,6 +1527,7 @@ void show_configuration(void) |
|
|
|
|
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(" Loudness ")); Serial.println(configuration.dexed[instance_id].sound_intensity, DEC); |
|
|
|
|
Serial.print(F(" Panorama ")); Serial.println(configuration.dexed[instance_id].pan, DEC); |
|
|
|
|
Serial.print(F(" Transpose ")); Serial.println(configuration.dexed[instance_id].transpose, DEC); |
|
|
|
|
Serial.print(F(" Tune ")); Serial.println(configuration.dexed[instance_id].tune, DEC); |
|
|
|
|
Serial.print(F(" Polyphony ")); Serial.println(configuration.dexed[instance_id].polyphony, DEC); |
|
|
|
|