@ -52,7 +52,6 @@ AudioSynthWaveform chorus_modulator;
AudioAmplifier modchorus_inverter ;
AudioAmplifier modchorus_inverter ;
// FX chain left
// FX chain left
AudioMixer4 chorus_send_mixer_l ;
AudioMixer4 delay_send_mixer_l ;
AudioMixer4 delay_send_mixer_l ;
AudioMixer4 delay_fb_mixer_l ;
AudioMixer4 delay_fb_mixer_l ;
AudioEffectDelay delay_l ;
AudioEffectDelay delay_l ;
@ -60,6 +59,7 @@ AudioConnection patchCord1(delay_send_mixer_l, 0, delay_fb_mixer_l, 0)
AudioConnection patchCord2 ( delay_fb_mixer_l , delay_l ) ;
AudioConnection patchCord2 ( delay_fb_mixer_l , delay_l ) ;
AudioConnection patchCord3 ( delay_l , 0 , delay_fb_mixer_l , 1 ) ; // feedback-loop
AudioConnection patchCord3 ( delay_l , 0 , delay_fb_mixer_l , 1 ) ; // feedback-loop
AudioConnection patchCord4 ( delay_fb_mixer_l , 0 , master_mixer_l , DELAY ) ;
AudioConnection patchCord4 ( delay_fb_mixer_l , 0 , master_mixer_l , DELAY ) ;
AudioMixer4 chorus_send_mixer_l ;
AudioEffectModulatedDelay modchorus_l ;
AudioEffectModulatedDelay modchorus_l ;
AudioConnection patchCord5 ( chorus_modulator , 0 , modchorus_l , 1 ) ;
AudioConnection patchCord5 ( chorus_modulator , 0 , modchorus_l , 1 ) ;
# if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
# if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
@ -79,7 +79,6 @@ AudioConnection patchCord12(freeverb_l, 0, master_mixer_r, REVERB);
# endif
# endif
// FX chain right
// FX chain right
AudioMixer4 chorus_send_mixer_r ;
AudioMixer4 delay_send_mixer_r ;
AudioMixer4 delay_send_mixer_r ;
AudioMixer4 delay_fb_mixer_r ;
AudioMixer4 delay_fb_mixer_r ;
AudioEffectDelay delay_r ;
AudioEffectDelay delay_r ;
@ -87,6 +86,7 @@ AudioConnection patchCord13(delay_send_mixer_r, 0, delay_fb_mixer_r, 0
AudioConnection patchCord14 ( delay_fb_mixer_r , delay_r ) ;
AudioConnection patchCord14 ( delay_fb_mixer_r , delay_r ) ;
AudioConnection patchCord15 ( delay_r , 0 , delay_fb_mixer_r , 1 ) ; // feedback-loop
AudioConnection patchCord15 ( delay_r , 0 , delay_fb_mixer_r , 1 ) ; // feedback-loop
AudioConnection patchCord16 ( delay_fb_mixer_r , 0 , master_mixer_r , DELAY ) ;
AudioConnection patchCord16 ( delay_fb_mixer_r , 0 , master_mixer_r , DELAY ) ;
AudioMixer4 chorus_send_mixer_r ;
AudioEffectModulatedDelay modchorus_r ;
AudioEffectModulatedDelay modchorus_r ;
AudioConnection patchCord17 ( chorus_modulator , 0 , modchorus_r , 1 ) ;
AudioConnection patchCord17 ( chorus_modulator , 0 , modchorus_r , 1 ) ;
# if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
# if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
@ -104,8 +104,8 @@ AudioConnection patchCord22(freeverb_r, 0, master_mixer_r, REVERB);
# endif
# endif
// FX chain tail
// FX chain tail
AudioMixer4 micro dexed_mixer_r;
AudioMixer4 dexed_mixer_r ;
AudioMixer4 micro dexed_mixer_l;
AudioMixer4 dexed_mixer_l ;
AudioMixer4 master_mixer_r ;
AudioMixer4 master_mixer_r ;
AudioMixer4 master_mixer_l ;
AudioMixer4 master_mixer_l ;
AudioAmplifier volume_r ;
AudioAmplifier volume_r ;
@ -113,8 +113,8 @@ AudioAmplifier volume_l;
AudioEffectStereoMono stereo2mono ;
AudioEffectStereoMono stereo2mono ;
AudioAnalyzePeak master_peak_r ;
AudioAnalyzePeak master_peak_r ;
AudioAnalyzePeak master_peak_l ;
AudioAnalyzePeak master_peak_l ;
AudioConnection patchCord23 ( micro dexed_mixer_r, 0 , master_mixer_r , DEXED ) ;
AudioConnection patchCord23 ( dexed_mixer_r , 0 , master_mixer_r , DEXED ) ;
AudioConnection patchCord24 ( micro dexed_mixer_l, 0 , master_mixer_l , DEXED ) ;
AudioConnection patchCord24 ( dexed_mixer_l , 0 , master_mixer_l , DEXED ) ;
AudioConnection patchCord25 ( master_mixer_r , volume_r ) ;
AudioConnection patchCord25 ( master_mixer_r , volume_r ) ;
AudioConnection patchCord26 ( master_mixer_l , volume_l ) ;
AudioConnection patchCord26 ( master_mixer_l , volume_l ) ;
AudioConnection patchCord27 ( volume_r , 0 , stereo2mono , 0 ) ;
AudioConnection patchCord27 ( volume_r , 0 , stereo2mono , 0 ) ;
@ -173,16 +173,16 @@ void create_audio_connections(AudioSourceMicroDexed &dexed, AudioEffectMonoStere
dynamicConnections [ nDynamic + + ] = new AudioConnection ( dexed , 0 , microdexed_peak_mixer , instance_id ) ;
dynamicConnections [ nDynamic + + ] = new AudioConnection ( dexed , 0 , microdexed_peak_mixer , instance_id ) ;
dynamicConnections [ nDynamic + + ] = new AudioConnection ( dexed , 0 , mono2stereo , 0 ) ;
dynamicConnections [ nDynamic + + ] = new AudioConnection ( dexed , 0 , mono2stereo , 0 ) ;
dynamicConnections [ nDynamic + + ] = new AudioConnection ( pan , 0 , mono2stereo , 1 ) ;
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 , dexed_mixer_r , instance_id ) ;
dynamicConnections [ nDynamic + + ] = new AudioConnection ( mono2stereo , 0 , microdexed_mixer_l , instance_id ) ;
dynamicConnections [ nDynamic + + ] = new AudioConnection ( mono2stereo , 0 , dexed_mixer_l , instance_id ) ;
dynamicConnections [ nDynamic + + ] = new AudioConnection ( mono2stereo , 0 , chorus_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 , delay_send_mixer_l , instance_id ) ;
# if defined(USE_REVERB)
# if defined(USE_REVERB)
dynamicConnections [ nDynamic + + ] = new AudioConnection ( mono2stereo , 0 , reverb_send_mixer_r , 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 ) ;
dynamicConnections [ nDynamic + + ] = new AudioConnection ( mono2stereo , 0 , reverb_send_mixer_l , instance_id ) ;
# endif
# endif
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 ;
bool sd_card_available = false ;
@ -210,6 +210,11 @@ uint32_t peak_l = 0;
bool eeprom_update_flag = false ;
bool eeprom_update_flag = false ;
config_t configuration ;
config_t configuration ;
uint8_t selected_dexed_instance = 0 ;
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
// Allocate the delay lines for chorus
// Allocate the delay lines for chorus
int16_t delayline_r [ MOD_DELAY_SAMPLE_BUFFER ] ;
int16_t delayline_r [ MOD_DELAY_SAMPLE_BUFFER ] ;
@ -424,22 +429,22 @@ void setup()
microdexed_peak_mixer . gain ( instance_id , 1.0 ) ;
microdexed_peak_mixer . gain ( instance_id , 1.0 ) ;
// INIT DEXED MIXER
// INIT DEXED MIXER
micro dexed_mixer_r. gain ( instance_id , 1. 0) ;
dexed_mixer_r . gain ( instance_id , 0.5 ) ;
micro dexed_mixer_l. gain ( instance_id , 1. 0) ;
dexed_mixer_l . gain ( instance_id , 0.5 ) ;
# ifdef USE_REVERB
# ifdef USE_REVERB
// INIT 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_r . gain ( instance_id , mapfloat ( configuration . dexed [ instance_id ] . reverb_send , REVERB_SEND_MIN , REVERB_SEND_MAX , 0.0 , 0.5 ) ) ;
reverb_send_mixer_l . 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 , 0.5 ) ) ;
# endif
# endif
// INIT DELAY
// 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) ) ;
delay_send_mixer_r . gain ( instance_id , mapfloat ( configuration . dexed [ instance_id ] . delay_send , DELAY_SEND_MIN , DELAY_SEND_MAX , 0.0 , 0.5 ) ) ;
delay_send_mixer_l . 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 , 0.5 ) ) ;
// INIT CHORUS
// 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_r . gain ( instance_id , mapfloat ( configuration . dexed [ instance_id ] . chorus_send , CHORUS_SEND_MIN , CHORUS_SEND_MAX , 0.0 , 0.5 ) ) ;
chorus_send_mixer_l . 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 , 0.5 ) ) ;
// DEXED FILTER
// 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 . Gain = mapfloat ( configuration . dexed [ instance_id ] . sound_intensity , SOUND_INTENSITY_MIN , SOUND_INTENSITY_MAX , 0.0 , 1.0 ) ;
@ -452,16 +457,16 @@ void setup()
}
}
// REVERB
// REVERB
master_mixer_r . gain ( REVERB , 1 .0) ;
master_mixer_r . gain ( REVERB , 0 .0) ;
master_mixer_l . gain ( REVERB , 1 .0) ;
master_mixer_l . gain ( REVERB , 0 .0) ;
freeverb_r . roomsize ( mapfloat ( configuration . reverb_roomsize , REVERB_ROOMSIZE_MIN , REVERB_ROOMSIZE_MAX , 0.0 , 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_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 . 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 ) ) ;
freeverb_l . damping ( mapfloat ( configuration . reverb_damping , REVERB_DAMPING_MIN , REVERB_DAMPING_MAX , 0.0 , 1.0 ) ) ;
// DELAY
// DELAY
master_mixer_r . gain ( DELAY , 1 .0) ;
master_mixer_r . gain ( DELAY , 0 .0) ;
master_mixer_l . gain ( DELAY , 1 .0) ;
master_mixer_l . gain ( DELAY , 0 .0) ;
delay_r . 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_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 is the feedback-adding mixer
@ -469,8 +474,8 @@ void setup()
delay_fb_mixer_l . gain ( 1 , mapfloat ( configuration . delay_feedback , DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX , 0.0 , 1.0 ) ) ; // amount of feedback
delay_fb_mixer_l . gain ( 1 , mapfloat ( configuration . delay_feedback , DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX , 0.0 , 1.0 ) ) ; // amount of feedback
// CHORUS
// CHORUS
master_mixer_r . gain ( CHORUS , 1 .0) ;
master_mixer_r . gain ( CHORUS , 0 .0) ;
master_mixer_l . gain ( CHORUS , 1 .0) ;
master_mixer_l . gain ( CHORUS , 0 .0) ;
switch ( configuration . chorus_waveform )
switch ( configuration . chorus_waveform )
{
{
case 0 :
case 0 :
@ -771,16 +776,16 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
eeprom_write ( ) ;
eeprom_write ( ) ;
case 106 : // CC 106: delay feedback
case 106 : // CC 106: delay feedback
configuration . delay_feedback = map ( inValue , 0 , 0x7f , DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX ) ;
configuration . delay_feedback = map ( inValue , 0 , 0x7f , DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX ) ;
delay_fb_mixer_r . gain ( 1 , configuration . delay_feedback / 1 00.0 ) ; // amount of feedback
delay_fb_mixer_r . gain ( 1 , configuration . delay_feedback / 2 00.0 ) ; // amount of feedback
delay_fb_mixer_r . gain ( 0 , 1.0 - configuration . delay_feedback / 1 00.0) ; // original signalbreak;
delay_fb_mixer_r . gain ( 0 , 1.0 - configuration . delay_feedback / 2 00.0) ; // original signalbreak;
delay_fb_mixer_l . gain ( 1 , configuration . delay_feedback / 1 00.0 ) ; // amount of feedback
delay_fb_mixer_l . gain ( 1 , configuration . delay_feedback / 2 00.0 ) ; // amount of feedback
delay_fb_mixer_l . gain ( 0 , 1.0 - configuration . delay_feedback / 1 00.0) ; // original signalbreak;
delay_fb_mixer_l . gain ( 0 , 1.0 - configuration . delay_feedback / 2 00.0) ; // original signalbreak;
eeprom_write ( ) ;
eeprom_write ( ) ;
break ;
break ;
case 107 : // CC 107: delay volume
case 107 : // CC 107: delay volume
configuration . dexed [ instance_id ] . delay_send = map ( inValue , 0 , 0x7f , DELAY_SEND_MIN , DELAY_SEND_MAX ) ;
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 / 1 00.0) ;
master_mixer_r . gain ( DELAY , configuration . dexed [ instance_id ] . delay_send / 2 00.0) ;
master_mixer_l . gain ( 2 , configuration . dexed [ instance_id ] . delay_send / 1 00.0) ;
master_mixer_l . gain ( DELAY , configuration . dexed [ instance_id ] . delay_send / 2 00.0) ;
eeprom_write ( ) ;
eeprom_write ( ) ;
break ;
break ;
case 120 :
case 120 :
@ -1312,11 +1317,14 @@ void check_configuration(void)
configuration . mono = constrain ( configuration . mono , MONO_MIN , MONO_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_roomsize = constrain ( configuration . reverb_roomsize , REVERB_ROOMSIZE_MIN , REVERB_ROOMSIZE_MAX ) ;
configuration . reverb_damping = constrain ( configuration . reverb_damping , REVERB_DAMPING_MIN , REVERB_DAMPING_MAX ) ;
configuration . reverb_damping = constrain ( configuration . reverb_damping , REVERB_DAMPING_MIN , REVERB_DAMPING_MAX ) ;
configuration . reverb_level = constrain ( configuration . reverb_level , REVERB_LEVEL_MIN , REVERB_LEVEL_MAX ) ;
configuration . chorus_frequency = constrain ( configuration . chorus_frequency , CHORUS_FREQUENCY_MIN , CHORUS_FREQUENCY_MAX ) ;
configuration . chorus_frequency = constrain ( configuration . chorus_frequency , CHORUS_FREQUENCY_MIN , CHORUS_FREQUENCY_MAX ) ;
configuration . chorus_waveform = constrain ( configuration . chorus_waveform , CHORUS_WAVEFORM_MIN , CHORUS_WAVEFORM_MAX ) ;
configuration . chorus_waveform = constrain ( configuration . chorus_waveform , CHORUS_WAVEFORM_MIN , CHORUS_WAVEFORM_MAX ) ;
configuration . chorus_depth = constrain ( configuration . chorus_depth , CHORUS_DEPTH_MIN , CHORUS_DEPTH_MAX ) ;
configuration . chorus_depth = constrain ( configuration . chorus_depth , CHORUS_DEPTH_MIN , CHORUS_DEPTH_MAX ) ;
configuration . chorus_level = constrain ( configuration . chorus_level , CHORUS_LEVEL_MIN , CHORUS_LEVEL_MAX ) ;
configuration . delay_time = constrain ( configuration . delay_time , DELAY_TIME_MIN , DELAY_TIME_MAX ) ;
configuration . delay_time = constrain ( configuration . delay_time , DELAY_TIME_MIN , DELAY_TIME_MAX ) ;
configuration . delay_feedback = constrain ( configuration . delay_feedback , DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX ) ;
configuration . delay_feedback = constrain ( configuration . delay_feedback , DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX ) ;
configuration . delay_level = constrain ( configuration . delay_level , DELAY_LEVEL_MIN , DELAY_LEVEL_MAX ) ;
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
{
{
configuration . dexed [ instance_id ] . midi_channel = constrain ( configuration . dexed [ instance_id ] . midi_channel , MIDI_CHANNEL_MIN , MIDI_CHANNEL_MAX ) ;
configuration . dexed [ instance_id ] . midi_channel = constrain ( configuration . dexed [ instance_id ] . midi_channel , MIDI_CHANNEL_MIN , MIDI_CHANNEL_MAX ) ;
@ -1349,6 +1357,12 @@ void check_configuration(void)
configuration . dexed [ instance_id ] . portamento_time = constrain ( configuration . dexed [ instance_id ] . portamento_time , PORTAMENTO_TIME_MIN , PORTAMENTO_TIME_MAX ) ;
configuration . dexed [ instance_id ] . portamento_time = constrain ( configuration . dexed [ instance_id ] . portamento_time , PORTAMENTO_TIME_MIN , PORTAMENTO_TIME_MAX ) ;
configuration . dexed [ instance_id ] . op_enabled = constrain ( configuration . dexed [ instance_id ] . op_enabled , OP_ENABLED_MIN , OP_ENABLED_MAX ) ;
configuration . dexed [ instance_id ] . op_enabled = constrain ( configuration . dexed [ instance_id ] . op_enabled , OP_ENABLED_MIN , OP_ENABLED_MAX ) ;
}
}
set_master_mixer_gain ( CHORUS , configuration . chorus_level / 100.0 ) ;
set_master_mixer_gain ( DELAY , configuration . delay_level / 100.0 ) ;
# if defined(USE_REVERB)
set_master_mixer_gain ( REVERB , configuration . reverb_level / 100.0 ) ;
# endif
}
}
void init_configuration ( void )
void init_configuration ( void )
@ -1365,11 +1379,14 @@ void init_configuration(void)
configuration . mono = MONO_DEFAULT ;
configuration . mono = MONO_DEFAULT ;
configuration . reverb_roomsize = REVERB_ROOMSIZE_DEFAULT ;
configuration . reverb_roomsize = REVERB_ROOMSIZE_DEFAULT ;
configuration . reverb_damping = REVERB_DAMPING_DEFAULT ;
configuration . reverb_damping = REVERB_DAMPING_DEFAULT ;
configuration . reverb_level = REVERB_LEVEL_DEFAULT ;
configuration . chorus_frequency = CHORUS_FREQUENCY_DEFAULT ;
configuration . chorus_frequency = CHORUS_FREQUENCY_DEFAULT ;
configuration . chorus_waveform = CHORUS_WAVEFORM_DEFAULT ;
configuration . chorus_waveform = CHORUS_WAVEFORM_DEFAULT ;
configuration . chorus_depth = CHORUS_DEPTH_DEFAULT ;
configuration . chorus_depth = CHORUS_DEPTH_DEFAULT ;
configuration . chorus_level = CHORUS_LEVEL_DEFAULT ;
configuration . delay_time = DELAY_TIME_DEFAULT ;
configuration . delay_time = DELAY_TIME_DEFAULT ;
configuration . delay_feedback = DELAY_FEEDBACK_DEFAULT ;
configuration . delay_feedback = DELAY_FEEDBACK_DEFAULT ;
configuration . delay_level = DELAY_LEVEL_DEFAULT ;
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
{
{
configuration . dexed [ instance_id ] . midi_channel = DEFAULT_MIDI_CHANNEL ;
configuration . dexed [ instance_id ] . midi_channel = DEFAULT_MIDI_CHANNEL ;
@ -1443,6 +1460,54 @@ uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https:/
return ( crc ) ;
return ( crc ) ;
}
}
void set_master_mixer_gain ( uint8_t type , float level )
{
master_mixer_level [ type ] = constrain ( level , 0.0 , 1.0 ) ;
# if defined(USE_REVERB)
const uint8_t num_fx = 4 ;
# else
const uint8_t num_fx = 3 ;
# endif
float new_level [ num_fx ] ;
new_level [ CHORUS ] = master_mixer_level [ CHORUS ] / float ( num_fx ) ;
new_level [ DELAY ] = master_mixer_level [ DELAY ] / float ( num_fx ) ;
# if defined(USE_REVERB)
new_level [ REVERB ] = master_mixer_level [ REVERB ] / float ( num_fx ) ;
new_level [ DEXED ] = 1.0 - new_level [ CHORUS ] - new_level [ DELAY ] - new_level [ REVERB ] ;
# else
new_level [ DEXED ] = 1.0 - new_level [ CHORUS ] - new_level [ DELAY ] ;
# endif
master_mixer_r . gain ( DEXED , new_level [ DEXED ] ) ;
master_mixer_l . gain ( DEXED , new_level [ DEXED ] ) ;
master_mixer_r . gain ( CHORUS , new_level [ CHORUS ] ) ;
master_mixer_l . gain ( CHORUS , new_level [ CHORUS ] ) ;
master_mixer_r . gain ( DELAY , new_level [ DELAY ] ) ;
master_mixer_l . gain ( DELAY , new_level [ DELAY ] ) ;
# if defined(USE_REVERB)
master_mixer_r . gain ( REVERB , new_level [ REVERB ] ) ;
master_mixer_l . gain ( REVERB , new_level [ REVERB ] ) ;
# endif
# ifdef DEBUG
Serial . print ( F ( " Volumes for master_mixer: DEXED= " ) ) ;
Serial . print ( new_level [ DEXED ] , 2 ) ;
Serial . print ( F ( " CHORUS= " ) ) ;
Serial . print ( new_level [ CHORUS ] , 2 ) ;
Serial . print ( F ( " DELAY= " ) ) ;
Serial . print ( new_level [ DELAY ] , 2 ) ;
# if defined(USE_REVERB)
Serial . print ( F ( " REVERB= " ) ) ;
Serial . print ( new_level [ REVERB ] , 2 ) ;
# endif
Serial . println ( ) ;
# endif
}
/******************************************************************************
/******************************************************************************
DEBUG HELPER
DEBUG HELPER
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@ -1507,11 +1572,14 @@ void show_configuration(void)
Serial . print ( F ( " Mono " ) ) ; Serial . println ( configuration . mono , 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 Roomsize " ) ) ; Serial . println ( configuration . reverb_roomsize , DEC ) ;
Serial . print ( F ( " Reverb Damping " ) ) ; Serial . println ( configuration . reverb_damping , DEC ) ;
Serial . print ( F ( " Reverb Damping " ) ) ; Serial . println ( configuration . reverb_damping , DEC ) ;
Serial . print ( F ( " Reverb Level " ) ) ; Serial . println ( configuration . reverb_level , DEC ) ;
Serial . print ( F ( " Chorus Frequency " ) ) ; Serial . println ( configuration . chorus_frequency , DEC ) ;
Serial . print ( F ( " Chorus Frequency " ) ) ; Serial . println ( configuration . chorus_frequency , DEC ) ;
Serial . print ( F ( " Chorus Waveform " ) ) ; Serial . println ( configuration . chorus_waveform , DEC ) ;
Serial . print ( F ( " Chorus Waveform " ) ) ; Serial . println ( configuration . chorus_waveform , DEC ) ;
Serial . print ( F ( " Chorus Depth " ) ) ; Serial . println ( configuration . chorus_depth , DEC ) ;
Serial . print ( F ( " Chorus Depth " ) ) ; Serial . println ( configuration . chorus_depth , DEC ) ;
Serial . print ( F ( " Chorus Level " ) ) ; Serial . println ( configuration . chorus_level , DEC ) ;
Serial . print ( F ( " Delay Time " ) ) ; Serial . println ( configuration . delay_time , DEC ) ;
Serial . print ( F ( " Delay Time " ) ) ; Serial . println ( configuration . delay_time , DEC ) ;
Serial . print ( F ( " Delay Feedback " ) ) ; Serial . println ( configuration . delay_feedback , DEC ) ;
Serial . print ( F ( " Delay Feedback " ) ) ; Serial . println ( configuration . delay_feedback , DEC ) ;
Serial . print ( F ( " Delay Level " ) ) ; Serial . println ( configuration . delay_level , DEC ) ;
Serial . flush ( ) ;
Serial . flush ( ) ;
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
{
{