@ -425,8 +425,8 @@ void setup()
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 , true ) ) ;
master_mixer_l . gain ( 3 , pseudo_log_curve ( configuration . fx . reverb_level / 100 , true ) ) ;
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 ( ) ;
@ -714,7 +714,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
# ifdef USE_FX
MicroDexed [ instance_id ] - > fx . Gain = mapfloat ( configuration . dexed [ instance_id ] . sound_intensity , SOUND_INTENSITY_MIN , SOUND_INTENSITY_MAX , 0.0 , SOUND_INTENSITY_AMP_MAX ) ;
# else
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 ) , true ) ) ;
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 ) ) ) ;
# endif
if ( LCDML . FUNC_getID ( ) = = LCDML . OTHER_getIDFromFunction ( UI_func_sound_intensity ) )
{
@ -797,7 +797,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
}
case 106 : // CC 106: delay feedback
configuration . fx . delay_feedback [ instance_id ] = map ( inValue , 0 , 0x7f , DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX ) ;
delay_fb_mixer [ instance_id ] - > gain ( 1 , mapfloat ( configuration . fx . delay_feedback [ instance_id ] , DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX , 0.0 , 1.0 ) ) ; // amount of feedback
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 ) ) ) ; // amount of feedback
if ( LCDML . FUNC_getID ( ) = = LCDML . OTHER_getIDFromFunction ( UI_func_delay_feedback ) )
{
LCDML . OTHER_updateFunc ( ) ;
@ -806,7 +806,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
break ;
case 107 : // CC 107: delay volume
configuration . fx . delay_level [ instance_id ] = map ( inValue , 0 , 0x7f , DELAY_SEND_MIN , DELAY_SEND_MAX ) ;
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 ) , true ) ) ;
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 ) ) ) ;
if ( LCDML . FUNC_getID ( ) = = LCDML . OTHER_getIDFromFunction ( UI_func_delay_level ) )
{
LCDML . OTHER_updateFunc ( ) ;
@ -1364,8 +1364,8 @@ void set_volume(uint8_t v, uint8_t m)
Serial . println ( v , DEC ) ;
# endif
volume_r . gain ( v / 100.0 ) ;
volume_l . gain ( v / 100.0 ) ;
volume_r . gain ( pseudo_log_curve ( v / 100.0 ) ) ;
volume_l . gain ( pseudo_log_curve ( v / 100.0 ) ) ;
switch ( m )
{
@ -1448,25 +1448,25 @@ void initial_values_from_eeprom(bool init)
MicroDexed [ instance_id ] - > setMonoMode ( configuration . sys . mono ) ;
# if defined(USE_FX)
//chorus_mixer[instance_id]->gain(0, 1.0 - pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true ));
//chorus_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true ));
//chorus_mixer[instance_id]->gain(0, 1.0 - pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)));
//chorus_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)));
//chorus_mixer[instance_id]->gain(0, 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 , pseudo_log_curve ( mapfloat ( configuration . fx . chorus_level [ instance_id ] , CHORUS_LEVEL_MIN , CHORUS_LEVEL_MAX , 0.0 , 0.5 ) , true ) ) ;
chorus_mixer [ instance_id ] - > gain ( 1 , pseudo_log_curve ( 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 ) , true ) ) ;
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 ) , true ) ) ;
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 ) ) ) ;
// 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 ) ;
reverb_mixer_r . gain ( instance_id , pseudo_log_curve ( configuration . fx . reverb_send [ instance_id ] / 100.0 , true ) ) ;
reverb_mixer_l . gain ( instance_id , pseudo_log_curve ( configuration . fx . reverb_send [ instance_id ] / 100.0 , true ) ) ;
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 ) ) ;
# endif
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 ) , true ) ) ;
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_voiceconfig_params ( instance_id ) ;
}
@ -1757,8 +1757,8 @@ void set_fx_params(void)
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
{
// CHORUS
//chorus_mixer[instance_id]->gain(0, 1.0 - pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true ));
//chorus_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true ));
//chorus_mixer[instance_id]->gain(0, 1.0 - pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)));
//chorus_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)));
//chorus_mixer[instance_id]->gain(0, 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 ) ) ;
switch ( configuration . fx . chorus_waveform [ instance_id ] )
@ -1789,14 +1789,14 @@ void set_fx_params(void)
// DELAY
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 ) , true ) ) ;
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_fx [ instance_id ] - > delay ( 0 , constrain ( configuration . fx . delay_time [ instance_id ] * 10 , DELAY_TIME_MIN * 10 , DELAY_TIME_MAX * 10 ) ) ;
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 ) , true ) ) ;
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
reverb_mixer_r . gain ( instance_id , pseudo_log_curve ( configuration . fx . reverb_send [ instance_id ] / 100.0 , true ) ) ;
reverb_mixer_l . gain ( instance_id , pseudo_log_curve ( configuration . fx . reverb_send [ instance_id ] / 100.0 , true ) ) ;
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
@ -1804,8 +1804,8 @@ void set_fx_params(void)
freeverb_r . damping ( mapfloat ( configuration . fx . reverb_damping , REVERB_DAMPING_MIN , REVERB_DAMPING_MAX , 0.0 , 1.0 ) ) ;
freeverb_l . roomsize ( mapfloat ( configuration . fx . reverb_roomsize , REVERB_ROOMSIZE_MIN , REVERB_ROOMSIZE_MAX , 0.0 , 1.0 ) ) ;
freeverb_l . damping ( mapfloat ( configuration . fx . reverb_damping , REVERB_DAMPING_MIN , REVERB_DAMPING_MAX , 0.0 , 1.0 ) ) ;
master_mixer_r . gain ( 3 , pseudo_log_curve ( configuration . fx . reverb_level / 100.0 , true ) ) ;
master_mixer_l . gain ( 3 , pseudo_log_curve ( configuration . fx . reverb_level / 100.0 , true ) ) ;
master_mixer_r . gain ( 3 , pseudo_log_curve ( configuration . fx . reverb_level / 100.0 ) ) ;
master_mixer_l . gain ( 3 , pseudo_log_curve ( configuration . fx . reverb_level / 100.0 ) ) ;
# endif
}
@ -1819,7 +1819,7 @@ void set_voiceconfig_params(uint8_t instance_id)
MicroDexed [ instance_id ] - > doRefreshVoice ( ) ;
// 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 ) , true ) ) ;
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 ) ) ) ;
// PANORAMA
mono2stereo [ instance_id ] - > panorama ( mapfloat ( configuration . dexed [ instance_id ] . pan , PANORAMA_MIN , PANORAMA_MAX , - 1.0 , 1.0 ) ) ;
@ -1843,14 +1843,18 @@ void _softRestart(void)
SCB_AIRCR = 0x05FA0004 ; //write value for restart
}
float pseudo_log_curve ( float value , bool type )
float pseudo_log_curve ( float value )
{
const float _pseudo_log = 1048575 / ( float ) ( 1 < < 20 ) ;
if ( type = = true )
return ( _pseudo_log * arm_sin_f32 ( value ) ) ;
else
return ( _pseudo_log * arm_cos_f32 ( value ) ) ;
# ifdef DEBUG
Serial . print ( F ( " value in: " ) ) ;
Serial . print ( value , 3 ) ;
Serial . print ( F ( " value out: " ) ) ;
Serial . println ( mapfloat ( _pseudo_log * arm_sin_f32 ( value ) , 0.0 , _pseudo_log * arm_sin_f32 ( 1.0 ) , 0.0 , 1.0 ) , 3 ) ;
# endif
return ( mapfloat ( _pseudo_log * arm_sin_f32 ( value ) , 0.0 , _pseudo_log * arm_sin_f32 ( 1.0 ) , 0.0 , 1.0 ) ) ;
}
uint32_t crc32 ( byte * calc_start , uint16_t calc_bytes ) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc