From c24bdb4cfde7679c8056c69d6e6f37e415064a5c Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 2 Jun 2020 09:36:03 +0200 Subject: [PATCH] Small fixes for audio-thru support. Removing a not used menu. --- MicroDexed.ino | 9 ++++++ UI.hpp | 34 ----------------------- UI_FX.h | 75 +++++++++++++++++++++++++------------------------- UI_NO_FX.h | 67 ++++++++++++++++++++++---------------------- config.h | 6 ++-- dexed_sd.cpp | 9 ++++-- 6 files changed, 88 insertions(+), 112 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 384fead..9a47f99 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -104,9 +104,11 @@ AudioOutputI2S i2s1; AudioConnection patchCord12(stereo2mono, 0, i2s1, 0); AudioConnection patchCord13(stereo2mono, 1, i2s1, 1); AudioControlSGTL5000 sgtl5000_1; +#ifdef SGTL5000_AUDIO_THRU AudioInputI2S i2s1in; AudioConnection patchCord17(i2s1in, 0, master_mixer_r, 2); AudioConnection patchCord18(i2s1in, 1, master_mixer_l, 2); +#endif #elif defined (I2S_AUDIO_ONLY) AudioOutputI2S i2s1; AudioConnection patchCord12(stereo2mono, 0, i2s1, 0); @@ -291,6 +293,11 @@ void setup() sgtl5000_1.volume(SGTL5000_HEADPHONE_VOLUME, SGTL5000_HEADPHONE_VOLUME); // Headphone volume sgtl5000_1.audioProcessorDisable(); sgtl5000_1.audioPostProcessorEnable(); +#ifdef SGTL5000_AUDIO_THRU + sgtl5000_1.inputSelect(AUDIO_INPUT_LINEIN); + sgtl5000_1.lineInLevel(5); + sgtl5000_1.adcHighPassFilterEnable(); +#endif #ifdef SGTL5000_AUDIO_ENHANCE sgtl5000_1.enhanceBassEnable(); sgtl5000_1.enhanceBass(1.0, 1.5); // enhanceBass(1.0, 1.0, 1, 2); // Configures the bass enhancement by setting the levels of the original stereo signal and the bass-enhanced mono level which will be mixed together. The high-pass filter may be enabled (0) or bypassed (1). @@ -459,11 +466,13 @@ void setup() master_mixer_l.gain(0, 1.0); #endif #ifdef TEENSY_AUDIO_BOARD +#ifdef SGTL5000_AUDIO_THRU master_mixer_r.gain(2, 1.0); // I2S Input master_mixer_l.gain(2, 1.0); // I2S Input #else master_mixer_r.gain(2, 0.0); // I2S Input master_mixer_l.gain(2, 0.0); // I2S Input +#endif #endif master_mixer_r.gain(3, 0.0); master_mixer_l.gain(3, 0.0); diff --git a/UI.hpp b/UI.hpp index c551f36..592b184 100644 --- a/UI.hpp +++ b/UI.hpp @@ -230,7 +230,6 @@ void UI_func_midi_soft_thru(uint8_t param); void UI_func_velocity_level(uint8_t param); void UI_func_voice_select(uint8_t param); void UI_func_sysex_send_voice(uint8_t param); -void UI_func_sysex_receive_voice(uint8_t param); void UI_func_sysex_receive_bank(uint8_t param); void UI_func_sysex_send_bank(uint8_t param); void UI_func_eq_bass(uint8_t param); @@ -5104,39 +5103,6 @@ void UI_func_sysex_send_voice(uint8_t param) } } -void UI_func_sysex_receive_voice(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* - { - encoderDir[ENC_R].reset(); - - lcd.setCursor(0, 0); - lcd.print(F("MIDI Receive Voice")); - lcd.setCursor(0, 1); - lcd.print(F("Not implemented.")); - } - - if (LCDML.FUNC_loop()) // ****** LOOP ********* - { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { - ; - } - else if (LCDML.BT_checkUp()) - { - ; - } - } - } - - if (LCDML.FUNC_close()) // ****** STABLE END ********* - { - encoderDir[ENC_R].reset(); - } -} - void UI_func_eq_bass(uint8_t param) { #ifndef SGTL5000_AUDIO_ENHANCE diff --git a/UI_FX.h b/UI_FX.h index 3b9bf22..e2ed4de 100644 --- a/UI_FX.h +++ b/UI_FX.h @@ -75,42 +75,41 @@ LCDML_add(46, LCDML_0_1, 4, "MIDI", NULL); LCDML_add(47, LCDML_0_1_4, 1, "MIDI Channel", UI_func_midi_channel); LCDML_add(48, LCDML_0_1_4, 2, "Lowest Note", UI_func_lowest_note); LCDML_add(49, LCDML_0_1_4, 3, "Highest Note", UI_func_highest_note); -LCDML_add(50, LCDML_0_1_4, 4, "Send Voice", UI_func_sysex_send_voice); -LCDML_add(51, LCDML_0_1_4, 5, "Receive Voice", UI_func_sysex_receive_voice); -LCDML_add(52, LCDML_0_1, 5, "Setup", NULL); -LCDML_add(53, LCDML_0_1_5, 1, "Portamento", NULL); -LCDML_add(54, LCDML_0_1_5_1, 1, "Port. Mode", UI_func_portamento_mode); -LCDML_add(55, LCDML_0_1_5_1, 2, "Port. Gliss", UI_func_portamento_glissando); -LCDML_add(56, LCDML_0_1_5_1, 3, "Port. Time", UI_func_portamento_time); -LCDML_add(57, LCDML_0_1_5, 2, "Polyphony", UI_func_polyphony); -LCDML_add(58, LCDML_0_1_5, 3, "Transpose", UI_func_transpose); -LCDML_add(59, LCDML_0_1_5, 4, "Fine Tune", UI_func_tune); -LCDML_add(60, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly); -LCDML_add(61, LCDML_0_1, 6, "Internal", NULL); -LCDML_add(62, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh); -LCDML_add(63, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level); -LCDML_add(64, LCDML_0_1_6, 3, "Engine", UI_func_engine); -LCDML_add(65, LCDML_0_1, 7, "Operator", UI_handle_OP); -LCDML_add(66, LCDML_0_1, 8, "Save Voice", UI_func_save_voice); -LCDML_add(67, LCDML_0, 3, "Load/Save", NULL); -LCDML_add(68, LCDML_0_3, 1, "Performance", NULL); -LCDML_add(69, LCDML_0_3_1, 1, "Load Perf.", UI_func_load_performance); -LCDML_add(70, LCDML_0_3_1, 2, "Save Perf.", UI_func_save_performance); -LCDML_add(71, LCDML_0_3, 2, "Voice Config", NULL); -LCDML_add(72, LCDML_0_3_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig); -LCDML_add(73, LCDML_0_3_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig); -LCDML_add(74, LCDML_0_3, 3, "Effects", NULL); -LCDML_add(75, LCDML_0_3_3, 1, "Load Effects", UI_func_load_fx); -LCDML_add(76, LCDML_0_3_3, 2, "Save Effects", UI_func_save_fx); -LCDML_add(77, LCDML_0_3, 5, "MIDI", NULL); -LCDML_add(78, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); -LCDML_add(79, LCDML_0_3_5, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); -LCDML_add(80, LCDML_0_3_5, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); -LCDML_add(81, LCDML_0, 4, "System", NULL); -LCDML_add(82, LCDML_0_4, 1, "Volume", UI_func_volume); -LCDML_add(83, LCDML_0_4, 2, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(84, LCDML_0_4, 3, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(85, LCDML_0_4, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(86, LCDML_0, 6, "Info", UI_func_information); -#define _LCDML_DISP_cnt 86 +LCDML_add(50, LCDML_0_1_4, 4, "MIDI Send Voice", UI_func_sysex_send_voice); +LCDML_add(51, LCDML_0_1, 5, "Setup", NULL); +LCDML_add(52, LCDML_0_1_5, 1, "Portamento", NULL); +LCDML_add(53, LCDML_0_1_5_1, 1, "Port. Mode", UI_func_portamento_mode); +LCDML_add(54, LCDML_0_1_5_1, 2, "Port. Gliss", UI_func_portamento_glissando); +LCDML_add(55, LCDML_0_1_5_1, 3, "Port. Time", UI_func_portamento_time); +LCDML_add(56, LCDML_0_1_5, 2, "Polyphony", UI_func_polyphony); +LCDML_add(57, LCDML_0_1_5, 3, "Transpose", UI_func_transpose); +LCDML_add(58, LCDML_0_1_5, 4, "Fine Tune", UI_func_tune); +LCDML_add(59, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly); +LCDML_add(60, LCDML_0_1, 6, "Internal", NULL); +LCDML_add(61, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh); +LCDML_add(62, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level); +LCDML_add(63, LCDML_0_1_6, 3, "Engine", UI_func_engine); +LCDML_add(64, LCDML_0_1, 7, "Operator", UI_handle_OP); +LCDML_add(65, LCDML_0_1, 8, "Save Voice", UI_func_save_voice); +LCDML_add(66, LCDML_0, 3, "Load/Save", NULL); +LCDML_add(67, LCDML_0_3, 1, "Performance", NULL); +LCDML_add(68, LCDML_0_3_1, 1, "Load Perf.", UI_func_load_performance); +LCDML_add(69, LCDML_0_3_1, 2, "Save Perf.", UI_func_save_performance); +LCDML_add(70, LCDML_0_3, 2, "Voice Config", NULL); +LCDML_add(71, LCDML_0_3_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig); +LCDML_add(72, LCDML_0_3_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig); +LCDML_add(73, LCDML_0_3, 3, "Effects", NULL); +LCDML_add(74, LCDML_0_3_3, 1, "Load Effects", UI_func_load_fx); +LCDML_add(75, LCDML_0_3_3, 2, "Save Effects", UI_func_save_fx); +LCDML_add(76, LCDML_0_3, 5, "MIDI", NULL); +LCDML_add(77, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); +LCDML_add(78, LCDML_0_3_5, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); +LCDML_add(79, LCDML_0_3_5, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); +LCDML_add(80, LCDML_0, 4, "System", NULL); +LCDML_add(81, LCDML_0_4, 1, "Volume", UI_func_volume); +LCDML_add(82, LCDML_0_4, 2, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(83, LCDML_0_4, 3, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(84, LCDML_0_4, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(85, LCDML_0, 6, "Info", UI_func_information); +#define _LCDML_DISP_cnt 85 #endif diff --git a/UI_NO_FX.h b/UI_NO_FX.h index 345d8cc..66c660c 100644 --- a/UI_NO_FX.h +++ b/UI_NO_FX.h @@ -55,39 +55,38 @@ LCDML_add(26, LCDML_0_1_4, 1, "MIDI Channel", UI_func_midi_channel); LCDML_add(27, LCDML_0_1_4, 2, "Lowest Note", UI_func_lowest_note); LCDML_add(28, LCDML_0_1_4, 3, "Highest Note", UI_func_highest_note); LCDML_add(29, LCDML_0_1_4, 4, "Send Voice", UI_func_sysex_send_voice); -LCDML_add(30, LCDML_0_1_4, 5, "Receive Voice", UI_func_sysex_receive_voice); -LCDML_add(31, LCDML_0_1, 5, "Setup", NULL); -LCDML_add(32, LCDML_0_1_5, 1, "Portamento", NULL); -LCDML_add(33, LCDML_0_1_5_1, 1, "Port. Mode", UI_func_portamento_mode); -LCDML_add(34, LCDML_0_1_5_1, 2, "Port. Gliss", UI_func_portamento_glissando); -LCDML_add(35, LCDML_0_1_5_1, 3, "Port. Time", UI_func_portamento_time); -LCDML_add(36, LCDML_0_1_5, 2, "Polyphony", UI_func_polyphony); -LCDML_add(37, LCDML_0_1_5, 3, "Transpose", UI_func_transpose); -LCDML_add(38, LCDML_0_1_5, 4, "Fine Tune", UI_func_tune); -LCDML_add(39, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly); -LCDML_add(40, LCDML_0_1, 6, "Internal", NULL); -LCDML_add(41, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh); -LCDML_add(42, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level); -LCDML_add(43, LCDML_0_1_6, 3, "Engine", UI_func_engine); -LCDML_add(44, LCDML_0_1, 7, "Operator", UI_handle_OP); -LCDML_add(45, LCDML_0_1, 8, "Save Voice", UI_func_save_voice); -LCDML_add(46, LCDML_0, 2, "Load/Save", NULL); -LCDML_add(47, LCDML_0_2, 1, "Performance", NULL); -LCDML_add(48, LCDML_0_2_1, 1, "Load Perf.", UI_func_load_performance); -LCDML_add(49, LCDML_0_2_1, 2, "Save Perf.", UI_func_save_performance); -LCDML_add(50, LCDML_0_2, 2, "Voice Config", NULL); -LCDML_add(51, LCDML_0_2_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig); -LCDML_add(52, LCDML_0_2_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig); -LCDML_add(53, LCDML_0_2, 4, "MIDI", NULL); -LCDML_add(54, LCDML_0_2_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); -LCDML_add(55, LCDML_0_2_4, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); -LCDML_add(56, LCDML_0_2_4, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); -LCDML_add(57, LCDML_0, 3, "System", NULL); -LCDML_add(58, LCDML_0_3, 1, "Volume", UI_func_volume); -LCDML_add(59, LCDML_0_3, 2, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(60, LCDML_0_3, 3, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(61, LCDML_0_3, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(62, LCDML_0, 4, "Info", UI_func_information); -#define _LCDML_DISP_cnt 62 +LCDML_add(30, LCDML_0_1, 5, "Setup", NULL); +LCDML_add(31, LCDML_0_1_5, 1, "Portamento", NULL); +LCDML_add(32, LCDML_0_1_5_1, 1, "Port. Mode", UI_func_portamento_mode); +LCDML_add(33, LCDML_0_1_5_1, 2, "Port. Gliss", UI_func_portamento_glissando); +LCDML_add(34, LCDML_0_1_5_1, 3, "Port. Time", UI_func_portamento_time); +LCDML_add(35, LCDML_0_1_5, 2, "Polyphony", UI_func_polyphony); +LCDML_add(36, LCDML_0_1_5, 3, "Transpose", UI_func_transpose); +LCDML_add(37, LCDML_0_1_5, 4, "Fine Tune", UI_func_tune); +LCDML_add(38, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly); +LCDML_add(39, LCDML_0_1, 6, "Internal", NULL); +LCDML_add(40, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh); +LCDML_add(41, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level); +LCDML_add(42, LCDML_0_1_6, 3, "Engine", UI_func_engine); +LCDML_add(43, LCDML_0_1, 7, "Operator", UI_handle_OP); +LCDML_add(44, LCDML_0_1, 8, "Save Voice", UI_func_save_voice); +LCDML_add(45, LCDML_0, 2, "Load/Save", NULL); +LCDML_add(46, LCDML_0_2, 1, "Performance", NULL); +LCDML_add(47, LCDML_0_2_1, 1, "Load Perf.", UI_func_load_performance); +LCDML_add(48, LCDML_0_2_1, 2, "Save Perf.", UI_func_save_performance); +LCDML_add(49, LCDML_0_2, 2, "Voice Config", NULL); +LCDML_add(50, LCDML_0_2_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig); +LCDML_add(51, LCDML_0_2_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig); +LCDML_add(52, LCDML_0_2, 4, "MIDI", NULL); +LCDML_add(53, LCDML_0_2_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); +LCDML_add(54, LCDML_0_2_4, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); +LCDML_add(55, LCDML_0_2_4, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); +LCDML_add(56, LCDML_0, 3, "System", NULL); +LCDML_add(57, LCDML_0_3, 1, "Volume", UI_func_volume); +LCDML_add(58, LCDML_0_3, 2, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(59, LCDML_0_3, 3, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(60, LCDML_0_3, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(61, LCDML_0, 4, "Info", UI_func_information); +#define _LCDML_DISP_cnt 61 #endif diff --git a/config.h b/config.h index 0f38142..0dbcbc9 100644 --- a/config.h +++ b/config.h @@ -56,7 +56,7 @@ // sed -i.orig 's/^#define USB_MIDI_SYSEX_MAX 290/#define USB_MIDI_SYSEX_MAX 4104/' /usr/local/arduino-teensy-1.8.12/hardware/teensy/avr/cores/teensy3/usb_midi.h //#define USB_MIDI_SYSEX_MAX 4104 -#define VERSION "0.9.9m" +#define VERSION "0.9.9n" //************************************************************************************************* //* DEVICE SETTINGS @@ -93,7 +93,7 @@ //************************************************************************************************* //* DEBUG OUTPUT SETTINGS //************************************************************************************************* -#define DEBUG 1 +//#define DEBUG 1 #define SERIAL_SPEED 230400 #define SHOW_XRUN 1 #define SHOW_CPU_LOAD_MSEC 5000 @@ -116,7 +116,7 @@ #define REVERB_ANTIALIAS_FRQ 7500 // SGTL5000 #define SGTL5000_AUDIO_ENHANCE 1 - +#define SGTL5000_AUDIO_THRU 1 //************************************************************************************************* //* AUDIO SOFTWARE SETTINGS //************************************************************************************************* diff --git a/dexed_sd.cpp b/dexed_sd.cpp index d9f1054..b36daee 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -71,7 +71,7 @@ bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id) Serial.print(voice_name); Serial.println(F("]")); #endif - bool ret = MicroDexed[instance_id]->decodeVoice(data,MicroDexed[instance_id]->data); + bool ret = MicroDexed[instance_id]->decodeVoice(data, MicroDexed[instance_id]->data); #ifdef DEBUG show_patch(instance_id); #endif @@ -821,7 +821,7 @@ uint8_t calc_checksum(uint8_t* data, uint16_t len) return (bulk_checksum_calc & 0x7f); } -void strip_extension(char* s, char* target) +void strip_extension(char* s, char* target, uint8_t len) { char tmp[FILENAME_LEN]; char* token; @@ -832,6 +832,8 @@ void strip_extension(char* s, char* target) strcpy(target, "*ERROR*"); else strcpy(target, token); + + target[len] = '\0'; } bool get_bank_name(uint8_t b, char* name, uint8_t len) @@ -860,7 +862,8 @@ bool get_bank_name(uint8_t b, char* name, uint8_t len) if (entry.isDirectory()) return (false); - strip_extension(entry.name(), name); + strip_extension(entry.name(), name, len); + #ifdef DEBUG Serial.print(F("Found bank-name [")); Serial.print(name);