@ -208,6 +208,7 @@ void setup()
Serial . print ( F ( " Version: " ) ) ;
Serial . println ( VERSION ) ;
Serial . println ( F ( " <setup start> " ) ) ;
Serial . flush ( ) ;
setup_midi_devices ( ) ;
@ -215,12 +216,9 @@ void setup()
{
Serial . print ( F ( " Creating MicroDexed instance " ) ) ;
Serial . print ( i , DEC ) ;
Serial . flush ( ) ;
MicroDexed [ i ] = new AudioSourceMicroDexed ( SAMPLE_RATE ) ;
//create_audio_connections(*MicroDexed[i]);
Serial . println ( F ( " ... created " ) ) ;
Serial . flush ( ) ;
}
// Init EEPROM if both buttons are pressed at startup
@ -280,7 +278,6 @@ void setup()
# else
Serial . println ( F ( " Internal DAC enabled. " ) ) ;
# endif
Serial . flush ( ) ;
// start SD card
# ifndef TEENSY4
@ -326,7 +323,6 @@ void setup()
Serial . print ( F ( " [ " ) ) ;
Serial . print ( voice_names [ instance_id ] [ n ] ) ;
Serial . println ( F ( " ] " ) ) ;
Serial . flush ( ) ;
}
# endif
@ -1050,6 +1046,10 @@ void set_volume(uint8_t v, int8_t p, 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 + + )
{
@ -1139,7 +1139,7 @@ void initial_values_from_eeprom(bool init)
else
{
EEPROM . get ( EEPROM_START_ADDRESS , tmp_conf ) ;
checksum = crc32 ( ( uint32_t * ) & tmp_conf + 4 , sizeof ( tmp_conf ) - 4 ) ;
checksum = crc32 ( ( byte * ) & tmp_conf + 4 , sizeof ( tmp_conf ) - 4 ) ;
# ifdef DEBUG
Serial . print ( F ( " EEPROM checksum: 0x " ) ) ;
@ -1158,46 +1158,48 @@ void initial_values_from_eeprom(bool init)
else
{
EEPROM . get ( EEPROM_START_ADDRESS , configuration ) ;
/*
configuration . instances % = INSTANCES_MAX ;
configuration . instance_mode % = INSTANCE_MODE_MAX ;
configuration . instance_splitpoint % = INSTANCE_SPLITPOINT_MAX ;
configuration . vol % = VOLUME_MAX ;
configuration . mono % = MONO_MAX ;
configuration . reverb_roomsize % = REVERB_ROOMSIZE_MAX ;
configuration . reverb_damping % = REVERB_DAMPING_MAX ;
configuration . chorus_frequency % = CHORUS_FREQUENCY_MAX ;
configuration . chorus_waveform % = CHORUS_WAVEFORM_MAX ;
configuration . chorus_depth % = CHORUS_DEPTH_MAX ;
configuration . delay_time % = DELAY_TIME_MAX ;
configuration . delay_feedback % = DELAY_FEEDBACK_MAX ;
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
{
configuration . dexed [ instance_id ] . midi_channel % = MIDI_CHANNEL_MAX ;
configuration . dexed [ instance_id ] . bank % = MAX_BANKS ;
configuration . dexed [ instance_id ] . voice % = MAX_VOICES ;
configuration . dexed [ instance_id ] . pan % = PANORAMA_MAX ;
configuration . dexed [ instance_id ] . reverb_level % = REVERB_LEVEL_MAX ;
configuration . dexed [ instance_id ] . chorus_level % = CHORUS_LEVEL_MAX ;
configuration . dexed [ instance_id ] . delay_level % = DELAY_LEVEL_MAX ;
configuration . dexed [ instance_id ] . filter_cutoff % = FILTER_CUTOFF_MAX ;
configuration . dexed [ instance_id ] . filter_resonance % = FILTER_RESONANCE_MAX ;
configuration . dexed [ instance_id ] . loudness % = LOUDNESS_MAX ;
configuration . dexed [ instance_id ] . polyphony % = POLYPHONY_MAX ;
configuration . dexed [ instance_id ] . engine % = ENGINE_MAX ;
configuration . dexed [ instance_id ] . monopoly % = MONOPOLY_MAX ;
configuration . dexed [ instance_id ] . pb_range % = PB_RANGE_MAX ;
configuration . dexed [ instance_id ] . pb_step % = PB_STEP_MAX ;
configuration . dexed [ instance_id ] . mw_range % = MW_RANGE_MAX ;
configuration . dexed [ instance_id ] . mw_assign % = MW_ASSIGN_MAX ;
configuration . dexed [ instance_id ] . fc_range % = FC_RANGE_MAX ;
configuration . dexed [ instance_id ] . fc_assign % = FC_ASSIGN_MAX ;
configuration . dexed [ instance_id ] . bc_range % = BC_RANGE_MAX ;
configuration . dexed [ instance_id ] . bc_assign % = BC_ASSIGN_MAX ;
configuration . dexed [ instance_id ] . at_range % = AT_RANGE_MAX ;
configuration . dexed [ instance_id ] . at_assign % = AT_ASSIGN_MAX ;
configuration . dexed [ instance_id ] . op_enabled % = 0x3f ; */
configuration . instances % = INSTANCES_MAX ;
configuration . instance_mode % = INSTANCE_MODE_MAX ;
configuration . instance_splitpoint % = INSTANCE_SPLITPOINT_MAX ;
configuration . vol % = VOLUME_MAX ;
configuration . mono % = MONO_MAX ;
configuration . reverb_roomsize % = REVERB_ROOMSIZE_MAX ;
configuration . reverb_damping % = REVERB_DAMPING_MAX ;
configuration . chorus_frequency % = CHORUS_FREQUENCY_MAX ;
configuration . chorus_waveform % = CHORUS_WAVEFORM_MAX ;
configuration . chorus_depth % = CHORUS_DEPTH_MAX ;
configuration . delay_time % = DELAY_TIME_MAX ;
configuration . delay_feedback % = DELAY_FEEDBACK_MAX ;
for ( uint8_t instance_id = 0 ; instance_id < NUM_DEXED ; instance_id + + )
{
configuration . dexed [ instance_id ] . midi_channel % = MIDI_CHANNEL_MAX ;
configuration . dexed [ instance_id ] . bank % = MAX_BANKS ;
configuration . dexed [ instance_id ] . voice % = MAX_VOICES ;
configuration . dexed [ instance_id ] . pan % = PANORAMA_MAX ;
configuration . dexed [ instance_id ] . reverb_level % = REVERB_LEVEL_MAX ;
configuration . dexed [ instance_id ] . chorus_level % = CHORUS_LEVEL_MAX ;
configuration . dexed [ instance_id ] . delay_level % = DELAY_LEVEL_MAX ;
configuration . dexed [ instance_id ] . filter_cutoff % = FILTER_CUTOFF_MAX ;
configuration . dexed [ instance_id ] . filter_resonance % = FILTER_RESONANCE_MAX ;
configuration . dexed [ instance_id ] . loudness % = LOUDNESS_MAX ;
configuration . dexed [ instance_id ] . polyphony % = POLYPHONY_MAX ;
configuration . dexed [ instance_id ] . engine % = ENGINE_MAX ;
configuration . dexed [ instance_id ] . monopoly % = MONOPOLY_MAX ;
configuration . dexed [ instance_id ] . pb_range % = PB_RANGE_MAX ;
configuration . dexed [ instance_id ] . pb_step % = PB_STEP_MAX ;
configuration . dexed [ instance_id ] . mw_range % = MW_RANGE_MAX ;
configuration . dexed [ instance_id ] . mw_assign % = MW_ASSIGN_MAX ;
configuration . dexed [ instance_id ] . fc_range % = FC_RANGE_MAX ;
configuration . dexed [ instance_id ] . fc_assign % = FC_ASSIGN_MAX ;
configuration . dexed [ instance_id ] . bc_range % = BC_RANGE_MAX ;
configuration . dexed [ instance_id ] . bc_assign % = BC_ASSIGN_MAX ;
configuration . dexed [ instance_id ] . at_range % = AT_RANGE_MAX ;
configuration . dexed [ instance_id ] . at_assign % = AT_ASSIGN_MAX ;
configuration . dexed [ instance_id ] . op_enabled % = 0x3f ;
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 ) ;
MicroDexed [ instance_id ] - > setFCController ( configuration . dexed [ instance_id ] . fc_range , configuration . dexed [ instance_id ] . fc_assign ) ;
@ -1276,14 +1278,14 @@ void eeprom_write(void)
void eeprom_update ( void )
{
eeprom_update_flag = false ;
configuration . checksum = crc32 ( ( uint32_t * ) & configuration + 4 , sizeof ( configuration ) - 4 ) ;
configuration . checksum = crc32 ( ( byte * ) & configuration + 4 , sizeof ( configuration ) - 4 ) ;
EEPROM . put ( EEPROM_START_ADDRESS , configuration ) ;
Serial . println ( F ( " Updating EEPROM " ) ) ;
show_configuration ( ) ;
}
uint32_t crc32 ( uint32_t * calc_start , uint16_t calc_bytes ) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc
uint32_t crc32 ( byte * calc_start , uint16_t calc_bytes ) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc
{
uint32_t * index ;
const uint32_t crc_table [ 16 ] =
{
0x00000000 , 0x1db71064 , 0x3b6e20c8 , 0x26d930ac ,
@ -1293,7 +1295,7 @@ uint32_t crc32(uint32_t* calc_start, uint16_t calc_bytes) // base code from http
} ;
uint32_t crc = ~ 0L ;
for ( index = calc_start ; index < ( calc_start + calc_bytes ) ; + + index )
for ( byte * index = calc_start ; index < ( calc_start + calc_bytes ) ; + + index )
{
crc = crc_table [ ( crc ^ * index ) & 0x0f ] ^ ( crc > > 4 ) ;
crc = crc_table [ ( crc ^ ( * index > > 4 ) ) & 0x0f ] ^ ( crc > > 4 ) ;
@ -1466,7 +1468,6 @@ void show_patch(uint8_t instance_id)
{
Serial . print ( MicroDexed [ instance_id ] - > data [ DEXED_VOICE_OFFSET + i ] , DEC ) ;
Serial . print ( F ( " " ) ) ;
Serial . flush ( ) ;
}
Serial . println ( ) ;
Serial . print ( F ( " ALG: " ) ) ;
@ -1502,7 +1503,6 @@ void show_patch(uint8_t instance_id)
Serial . print ( i , DEC ) ;
Serial . print ( F ( " : " ) ) ;
Serial . println ( MicroDexed [ instance_id ] - > data [ i ] ) ;
Serial . flush ( ) ;
}
Serial . println ( ) ;