|
|
@ -95,44 +95,44 @@ elapsedMillis control_rate; |
|
|
|
elapsedMillis autostore; |
|
|
|
elapsedMillis autostore; |
|
|
|
const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES); |
|
|
|
const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES); |
|
|
|
config_t configuration = { |
|
|
|
config_t configuration = { |
|
|
|
0xffff, // checksum
|
|
|
|
0xffff, // checksum
|
|
|
|
1, // sound
|
|
|
|
1, // sound
|
|
|
|
ENC_DECAY_DEFAULT, // decay
|
|
|
|
ENC_DECAY_DEFAULT, // decay
|
|
|
|
ENC_RELEASE_DEFAULT, //release
|
|
|
|
ENC_RELEASE_DEFAULT, // release
|
|
|
|
ENC_HARDNESS_DEFAULT, // hardness
|
|
|
|
ENC_HARDNESS_DEFAULT, // hardness
|
|
|
|
ENC_TREBLE_DEFAULT, // treble
|
|
|
|
ENC_TREBLE_DEFAULT, // treble
|
|
|
|
ENC_STEREO_DEFAULT, // stereo
|
|
|
|
ENC_STEREO_DEFAULT, // stereo
|
|
|
|
ENC_TRANSPOSE_DEFAULT,// transpose
|
|
|
|
ENC_TRANSPOSE_DEFAULT, // transpose
|
|
|
|
ENC_TUNE_DEFAULT, // tune
|
|
|
|
ENC_TUNE_DEFAULT, // tune
|
|
|
|
ENC_DETUNE_DEFAULT, // detune
|
|
|
|
ENC_DETUNE_DEFAULT, // detune
|
|
|
|
ENC_VELOCITY_SENSE_DEFAULT, // velocity_sense
|
|
|
|
ENC_VELOCITY_SENSE_DEFAULT, // velocity_sense
|
|
|
|
ENC_PAN_TREM_FREQUENCY_DEFAULT,// pan_trem_frequency
|
|
|
|
ENC_PAN_TREM_FREQUENCY_DEFAULT, // pan_trem_frequency
|
|
|
|
ENC_PAN_TREM_LEVEL_DEFAULT, // pan_trem_level
|
|
|
|
ENC_PAN_TREM_LEVEL_DEFAULT, // pan_trem_level
|
|
|
|
ENC_OVERDRIVE_DEFAULT, // overdrive
|
|
|
|
ENC_OVERDRIVE_DEFAULT, // overdrive
|
|
|
|
ENC_COMP_GAIN_DEFAULT, // comp_gain
|
|
|
|
ENC_COMP_GAIN_DEFAULT, // comp_gain
|
|
|
|
ENC_COMP_RESPONSE_DEFAULT, // comp_response
|
|
|
|
ENC_COMP_RESPONSE_DEFAULT, // comp_response
|
|
|
|
ENC_COMP_LIMIT_DEFAULT, // comp_limit
|
|
|
|
ENC_COMP_LIMIT_DEFAULT, // comp_limit
|
|
|
|
ENC_COMP_THRESHOLD_DEFAULT, // comp_threshold
|
|
|
|
ENC_COMP_THRESHOLD_DEFAULT, // comp_threshold
|
|
|
|
ENC_COMP_ATTACK_DEFAULT, // comp_attack
|
|
|
|
ENC_COMP_ATTACK_DEFAULT, // comp_attack
|
|
|
|
ENC_COMP_DECAY_DEFAULT, // comp_decay
|
|
|
|
ENC_COMP_DECAY_DEFAULT, // comp_decay
|
|
|
|
ENC_REVERB_ROOMSIZE_DEFAULT,// reverb_roomsize
|
|
|
|
ENC_REVERB_ROOMSIZE_DEFAULT, // reverb_roomsize
|
|
|
|
ENC_REVERB_DAMPING_DEFAULT, // reverb_damping
|
|
|
|
ENC_REVERB_DAMPING_DEFAULT, // reverb_damping
|
|
|
|
ENC_REVERB_LEVEL_DEFAULT, // reverb_level
|
|
|
|
ENC_REVERB_LEVEL_DEFAULT, // reverb_level
|
|
|
|
ENC_CHORUS_FREQUENCY_DEFAULT,// chorus_frequency
|
|
|
|
ENC_CHORUS_FREQUENCY_DEFAULT, // chorus_frequency
|
|
|
|
ENC_CHORUS_DELAY_DEFAULT, // chorus_delay
|
|
|
|
ENC_CHORUS_DELAY_DEFAULT, // chorus_delay
|
|
|
|
ENC_CHORUS_LEVEL_DEFAULT, // chorus_level
|
|
|
|
ENC_CHORUS_LEVEL_DEFAULT, // chorus_level
|
|
|
|
ENC_BASS_LR_LEVEL_DEFAULT, // bass_lr_level
|
|
|
|
ENC_BASS_LR_LEVEL_DEFAULT, // bass_lr_level
|
|
|
|
ENC_BASS_MONO_LEVEL_DEFAULT,// bass_mono_level
|
|
|
|
ENC_BASS_MONO_LEVEL_DEFAULT, // bass_mono_level
|
|
|
|
ENC_EQ_BASS_DEFAULT, // eq_bass
|
|
|
|
ENC_EQ_BASS_DEFAULT, // eq_bass
|
|
|
|
ENC_EQ_TREBLE_DEFAULT, // eq_treble
|
|
|
|
ENC_EQ_TREBLE_DEFAULT, // eq_treble
|
|
|
|
ENC_LOUDNESS_DEFAULT, // loudness
|
|
|
|
ENC_LOUDNESS_DEFAULT, // loudness
|
|
|
|
ENC_MIDI_CHANNEL_DEFAULT, // midi_channel
|
|
|
|
ENC_MIDI_CHANNEL_DEFAULT, // midi_channel
|
|
|
|
ENC_MIDI_SOFT_THRU_DEFAULT, // midi_soft_thru
|
|
|
|
ENC_MIDI_SOFT_THRU_DEFAULT, // midi_soft_thru
|
|
|
|
ENC_MAX_POLY_DEFAULT, // max_poly
|
|
|
|
ENC_MAX_POLY_DEFAULT, // max_poly
|
|
|
|
0 // pan
|
|
|
|
0 // pan
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
float _loudness=mapfloat(float(ENC_LOUDNESS_DEFAULT), ENC_LOUDNESS_MIN, ENC_LOUDNESS_MAX, 0.0, 1.0); |
|
|
|
float _loudness = mapfloat(float(ENC_LOUDNESS_DEFAULT), ENC_LOUDNESS_MIN, ENC_LOUDNESS_MAX, 0.0, 1.0); |
|
|
|
|
|
|
|
|
|
|
|
bool eeprom_update_flag = false; |
|
|
|
bool eeprom_update_flag = false; |
|
|
|
#ifdef SHOW_CPU_LOAD_MSEC |
|
|
|
#ifdef SHOW_CPU_LOAD_MSEC |
|
|
@ -146,14 +146,13 @@ elapsedMillis cpu_mem_millis; |
|
|
|
|
|
|
|
|
|
|
|
void setup() |
|
|
|
void setup() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Serial.begin(SERIAL_SPEED); |
|
|
|
|
|
|
|
|
|
|
|
pinMode(BUT_L_PIN, INPUT_PULLUP); |
|
|
|
pinMode(BUT_L_PIN, INPUT_PULLUP); |
|
|
|
pinMode(BUT_R_PIN, INPUT_PULLUP); |
|
|
|
pinMode(BUT_R_PIN, INPUT_PULLUP); |
|
|
|
|
|
|
|
|
|
|
|
init_menus(); |
|
|
|
init_menus(); |
|
|
|
|
|
|
|
|
|
|
|
Serial.begin(SERIAL_SPEED); |
|
|
|
|
|
|
|
delay(500); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Debug output
|
|
|
|
// Debug output
|
|
|
|
Serial.println(F("MicroMDAEPiano based on https://sourceforge.net/projects/mda-vst")); |
|
|
|
Serial.println(F("MicroMDAEPiano based on https://sourceforge.net/projects/mda-vst")); |
|
|
|
Serial.println(F("(c)2018/2019 H. Wirtz <wirtz@parasitstudio.de>")); |
|
|
|
Serial.println(F("(c)2018/2019 H. Wirtz <wirtz@parasitstudio.de>")); |
|
|
@ -227,25 +226,7 @@ void setup() |
|
|
|
Serial.print(F(" (Time per block=")); |
|
|
|
Serial.print(F(" (Time per block=")); |
|
|
|
Serial.print(audio_block_time_us); |
|
|
|
Serial.print(audio_block_time_us); |
|
|
|
Serial.println(F("ms)")); |
|
|
|
Serial.println(F("ms)")); |
|
|
|
/*^
|
|
|
|
|
|
|
|
ep->setParameter(MDA_EP_DECAY, 0.5); |
|
|
|
|
|
|
|
ep->setParameter(MDA_EP_RELEASE, 0.5); |
|
|
|
|
|
|
|
ep->setParameter(MDA_EP_HARDNESS, 0.7); |
|
|
|
|
|
|
|
ep->setParameter(MDA_EP_TREBLE, 0.85); |
|
|
|
|
|
|
|
ep->setParameter(MDA_EP_DETUNE, 0.1); |
|
|
|
|
|
|
|
ep->setParameter(MDA_EP_VELOCITY_SENSE, 1.0); |
|
|
|
|
|
|
|
ep->setParameter(MDA_EP_STEREO, 0.7); |
|
|
|
|
|
|
|
ep->setParameter(MDA_EP_OVERDRIVE, 0.3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
freeverb_r.roomsize(0.2); |
|
|
|
|
|
|
|
freeverb_l.roomsize(0.2); |
|
|
|
|
|
|
|
freeverb_r.damping(0.5); |
|
|
|
|
|
|
|
freeverb_l.damping(0.5); |
|
|
|
|
|
|
|
mixer_r.gain(0, 0.7); |
|
|
|
|
|
|
|
mixer_l.gain(0, 0.7); |
|
|
|
|
|
|
|
mixer_r.gain(1, 0.3); |
|
|
|
|
|
|
|
mixer_l.gain(1, 0.3); |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
set_complete_configuration(); |
|
|
|
set_complete_configuration(); |
|
|
|
|
|
|
|
|
|
|
|
AudioInterrupts(); |
|
|
|
AudioInterrupts(); |
|
|
@ -453,7 +434,7 @@ bool checkMidiChannel(byte inChannel) |
|
|
|
|
|
|
|
|
|
|
|
void set_master_volume(uint8_t value) |
|
|
|
void set_master_volume(uint8_t value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
configuration.pan=0; // BAD HACK!
|
|
|
|
configuration.pan = 0; // BAD HACK!
|
|
|
|
uint16_t tmp = map(value, ENC_MASTER_VOLUME_MIN, ENC_MASTER_VOLUME_MAX, 0, 0x3ff); |
|
|
|
uint16_t tmp = map(value, ENC_MASTER_VOLUME_MIN, ENC_MASTER_VOLUME_MAX, 0, 0x3ff); |
|
|
|
float tmp2 = mapfloat(configuration.pan, ENC_MASTER_PAN_MIN, ENC_MASTER_PAN_MAX, 0.0, 1.0); |
|
|
|
float tmp2 = mapfloat(configuration.pan, ENC_MASTER_PAN_MIN, ENC_MASTER_PAN_MAX, 0.0, 1.0); |
|
|
|
float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20); |
|
|
|
float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20); |
|
|
|