@ -94,6 +94,13 @@ int8_t menu_position[NUM_MENUS];
extern mdaEPiano * ep ;
extern mdaEPiano * ep ;
extern void set_volume ( float v , float p ) ;
extern void set_volume ( float v , float p ) ;
extern AudioControlSGTL5000 sgtl5000_1 ;
extern AudioEffectFreeverb freeverb_r ;
extern AudioEffectFreeverb freeverb_l ;
extern AudioMixer4 mixer_r ;
extern AudioMixer4 mixer_l ;
extern AudioAmplifier volume_r ;
extern AudioAmplifier volume_l ;
/******************************************
/******************************************
MAIN MENU
MAIN MENU
@ -1049,7 +1056,7 @@ void callback_max_poly_function()
# endif
# endif
menu_system . change_menu ( max_poly_menu ) ;
menu_system . change_menu ( max_poly_menu ) ;
menu_position [ SYSTEM ] = encoder_value [ RIGHT_ENCODER ] ;
menu_position [ SYSTEM ] = encoder_value [ RIGHT_ENCODER ] ;
encoder_value [ RIGHT_ENCODER ] = configuration . max_poly ;
encoder_value [ RIGHT_ENCODER ] = configuration . max_poly ;
enc [ RIGHT_ENCODER ] . write ( configuration . max_poly , 1 , 32 ) ;
enc [ RIGHT_ENCODER ] . write ( configuration . max_poly , 1 , 32 ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
@ -1618,6 +1625,214 @@ void set_overdrive(uint8_t value)
ep - > setParameter ( MDA_EP_OVERDRIVE , tmp ) ;
ep - > setParameter ( MDA_EP_OVERDRIVE , tmp ) ;
}
}
void set_comp_gain ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set COMP_GAIN " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_COMP_GAIN_MIN , ENC_COMP_GAIN_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . autoVolumeControl ( tmp , configuration . comp_response , configuration . comp_limit , configuration . comp_threshold , configuration . comp_attack , configuration . comp_decay ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_comp_response ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set COMP_RESPONSE " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_COMP_RESPONSE_MIN , ENC_COMP_RESPONSE_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , tmp , configuration . comp_limit , configuration . comp_threshold , configuration . comp_attack , configuration . comp_decay ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_comp_limit ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set COMP_LIMIT " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_COMP_LIMIT_MIN , ENC_COMP_LIMIT_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , configuration . comp_response , tmp , configuration . comp_threshold , configuration . comp_attack , configuration . comp_decay ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_comp_threshold ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set COMP_THRESHOLD " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_COMP_THRESHOLD_MIN , ENC_COMP_THRESHOLD_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , configuration . comp_response , configuration . comp_limit , tmp , configuration . comp_attack , configuration . comp_decay ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_comp_attack ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set COMP_ATTACK " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_COMP_ATTACK_MIN , ENC_COMP_ATTACK_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , configuration . comp_response , configuration . comp_limit , configuration . comp_threshold , tmp , configuration . comp_decay ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_comp_decay ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set COMP_DECAY " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_COMP_DECAY_MIN , ENC_COMP_DECAY_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , configuration . comp_response , configuration . comp_limit , configuration . comp_threshold , configuration . comp_attack , tmp ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_reverb_roomsize ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set REVERB_ROOMSIZE " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_REVERB_ROOMSIZE_MIN , ENC_REVERB_ROOMSIZE_MAX , 0.0 , 1.0 ) ;
freeverb_r . roomsize ( tmp ) ;
freeverb_l . roomsize ( tmp ) ;
}
void set_reverb_damping ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set REVERB_DAMPING " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_REVERB_DAMPING_MIN , ENC_REVERB_DAMPING_MAX , 0.0 , 1.0 ) ;
freeverb_r . damping ( tmp ) ;
freeverb_l . damping ( tmp ) ;
}
void set_reverb_level ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set REVERB_LEVEL " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_REVERB_DAMPING_MIN , ENC_REVERB_DAMPING_MAX , 0.0 , 1.0 ) ;
mixer_r . gain ( 0 , 1.0 - tmp ) ;
mixer_l . gain ( 0 , 1.0 - tmp ) ;
mixer_r . gain ( 1 , tmp ) ;
mixer_l . gain ( 1 , tmp ) ;
}
void set_chorus_frequency ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set CHORUS_FREQUENCY " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_CHORUS_FREQUENCY_MIN , ENC_CHORUS_FREQUENCY_MAX , 0.0 , 1.0 ) ;
// TDB
}
void set_chorus_delay ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set CHORUS_DELAY " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_CHORUS_DELAY_MIN , ENC_CHORUS_DELAY_MAX , 0.0 , 1.0 ) ;
// TDB
}
void set_chorus_level ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set CHORUS_LEVEL " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_CHORUS_LEVEL_MIN , ENC_CHORUS_LEVEL_MAX , 0.0 , 1.0 ) ;
// TDB
}
void set_bass_lr_level ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set BASS_LR_LEVEL " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_BASS_LR_LEVEL_MIN , ENC_BASS_LR_LEVEL_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . enhanceBass ( tmp , configuration . bass_mono_level ) ;
}
void set_bass_mono_level ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set BASS_MONO_LEVEL " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_BASS_MONO_LEVEL_MIN , ENC_BASS_MONO_LEVEL_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . enhanceBass ( configuration . bass_mono_level , tmp ) ;
}
void set_eq_bass ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set EQ_BASS " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_EQ_BASS_MIN , ENC_EQ_BASS_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . eqBands ( tmp , configuration . eq_treble ) ;
}
void set_eq_treble ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set EQ_TREBLE " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_EQ_TREBLE_MIN , ENC_EQ_TREBLE_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . eqBands ( configuration . eq_bass , tmp ) ;
}
void set_loudness ( uint8_t value )
{
# ifdef DEBUG
Serial . print ( F ( " Set LOUDNESS " ) ) ;
Serial . println ( value ) ;
# endif
float tmp = mapfloat ( float ( value ) , ENC_LOUDNESS_MIN , ENC_LOUDNESS_MAX , 0.0 , 1.0 ) ;
volume_r . gain ( tmp ) ;
volume_l . gain ( tmp ) ;
}
void set_complete_configuration ( void )
{
set_decay ( configuration . decay ) ;
set_release ( configuration . release ) ;
set_hardness ( configuration . hardness ) ;
set_treble ( configuration . treble ) ;
set_stereo ( configuration . stereo ) ;
set_tune ( configuration . tune ) ;
set_detune ( configuration . detune ) ;
set_velocity_sense ( configuration . velocity_sense ) ;
set_pan_trem_frequency ( configuration . pan_trem_frequency ) ;
set_pan_trem_level ( configuration . pan_trem_level ) ;
set_overdrive ( configuration . overdrive ) ;
set_comp_gain ( configuration . comp_gain ) ;
set_comp_response ( configuration . comp_response ) ;
set_comp_limit ( configuration . comp_limit ) ;
set_comp_threshold ( configuration . comp_threshold ) ;
set_comp_attack ( configuration . comp_attack ) ;
set_comp_decay ( configuration . comp_decay ) ;
set_reverb_roomsize ( configuration . reverb_roomsize ) ;
set_reverb_damping ( configuration . reverb_damping ) ;
set_reverb_level ( configuration . reverb_level ) ;
set_chorus_frequency ( configuration . chorus_frequency ) ;
set_chorus_delay ( configuration . chorus_delay ) ;
set_chorus_level ( configuration . chorus_level ) ;
set_bass_lr_level ( configuration . bass_lr_level ) ;
set_bass_mono_level ( configuration . bass_mono_level ) ;
set_eq_bass ( configuration . eq_bass ) ;
set_eq_treble ( configuration . eq_treble ) ;
set_loudness ( configuration . loudness ) ;
}
//********************************************************************************************+
//********************************************************************************************+
void handle_ui ( void )
void handle_ui ( void )
{
{
@ -1780,6 +1995,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . comp_gain = encoder_tmp ;
configuration . comp_gain = encoder_tmp ;
set_comp_gain ( configuration . comp_gain ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1789,6 +2005,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . comp_response = encoder_tmp ;
configuration . comp_response = encoder_tmp ;
set_comp_response ( configuration . comp_response ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1798,6 +2015,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . comp_limit = encoder_tmp ;
configuration . comp_limit = encoder_tmp ;
set_comp_limit ( configuration . comp_limit ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1807,6 +2025,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . comp_threshold = encoder_tmp ;
configuration . comp_threshold = encoder_tmp ;
set_comp_threshold ( configuration . comp_threshold ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1816,6 +2035,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . comp_attack = encoder_tmp ;
configuration . comp_attack = encoder_tmp ;
set_comp_attack ( configuration . comp_attack ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1825,6 +2045,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . comp_decay = encoder_tmp ;
configuration . comp_decay = encoder_tmp ;
set_comp_decay ( configuration . comp_decay ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1834,6 +2055,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . reverb_roomsize = encoder_tmp ;
configuration . reverb_roomsize = encoder_tmp ;
set_reverb_roomsize ( configuration . reverb_roomsize ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1843,6 +2065,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . reverb_damping = encoder_tmp ;
configuration . reverb_damping = encoder_tmp ;
set_reverb_damping ( configuration . reverb_damping ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1852,6 +2075,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . reverb_level = encoder_tmp ;
configuration . reverb_level = encoder_tmp ;
set_reverb_level ( configuration . reverb_level ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1861,6 +2085,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . chorus_frequency = encoder_tmp ;
configuration . chorus_frequency = encoder_tmp ;
set_chorus_frequency ( configuration . chorus_frequency ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1870,6 +2095,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . chorus_delay = encoder_tmp ;
configuration . chorus_delay = encoder_tmp ;
set_chorus_delay ( configuration . chorus_delay ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1879,6 +2105,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . chorus_level = encoder_tmp ;
configuration . chorus_level = encoder_tmp ;
set_chorus_level ( configuration . chorus_level ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1888,6 +2115,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . bass_lr_level = encoder_tmp ;
configuration . bass_lr_level = encoder_tmp ;
set_bass_lr_level ( configuration . bass_lr_level ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1897,6 +2125,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . bass_mono_level = encoder_tmp ;
configuration . bass_mono_level = encoder_tmp ;
set_bass_mono_level ( configuration . bass_mono_level ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1906,6 +2135,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . eq_bass = encoder_tmp ;
configuration . eq_bass = encoder_tmp ;
set_eq_bass ( configuration . eq_bass ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1915,6 +2145,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . eq_treble = encoder_tmp ;
configuration . eq_treble = encoder_tmp ;
set_eq_treble ( configuration . eq_treble ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1924,6 +2155,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . sound = encoder_tmp ;
configuration . sound = encoder_tmp ;
save_sound ( configuration . sound ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -1933,6 +2165,7 @@ void handle_ui(void)
{
{
// value up/down
// value up/down
configuration . loudness = encoder_tmp ;
configuration . loudness = encoder_tmp ;
set_loudness ( configuration . loudness ) ;
menu_system . update ( ) ;
menu_system . update ( ) ;
}
}
}
}
@ -2003,7 +2236,7 @@ void handle_ui(void)
Serial . print ( " Load sound " ) ;
Serial . print ( " Load sound " ) ;
Serial . println ( configuration . sound ) ;
Serial . println ( configuration . sound ) ;
# endif
# endif
; // TODO
load_sound ( configuration . sound ) ;
}
}
else if ( menu_system . get_currentScreen ( ) = = & save_sound_screen )
else if ( menu_system . get_currentScreen ( ) = = & save_sound_screen )
{
{
@ -2012,7 +2245,7 @@ void handle_ui(void)
Serial . print ( " Save sound " ) ;
Serial . print ( " Save sound " ) ;
Serial . println ( configuration . sound ) ;
Serial . println ( configuration . sound ) ;
# endif
# endif
; // TODO
save_sound ( configuration . sound ) ;
}
}
else
else
{
{