Added midi_soft_thru enable/disable functionality.

Small fixes.
master
Holger Wirtz 6 years ago
parent c98c929cf5
commit 379a7006ae
  1. 99
      MicroMDAEPiano.ino
  2. 52
      UI.hpp
  3. 6
      config.h
  4. 785
      midi_devices.hpp

@ -95,44 +95,44 @@ elapsedMillis control_rate;
elapsedMillis autostore;
const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES);
config_t configuration = {
0xffff, // checksum
1, // sound
ENC_DECAY_DEFAULT, // decay
ENC_RELEASE_DEFAULT, //release
ENC_HARDNESS_DEFAULT, // hardness
ENC_TREBLE_DEFAULT, // treble
ENC_STEREO_DEFAULT, // stereo
ENC_TRANSPOSE_DEFAULT,// transpose
ENC_TUNE_DEFAULT, // tune
ENC_DETUNE_DEFAULT, // detune
ENC_VELOCITY_SENSE_DEFAULT, // velocity_sense
ENC_PAN_TREM_FREQUENCY_DEFAULT,// pan_trem_frequency
ENC_PAN_TREM_LEVEL_DEFAULT, // pan_trem_level
ENC_OVERDRIVE_DEFAULT, // overdrive
ENC_COMP_GAIN_DEFAULT, // comp_gain
ENC_COMP_RESPONSE_DEFAULT, // comp_response
ENC_COMP_LIMIT_DEFAULT, // comp_limit
ENC_COMP_THRESHOLD_DEFAULT, // comp_threshold
ENC_COMP_ATTACK_DEFAULT, // comp_attack
ENC_COMP_DECAY_DEFAULT, // comp_decay
ENC_REVERB_ROOMSIZE_DEFAULT,// reverb_roomsize
ENC_REVERB_DAMPING_DEFAULT, // reverb_damping
ENC_REVERB_LEVEL_DEFAULT, // reverb_level
ENC_CHORUS_FREQUENCY_DEFAULT,// chorus_frequency
ENC_CHORUS_DELAY_DEFAULT, // chorus_delay
ENC_CHORUS_LEVEL_DEFAULT, // chorus_level
ENC_BASS_LR_LEVEL_DEFAULT, // bass_lr_level
ENC_BASS_MONO_LEVEL_DEFAULT,// bass_mono_level
ENC_EQ_BASS_DEFAULT, // eq_bass
ENC_EQ_TREBLE_DEFAULT, // eq_treble
ENC_LOUDNESS_DEFAULT, // loudness
ENC_MIDI_CHANNEL_DEFAULT, // midi_channel
ENC_MIDI_SOFT_THRU_DEFAULT, // midi_soft_thru
ENC_MAX_POLY_DEFAULT, // max_poly
0 // pan
0xffff, // checksum
1, // sound
ENC_DECAY_DEFAULT, // decay
ENC_RELEASE_DEFAULT, // release
ENC_HARDNESS_DEFAULT, // hardness
ENC_TREBLE_DEFAULT, // treble
ENC_STEREO_DEFAULT, // stereo
ENC_TRANSPOSE_DEFAULT, // transpose
ENC_TUNE_DEFAULT, // tune
ENC_DETUNE_DEFAULT, // detune
ENC_VELOCITY_SENSE_DEFAULT, // velocity_sense
ENC_PAN_TREM_FREQUENCY_DEFAULT, // pan_trem_frequency
ENC_PAN_TREM_LEVEL_DEFAULT, // pan_trem_level
ENC_OVERDRIVE_DEFAULT, // overdrive
ENC_COMP_GAIN_DEFAULT, // comp_gain
ENC_COMP_RESPONSE_DEFAULT, // comp_response
ENC_COMP_LIMIT_DEFAULT, // comp_limit
ENC_COMP_THRESHOLD_DEFAULT, // comp_threshold
ENC_COMP_ATTACK_DEFAULT, // comp_attack
ENC_COMP_DECAY_DEFAULT, // comp_decay
ENC_REVERB_ROOMSIZE_DEFAULT, // reverb_roomsize
ENC_REVERB_DAMPING_DEFAULT, // reverb_damping
ENC_REVERB_LEVEL_DEFAULT, // reverb_level
ENC_CHORUS_FREQUENCY_DEFAULT, // chorus_frequency
ENC_CHORUS_DELAY_DEFAULT, // chorus_delay
ENC_CHORUS_LEVEL_DEFAULT, // chorus_level
ENC_BASS_LR_LEVEL_DEFAULT, // bass_lr_level
ENC_BASS_MONO_LEVEL_DEFAULT, // bass_mono_level
ENC_EQ_BASS_DEFAULT, // eq_bass
ENC_EQ_TREBLE_DEFAULT, // eq_treble
ENC_LOUDNESS_DEFAULT, // loudness
ENC_MIDI_CHANNEL_DEFAULT, // midi_channel
ENC_MIDI_SOFT_THRU_DEFAULT, // midi_soft_thru
ENC_MAX_POLY_DEFAULT, // max_poly
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;
#ifdef SHOW_CPU_LOAD_MSEC
@ -146,14 +146,13 @@ elapsedMillis cpu_mem_millis;
void setup()
{
Serial.begin(SERIAL_SPEED);
pinMode(BUT_L_PIN, INPUT_PULLUP);
pinMode(BUT_R_PIN, INPUT_PULLUP);
init_menus();
Serial.begin(SERIAL_SPEED);
delay(500);
// Debug output
Serial.println(F("MicroMDAEPiano based on https://sourceforge.net/projects/mda-vst"));
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(audio_block_time_us);
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();
AudioInterrupts();
@ -453,7 +434,7 @@ bool checkMidiChannel(byte inChannel)
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);
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);

@ -92,7 +92,6 @@ int8_t menu_position[NUM_MENUS];
#define LEFT_ENCODER 0
#define RIGHT_ENCODER 1
extern mdaEPiano* ep;
extern void set_master_volume(uint8_t value);
extern AudioControlSGTL5000 sgtl5000_1;
extern AudioEffectFreeverb freeverb_r;
@ -101,6 +100,8 @@ extern AudioMixer4 mixer_r;
extern AudioMixer4 mixer_l;
extern AudioAmplifier volume_r;
extern AudioAmplifier volume_l;
extern void eeprom_write(void);
extern mdaEPiano* ep;
extern float _loudness;
/******************************************
@ -193,13 +194,36 @@ char* get_comp_decay_value_text(void)
return (comp_decay_value_text1);
}
char tune_value_text1[] = " ";
char tune_value_text1[] = " ";
char* get_tune_value_text(void)
{
sprintf(tune_value_text1, "%3d cent", configuration.tune);
return (tune_value_text1);
}
char midi_channel_value_text1[] = " ";
char* get_midi_channel_value_text(void)
{
if (configuration.midi_channel == 0)
sprintf(midi_channel_value_text1, "OMNI");
else
sprintf(midi_channel_value_text1, "%02d", configuration.midi_channel);
return (midi_channel_value_text1);
}
char midi_soft_thru_value_text1[] = " ";
char* get_midi_soft_thru_value_text(void)
{
if (configuration.midi_soft_thru == false)
sprintf(midi_soft_thru_value_text1, "Off");
else
sprintf(midi_soft_thru_value_text1, "On ");
return (midi_soft_thru_value_text1);
}
/******************************************
MAIN MENU
******************************************/
@ -627,7 +651,7 @@ LiquidMenu loudness_menu(lcd);
#define NUM_MIDI_CHANNEL_MENUS 1
const char midi_channel_text1[] PROGMEM = "MIDI Channel";
LiquidLine midi_channel_line1(1, 0, midi_channel_text1);
LiquidLine midi_channel_line2(1, 1, configuration.midi_channel);
LiquidLine midi_channel_line2(1, 1, get_midi_channel_value_text);
LiquidScreen midi_channel_screen;
LiquidMenu midi_channel_menu(lcd);
@ -637,7 +661,7 @@ LiquidMenu midi_channel_menu(lcd);
#define NUM_MIDI_SOFT_THRU_MENUS 1
const char midi_soft_thru_text1[] PROGMEM = "MIDI Soft Thru";
LiquidLine midi_soft_thru_line1(1, 0, midi_soft_thru_text1);
LiquidLine midi_soft_thru_line2(1, 1, configuration.midi_soft_thru);
LiquidLine midi_soft_thru_line2(1, 1, get_midi_soft_thru_value_text);
LiquidScreen midi_soft_thru_screen;
LiquidMenu midi_soft_thru_menu(lcd);
@ -1156,7 +1180,9 @@ void callback_midi_soft_thru_function()
menu_system.change_menu(midi_soft_thru_menu);
menu_position[SYSTEM] = encoder_value[RIGHT_ENCODER];
encoder_value[RIGHT_ENCODER] = configuration.midi_soft_thru;
Serial.print("XXXXXX");Serial.println(configuration.midi_soft_thru,DEC);
enc[RIGHT_ENCODER].write(configuration.midi_soft_thru, ENC_MIDI_SOFT_THRU_MIN, ENC_MIDI_SOFT_THRU_MAX);
Serial.print("YYYYYYYY");Serial.println(configuration.midi_soft_thru,DEC);
menu_system.update();
}
@ -1255,7 +1281,12 @@ void init_menus(void)
lcd.blink_off();
lcd.cursor_off();
lcd.backlight();
//lcd.noAutoscroll();
lcd.clear();
lcd.setCursor(1, 0);
lcd.print("MicroMDAEPiano");
lcd.setCursor(0, 1);
lcd.print("(c)parasiTstudio");
delay(1000);
// setup main menu
main_screen.add_line(main_line1);
@ -1643,7 +1674,7 @@ void save_sound(uint8_t value)
Serial.print(F("Save sound "));
Serial.println(value);
#endif
;
eeprom_write();
}
void set_decay(uint8_t value)
@ -1874,8 +1905,10 @@ void set_reverb_level(uint8_t value)
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(0, 1.0 - tmp);
//mixer_l.gain(0, 1.0 - tmp);
mixer_r.gain(0, 1.0);
mixer_l.gain(0, 1.0);
mixer_r.gain(1, tmp);
mixer_l.gain(1, tmp);
configuration.reverb_level = value;
@ -2028,6 +2061,9 @@ void set_complete_configuration(void)
set_eq_bass(configuration.eq_bass);
set_eq_treble(configuration.eq_treble);
set_loudness(configuration.loudness);
set_midi_channel(configuration.midi_channel);
set_midi_soft_thru(configuration.midi_soft_thru);
set_max_poly(configuration.max_poly);
}
//********************************************************************************************+

@ -234,11 +234,11 @@
//
#define ENC_BASS_LR_LEVEL_MIN 0
#define ENC_BASS_LR_LEVEL_MAX 99
#define ENC_BASS_LR_LEVEL_DEFAULT 50
#define ENC_BASS_LR_LEVEL_DEFAULT 99
//
#define ENC_BASS_MONO_LEVEL_MIN 0
#define ENC_BASS_MONO_LEVEL_MAX 99
#define ENC_BASS_MONO_LEVEL_DEFAULT 50
#define ENC_BASS_MONO_LEVEL_DEFAULT 0
//
#define ENC_EQ_BASS_MIN 0
#define ENC_EQ_BASS_MAX 99
@ -339,7 +339,7 @@ struct config_t {
uint8_t eq_treble;
uint8_t loudness;
uint8_t midi_channel;
bool midi_soft_thru;
uint8_t midi_soft_thru;
uint8_t max_poly;
int8_t pan;
};

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save