@ -193,7 +193,6 @@ uint8_t midi_voices[NUM_DEXED];
elapsedMillis cpu_mem_millis ;
# endif
uint32_t cpumax = 0 ;
elapsedMillis cpu_overload_throttle_timer ;
uint32_t peak_dexed = 0 ;
float peak_dexed_value = 0.0 ;
uint32_t peak_r = 0 ;
@ -208,12 +207,14 @@ char g_voice_name[NUM_DEXED][VOICE_NAME_LEN];
char g_bank_name [ NUM_DEXED ] [ BANK_NAME_LEN ] ;
char receive_bank_filename [ FILENAME_LEN ] ;
uint8_t selected_instance_id = 0 ;
# ifdef TEENSY4
# if NUM_DEXED>1
int8_t midi_decay [ NUM_DEXED ] = { - 1 , - 1 } ;
# else
int8_t midi_decay [ NUM_DEXED ] = { - 1 } ;
# endif
elapsedMillis midi_decay_timer ;
# endif
# if defined(USE_FX)
// Allocate the delay lines for chorus
@ -409,27 +410,6 @@ void setup()
change_disp_sd ( true ) ;
# endif
/*
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 VOLUME
dexed_level [ instance_id ] - > gain ( 1.0 ) ;
// INIT DEXED VOICE CONFIG
set_voiceconfig_params ( instance_id ) ;
master_mixer_r . gain ( instance_id , 1.0 ) ;
master_mixer_l . gain ( instance_id , 1.0 ) ;
}
master_mixer_r . gain ( 3 , pseudo_log_curve ( configuration . fx . reverb_level / 100 ) ) ;
master_mixer_l . gain ( 3 , pseudo_log_curve ( configuration . fx . reverb_level / 100 ) ) ;
set_sys_params ( ) ;
*/
// Initialize processor and memory measurements
AudioProcessorUsageMaxReset ( ) ;
AudioMemoryUsageMaxReset ( ) ;
@ -487,38 +467,12 @@ void loop()
{
control_rate = 0 ;
/*
// EEPROM update handling
if ( autostore > = AUTOSTORE_MS & & eeprom_update_flag = = true )
{
// only store configuration data to EEPROM when AUTOSTORE_MS is reached and no voices are activated anymore
eeprom_update_sys ( ) ;
}
*/
// check for value changes, unused voices and CPU overload
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
{
active_voices [ instance_id ] = MicroDexed [ instance_id ] - > getNumNotesPlaying ( ) ;
if ( active_voices [ instance_id ] = = 0 )
midi_voices [ instance_id ] = 0 ;
# if defined(CPU_OVERLOAD_THROTTLE)
if ( AudioProcessorUsageMax ( ) > CPU_OVERLOAD_THROTTLE & & cpu_overload_throttle_timer > = CPU_OVERLOAD_THROTTLE_TIMER )
{
cpu_overload_throttle_timer = 0 ;
AudioProcessorUsageMaxReset ( ) ;
MicroDexed [ instance_id ] - > keyup ( - 1 ) ; // kills the oldest note and decreases max_notes
# ifdef DEBUG
Serial . print ( F ( " !!!CPU overload!!! Automatic throttling polyphony down to " ) ) ;
Serial . print ( MicroDexed [ instance_id ] - > getMaxNotes ( ) , DEC ) ;
Serial . print ( F ( " for instance " ) ) ;
Serial . print ( instance_id , DEC ) ;
Serial . println ( F ( " . " ) ) ;
# endif
configuration . dexed [ instance_id ] . polyphony = MicroDexed [ instance_id ] - > getMaxNotes ( ) ;
}
# endif
}
if ( LCDML . FUNC_getID ( ) = = LCDML . OTHER_getIDFromFunction ( UI_func_voice_select ) )
@ -555,10 +509,12 @@ void loop()
}
# endif
}
# ifdef TEENSY4
if ( midi_decay_timer > 250 )
{
midi_decay_timer = 0 ;
}
# endif
}
}
else
@ -600,11 +556,13 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
MicroDexed [ instance_id ] - > keydown ( inNumber , uint8_t ( float ( configuration . dexed [ instance_id ] . velocity_level / 127.0 ) * inVelocity + 0.5 ) ) ;
midi_voices [ instance_id ] + + ;
# ifdef TEENSY4
if ( LCDML . FUNC_getID ( ) = = LCDML . OTHER_getIDFromFunction ( UI_func_voice_select ) )
{
midi_decay_timer = 0 ;
midi_decay [ instance_id ] = min ( inVelocity / 5 , 7 ) ;
}
# endif
# ifdef DEBUG
char note_name [ 4 ] ;
getNoteName ( note_name , inNumber ) ;
@ -1437,37 +1395,6 @@ void initial_values_from_eeprom(bool init)
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
{
set_voiceconfig_params ( instance_id ) ;
/*
MicroDexed [ instance_id ] - > setPBController ( configuration . dexed [ instance_id ] . pb_range , configuration . dexed [ instance_id ] . pb_step ) ;
MicroDexed [ instance_id ] - > setMWController ( configuration . dexed [ instance_id ] . mw_range , configuration . dexed [ instance_id ] . mw_assign , configuration . dexed [ instance_id ] . mw_mode ) ;
MicroDexed [ instance_id ] - > setFCController ( configuration . dexed [ instance_id ] . fc_range , configuration . dexed [ instance_id ] . fc_assign , configuration . dexed [ instance_id ] . fc_mode ) ;
MicroDexed [ instance_id ] - > setBCController ( configuration . dexed [ instance_id ] . bc_range , configuration . dexed [ instance_id ] . bc_assign , configuration . dexed [ instance_id ] . bc_mode ) ;
MicroDexed [ instance_id ] - > setATController ( configuration . dexed [ instance_id ] . at_range , configuration . dexed [ instance_id ] . at_assign , configuration . dexed [ instance_id ] . at_mode ) ;
MicroDexed [ instance_id ] - > controllers . refresh ( ) ;
MicroDexed [ instance_id ] - > setOPs ( configuration . dexed [ instance_id ] . op_enabled ) ;
MicroDexed [ instance_id ] - > doRefreshVoice ( ) ;
MicroDexed [ instance_id ] - > setMaxNotes ( configuration . dexed [ instance_id ] . polyphony ) ;
MicroDexed [ instance_id ] - > setMonoMode ( configuration . sys . mono ) ;
*/
/*
chorus_mixer [ instance_id ] - > gain ( 1 , 1.0 - mapfloat ( configuration . fx . chorus_level [ instance_id ] , CHORUS_LEVEL_MIN , CHORUS_LEVEL_MAX , 0.0 , 0.5 ) ) ;
chorus_mixer [ instance_id ] - > gain ( 1 , mapfloat ( configuration . fx . chorus_level [ instance_id ] , CHORUS_LEVEL_MIN , CHORUS_LEVEL_MAX , 0.0 , 0.5 ) ) ;
delay_mixer [ instance_id ] - > gain ( 0 , 1.0 ) ;
delay_mixer [ instance_id ] - > gain ( 1 , pseudo_log_curve ( mapfloat ( configuration . fx . delay_level [ instance_id ] , DELAY_LEVEL_MIN , DELAY_LEVEL_MAX , 0.0 , 1.0 ) ) ) ;
delay_fb_mixer [ instance_id ] - > gain ( 0 , 1.0 ) ;
delay_fb_mixer [ instance_id ] - > gain ( 1 , pseudo_log_curve ( mapfloat ( configuration . fx . delay_feedback [ instance_id ] , DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX , 0.0 , 1.0 ) ) ) ;
reverb_mixer_r . gain ( instance_id , pseudo_log_curve ( configuration . fx . reverb_send [ instance_id ] / 100.0 ) ) ;
reverb_mixer_l . gain ( instance_id , pseudo_log_curve ( configuration . fx . reverb_send [ instance_id ] / 100.0 ) ) ;
// MicroDexed[instance_id]->fx.Gain = configuration.dexed[instance_id].sound_intensity / 100.0;
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 ) ;
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 ) ) ) ;
*/
}
set_fx_params ( ) ;
set_sys_params ( ) ;
@ -1802,8 +1729,8 @@ void set_fx_params(void)
delay_fx [ instance_id ] - > delay ( 0 , constrain ( configuration . fx . delay_time [ instance_id ] , DELAY_TIME_MIN , DELAY_TIME_MAX ) * 10 ) ;
// REVERB SEND
reverb_mixer_r . gain ( instance_id , pseudo_log_curve ( configuration . fx . reverb_send [ instance_id ] / 100.0 ) ) ;
reverb_mixer_l . gain ( instance_id , pseudo_log_curve ( configuration . fx . reverb_send [ instance_id ] / 100.0 ) ) ;
reverb_mixer_r . gain ( instance_id , pseudo_log_curve ( mapfloat ( configuration . fx . reverb_send [ instance_id ] , REVERB_SEND_MIN , REVERB_SEND_MAX , 0.0 , 1.0 ) ) ) ;
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 = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX);