diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index 252fca9..968b6cf 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -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 ")); @@ -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); diff --git a/UI.hpp b/UI.hpp index be97142..c854e5f 100644 --- a/UI.hpp +++ b/UI.hpp @@ -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); } //********************************************************************************************+ diff --git a/config.h b/config.h index cfeba86..302940a 100644 --- a/config.h +++ b/config.h @@ -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; }; diff --git a/midi_devices.hpp b/midi_devices.hpp index f5fde51..7eb92a1 100644 --- a/midi_devices.hpp +++ b/midi_devices.hpp @@ -27,8 +27,8 @@ #include "config.h" /* #if defined(MIDI_DEVICE_USB) -#include -#endif */ + #include + #endif */ #ifdef MIDI_DEVICE_USB_HOST #include #endif @@ -41,11 +41,11 @@ USBHost usb_host; MIDIDevice midi_usb(usb_host); #endif /* #ifdef MIDI_DEVICE_USB -static const unsigned sUsbTransportBufferSize = 16; -typedef midi::UsbTransport UsbTransport; -UsbTransport sUsbTransport; -MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, midi_onboard_usb); -#endif */ + static const unsigned sUsbTransportBufferSize = 16; + typedef midi::UsbTransport UsbTransport; + UsbTransport sUsbTransport; + MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, midi_onboard_usb); + #endif */ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity); void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity); @@ -78,18 +78,21 @@ void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity Serial.print(F("[MIDI_DIN] NoteOn")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendNoteOn(inNumber, inVelocity, inChannel); + midi_usb.sendNoteOn(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendNoteOn(inNumber, inVelocity, inChannel); + usbMIDI.sendNoteOn(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -103,18 +106,21 @@ void handleNoteOff_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocit Serial.print(F("[MIDI_DIN] NoteOff")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendNoteOff(inNumber, inVelocity, inChannel); + midi_usb.sendNoteOff(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendNoteOff(inNumber, inVelocity, inChannel); + usbMIDI.sendNoteOff(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -128,18 +134,21 @@ void handleControlChange_MIDI_DEVICE_DIN(byte inChannel, byte inData1, byte inDa Serial.print(F("[MIDI_DIN] CC")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendControlChange(inData1, inData2, inChannel); + midi_usb.sendControlChange(inData1, inData2, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendControlChange(inData1, inData2, inChannel); + usbMIDI.sendControlChange(inData1, inData2, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -153,18 +162,21 @@ void handleAfterTouch_MIDI_DEVICE_DIN(byte inChannel, byte inPressure) Serial.print(F("[MIDI_DIN] AT")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendAfterTouch(inPressure, inChannel); + midi_usb.sendAfterTouch(inPressure, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendAfterTouch(inPressure, inChannel); + usbMIDI.sendAfterTouch(inPressure, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -178,18 +190,21 @@ void handlePitchBend_MIDI_DEVICE_DIN(byte inChannel, int inPitch) Serial.print(F("[MIDI_DIN] PB")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendPitchBend(inPitch, inChannel); + midi_usb.sendPitchBend(inPitch, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendPitchBend(inPitch, inChannel); + usbMIDI.sendPitchBend(inPitch, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -203,18 +218,21 @@ void handleProgramChange_MIDI_DEVICE_DIN(byte inChannel, byte inProgram) Serial.print(F("[MIDI_DIN] PC")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendProgramChange(inProgram, inChannel); + midi_usb.sendProgramChange(inProgram, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendProgramChange(inProgram, inChannel); + usbMIDI.sendProgramChange(inProgram, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -228,18 +246,21 @@ void handleSystemExclusive_MIDI_DEVICE_DIN(byte *data, uint len) Serial.print(F("[MIDI_DIN] SysEx")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendSysEx(len, data); + midi_usb.sendSysEx(len, data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendSysEx(len, data); + usbMIDI.sendSysEx(len, data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -247,29 +268,32 @@ void handleSystemExclusive_MIDI_DEVICE_DIN(byte *data, uint len) } /* void handleSystemExclusiveChunk_MIDI_DEVICE_DIN(byte *data, uint len, bool last) -{ + { handleSystemExclusiveChunk(data, len, last); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F("[MIDI_DIN] SysExChunk")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_USB_HOST + #endif + #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { + #ifdef MIDI_DEVICE_USB_HOST midi_usb.sendSysEx(len, data, last); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_USB_HOST")); -#endif -#endif -#ifdef MIDI_DEVICE_USB + #endif + #endif + #ifdef MIDI_DEVICE_USB usbMIDI.sendSysEx(len, data, last); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_USB")); -#endif -#endif -#ifdef DEBUG + #endif + #endif + } + #ifdef DEBUG Serial.println(); -#endif -#endif -} */ + #endif + #endif + } */ void handleTimeCodeQuarterFrame_MIDI_DEVICE_DIN(byte data) { @@ -278,18 +302,21 @@ void handleTimeCodeQuarterFrame_MIDI_DEVICE_DIN(byte data) Serial.print(F("[MIDI_DIN] TimeCodeQuarterFrame")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendTimeCodeQuarterFrame(0xF1, data); + midi_usb.sendTimeCodeQuarterFrame(0xF1, data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendTimeCodeQuarterFrame(0xF1,data); + usbMIDI.sendTimeCodeQuarterFrame(0xF1, data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -304,17 +331,20 @@ void handleAfterTouchPoly_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte in #endif #ifdef MIDI_MERGE_THRU #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendAfterTouch(inNumber, inVelocity, inChannel); + if (configuration.midi_soft_thru == true) + { + midi_usb.sendAfterTouch(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendAfterTouch(inNumber, inVelocity, inChannel); + usbMIDI.sendAfterTouch(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -328,18 +358,21 @@ void handleSongSelect_MIDI_DEVICE_DIN(byte inSong) Serial.print(F("[MIDI_DIN] SongSelect")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendSongSelect(inSong); + midi_usb.sendSongSelect(inSong); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendSongSelect(inSong); + usbMIDI.sendSongSelect(inSong); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -353,18 +386,21 @@ void handleTuneRequest_MIDI_DEVICE_DIN(void) Serial.print(F("[MIDI_DIN] TuneRequest")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendTuneRequest(); + midi_usb.sendTuneRequest(); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendTuneRequest(); + usbMIDI.sendTuneRequest(); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -378,18 +414,21 @@ void handleClock_MIDI_DEVICE_DIN(void) Serial.print(F("[MIDI_DIN] Clock")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::Clock); + midi_usb.sendRealTime(midi::Clock); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::Clock); + usbMIDI.sendRealTime(midi::Clock); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -403,18 +442,21 @@ void handleStart_MIDI_DEVICE_DIN(void) Serial.print(F("[MIDI_DIN] Start")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::Start); + midi_usb.sendRealTime(midi::Start); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::Start); + usbMIDI.sendRealTime(midi::Start); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -428,18 +470,21 @@ void handleContinue_MIDI_DEVICE_DIN(void) Serial.print(F("[MIDI_DIN] Continue")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::Continue); + midi_usb.sendRealTime(midi::Continue); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::Continue); + usbMIDI.sendRealTime(midi::Continue); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -453,18 +498,21 @@ void handleStop_MIDI_DEVICE_DIN(void) Serial.print(F("[MIDI_DIN] Stop")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::Stop); + midi_usb.sendRealTime(midi::Stop); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::Stop); + usbMIDI.sendRealTime(midi::Stop); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -478,18 +526,21 @@ void handleActiveSensing_MIDI_DEVICE_DIN(void) Serial.print(F("[MIDI_DIN] ActiveSensing")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::ActiveSensing); + midi_usb.sendRealTime(midi::ActiveSensing); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::ActiveSensing); + usbMIDI.sendRealTime(midi::ActiveSensing); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -503,18 +554,21 @@ void handleSystemReset_MIDI_DEVICE_DIN(void) Serial.print(F("[MIDI_DIN] SystemReset")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::SystemReset); + midi_usb.sendRealTime(midi::SystemReset); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::SystemReset); + usbMIDI.sendRealTime(midi::SystemReset); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -522,29 +576,32 @@ void handleSystemReset_MIDI_DEVICE_DIN(void) } /* void handlRealTimeSysteme_MIDI_DEVICE_DIN(byte inRealTime) -{ + { handleRealTimeSystem(); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F("[MIDI_DIN] RealTimeSystem")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_USB_HOST + #endif + #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { + #ifdef MIDI_DEVICE_USB_HOST midi_usb.sendRealTime(inRealTime); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_USB_HOST")); -#endif -#endif -#ifdef MIDI_DEVICE_USB + #endif + #endif + #ifdef MIDI_DEVICE_USB //usbMIDI.sendRealTime(inRealTIme); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_USB[NOTSUPPORTED]")); -#endif -#endif -#ifdef DEBUG + #endif + #endif + } + #ifdef DEBUG Serial.println(); -#endif -#endif -} */ + #endif + #endif + } */ #endif // MIDI_DEVICE_DIN /***************************************** @@ -558,18 +615,21 @@ void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVel Serial.print(F("[MIDI_USB_HOST] NoteOn")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendNoteOn(inNumber, inVelocity, inChannel); + midi_serial.sendNoteOn(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendNoteOn(inNumber, inVelocity, inChannel); + usbMIDI.sendNoteOn(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -583,18 +643,21 @@ void handleNoteOff_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVe Serial.print(F("[MIDI_USB_HOST] NoteOff")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendNoteOff(inNumber, inVelocity, inChannel); + midi_serial.sendNoteOff(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendNoteOff(inNumber, inVelocity, inChannel); + usbMIDI.sendNoteOff(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -608,18 +671,21 @@ void handleControlChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inData1, byte Serial.print(F("[MIDI_USB_HOST] CC")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendControlChange(inData1, inData2, inChannel); + midi_serial.sendControlChange(inData1, inData2, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendControlChange(inData1, inData2, inChannel); + usbMIDI.sendControlChange(inData1, inData2, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -633,18 +699,21 @@ void handleAfterTouch_MIDI_DEVICE_USB_HOST(byte inChannel, byte inPressure) Serial.print(F("[MIDI_USB_HOST] AT")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendAfterTouch(inPressure, inChannel); + midi_serial.sendAfterTouch(inPressure, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendAfterTouch(inPressure, inChannel); + usbMIDI.sendAfterTouch(inPressure, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -658,18 +727,21 @@ void handlePitchBend_MIDI_DEVICE_USB_HOST(byte inChannel, int inPitch) Serial.print(F("[MIDI_USB_HOST] PB")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendPitchBend(inPitch, inChannel); + midi_serial.sendPitchBend(inPitch, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendPitchBend(inPitch, inChannel); + usbMIDI.sendPitchBend(inPitch, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -683,18 +755,21 @@ void handleProgramChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inProgram) Serial.print(F("[MIDI_USB_HOST] PC")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendProgramChange(inProgram, inChannel); + midi_serial.sendProgramChange(inProgram, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendProgramChange(inProgram, inChannel); + usbMIDI.sendProgramChange(inProgram, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -708,18 +783,21 @@ void handleSystemExclusive_MIDI_DEVICE_USB_HOST(byte *data, uint len) Serial.print(F("[MIDI_USB_HOST] SysEx")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendSysEx(len, data); + midi_serial.sendSysEx(len, data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendSysEx(len, data); + usbMIDI.sendSysEx(len, data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -727,29 +805,32 @@ void handleSystemExclusive_MIDI_DEVICE_USB_HOST(byte *data, uint len) } /* void handleSystemExclusiveChunk_MIDI_DEVICE_USB_HOST(byte *data, uint len, bool last) -{ + { handleSystemExclusiveChunk(data, len, last); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F("[MIDI_USB_HOST] SysExChunk")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_DIN + #endif + #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { + #ifdef MIDI_DEVICE_DIN midi_serial.sendSysEx(len, data, last); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_DIN")); -#endif -#endif -#ifdef MIDI_DEVICE_USB + #endif + #endif + #ifdef MIDI_DEVICE_USB usbMIDI.sendSysEx(len, data, last); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_USB")); -#endif -#endif -#ifdef DEBUG + #endif + #endif + } + #ifdef DEBUG Serial.println(); -#endif -#endif -} */ + #endif + #endif + } */ void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB_HOST(midi::DataByte data) { @@ -758,18 +839,21 @@ void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB_HOST(midi::DataByte data) Serial.print(F("[MIDI_USB_HOST] TimeCodeQuarterFrame")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendTimeCodeQuarterFrame(data); + midi_serial.sendTimeCodeQuarterFrame(data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendTimeCodeQuarterFrame(0xF1,data); + usbMIDI.sendTimeCodeQuarterFrame(0xF1, data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -783,18 +867,21 @@ void handleAfterTouchPoly_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, by Serial.print(F("[MIDI_USB_HOST] AT-Poly")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendAfterTouch(inNumber, inVelocity, inChannel); + midi_serial.sendAfterTouch(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->DIN")); + Serial.print(F(" THRU->DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendAfterTouch(inNumber, inVelocity, inChannel); + usbMIDI.sendAfterTouch(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -808,18 +895,21 @@ void handleSongSelect_MIDI_DEVICE_USB_HOST(byte inSong) Serial.print(F("[MIDI_USB_HOST] SongSelect")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendSongSelect(inSong); + midi_serial.sendSongSelect(inSong); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendSongSelect(inSong); + usbMIDI.sendSongSelect(inSong); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -833,18 +923,21 @@ void handleTuneRequest_MIDI_DEVICE_USB_HOST(void) Serial.print(F("[MIDI_USB_HOST] TuneRequest")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendTuneRequest(); + midi_serial.sendTuneRequest(); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendTuneRequest(); + usbMIDI.sendTuneRequest(); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -858,18 +951,21 @@ void handleClock_MIDI_DEVICE_USB_HOST(void) Serial.print(F("[MIDI_USB_HOST] Clock")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::Clock); + midi_serial.sendRealTime(midi::Clock); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::Clock); + usbMIDI.sendRealTime(midi::Clock); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -883,18 +979,21 @@ void handleStart_MIDI_DEVICE_USB_HOST(void) Serial.print(F("[MIDI_USB_HOST] Start")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::Start); + midi_serial.sendRealTime(midi::Start); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::Start); + usbMIDI.sendRealTime(midi::Start); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -908,18 +1007,21 @@ void handleContinue_MIDI_DEVICE_USB_HOST(void) Serial.print(F("[MIDI_USB_HOST] Continue")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::Continue); + midi_serial.sendRealTime(midi::Continue); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::Continue); + usbMIDI.sendRealTime(midi::Continue); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -933,18 +1035,21 @@ void handleStop_MIDI_DEVICE_USB_HOST(void) Serial.print(F("[MIDI_USB_HOST] Stop")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::Stop); + midi_serial.sendRealTime(midi::Stop); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::Stop); + usbMIDI.sendRealTime(midi::Stop); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -958,18 +1063,21 @@ void handleActiveSensing_MIDI_DEVICE_USB_HOST(void) Serial.print(F("[MIDI_USB_HOST] ActiveSensing")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::ActiveSensing); + midi_serial.sendRealTime(midi::ActiveSensing); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::ActiveSensing); + usbMIDI.sendRealTime(midi::ActiveSensing); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -983,18 +1091,21 @@ void handleSystemReset_MIDI_DEVICE_USB_HOST(void) Serial.print(F("[MIDI_USB_HOST] SystemReset")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::SystemReset); + midi_serial.sendRealTime(midi::SystemReset); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB - usbMIDI.sendRealTime(midi::SystemReset); + usbMIDI.sendRealTime(midi::SystemReset); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); + Serial.print(F(" THRU->MIDI_USB")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1002,29 +1113,32 @@ void handleSystemReset_MIDI_DEVICE_USB_HOST(void) } /* void handlRealTimeSysteme_MIDI_DEVICE_USB_HOST(midi::MidiType inRealTime) -{ + { handleRealTimeSystem(); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F("[MIDI_USB_HOST] RealTimeSystem")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_DIN + #endif + #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { + #ifdef MIDI_DEVICE_DIN midi_serial.sendRealTime(inRealTime); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_DIN")); -#endif -#endif -#ifdef MIDI_DEVICE_USB + #endif + #endif + #ifdef MIDI_DEVICE_USB usbMIDI.sendRealTime(inRealTime); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_USB")); -#endif -#endif -#ifdef DEBUG + #endif + #endif + } + #ifdef DEBUG Serial.println(); -#endif -#endif -} */ + #endif + #endif + } */ #endif // MIDI_DEVICE_USB_HOST /***************************************** @@ -1038,18 +1152,21 @@ void handleNoteOn_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocity Serial.print(F("[MIDI_USB] NoteOn")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendNoteOn(inNumber, inVelocity, inChannel); + midi_serial.sendNoteOn(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendNoteOn(inNumber, inVelocity, inChannel); + midi_usb.sendNoteOn(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1063,18 +1180,21 @@ void handleNoteOff_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocit Serial.print(F("[MIDI_USB] NoteOff")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendNoteOff(inNumber, inVelocity, inChannel); + midi_serial.sendNoteOff(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendNoteOff(inNumber, inVelocity, inChannel); + midi_usb.sendNoteOff(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1088,18 +1208,21 @@ void handleControlChange_MIDI_DEVICE_USB(byte inChannel, byte inData1, byte inDa Serial.print(F("[MIDI_USB] CC")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendControlChange(inData1, inData2, inChannel); + midi_serial.sendControlChange(inData1, inData2, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendControlChange(inData1, inData2, inChannel); + midi_usb.sendControlChange(inData1, inData2, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1113,18 +1236,21 @@ void handleAfterTouch_MIDI_DEVICE_USB(byte inChannel, byte inPressure) Serial.print(F("[MIDI_USB] AT")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendAfterTouch(inPressure, inChannel); + midi_serial.sendAfterTouch(inPressure, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendAfterTouch(inPressure, inChannel); + midi_usb.sendAfterTouch(inPressure, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1138,18 +1264,21 @@ void handlePitchBend_MIDI_DEVICE_USB(byte inChannel, int inPitch) Serial.print(F("[MIDI_USB] PB")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendPitchBend(inPitch, inChannel); + midi_serial.sendPitchBend(inPitch, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendPitchBend(inPitch, inChannel); + midi_usb.sendPitchBend(inPitch, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1163,18 +1292,21 @@ void handleProgramChange_MIDI_DEVICE_USB(byte inChannel, byte inProgram) Serial.print(F("[MIDI_USB] PC")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendProgramChange(inProgram, inChannel); + midi_serial.sendProgramChange(inProgram, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendProgramChange(inProgram, inChannel); + midi_usb.sendProgramChange(inProgram, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1188,18 +1320,21 @@ void handleSystemExclusive_MIDI_DEVICE_USB(byte *data, uint len) Serial.print(F("[MIDI_USB] SysEx")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendSysEx(len, data); + midi_serial.sendSysEx(len, data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendSysEx(len, data); + midi_usb.sendSysEx(len, data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1207,29 +1342,32 @@ void handleSystemExclusive_MIDI_DEVICE_USB(byte *data, uint len) } /* void handleSystemExclusiveChunk_MIDI_DEVICE_USB(byte *data, uint len, bool last) -{ + { handleSystemExclusiveChunk(data, len, last); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F("[MIDI_USB] SysExChunk")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_DIN + #endif + #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { + #ifdef MIDI_DEVICE_DIN midi_serial.sendSysEx(len, data, last); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_DIN")); -#endif -#endif -#ifdef MIDI_DEVICE_USB_HOST + #endif + #endif + #ifdef MIDI_DEVICE_USB_HOST midi_usb.sendSysEx(len, data, last); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_USB_HOST")); -#endif -#endif -#ifdef DEBUG + #endif + #endif + } + #ifdef DEBUG Serial.println(); -#endif -#endif -} */ + #endif + #endif + } */ void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB(midi::DataByte data) { @@ -1238,18 +1376,21 @@ void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB(midi::DataByte data) Serial.print(F("[MIDI_USB] TimeCodeQuarterFrame")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendTimeCodeQuarterFrame(data); + midi_serial.sendTimeCodeQuarterFrame(data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendTimeCodeQuarterFrame(0xF1, data); + midi_usb.sendTimeCodeQuarterFrame(0xF1, data); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1263,18 +1404,21 @@ void handleAfterTouchPoly_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte in Serial.print(F("[MIDI_USB] AT-Poly")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendAfterTouch(inNumber, inVelocity, inChannel); + midi_serial.sendAfterTouch(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->DIN")); + Serial.print(F(" THRU->DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendAfterTouch(inNumber, inVelocity, inChannel); + midi_usb.sendAfterTouch(inNumber, inVelocity, inChannel); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1288,18 +1432,21 @@ void handleSongSelect_MIDI_DEVICE_USB(byte inSong) Serial.print(F("[MIDI_USB] SongSelect")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendSongSelect(inSong); + midi_serial.sendSongSelect(inSong); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendSongSelect(inSong); + midi_usb.sendSongSelect(inSong); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1313,18 +1460,21 @@ void handleTuneRequest_MIDI_DEVICE_USB(void) Serial.print(F("[MIDI_USB] TuneRequest")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendTuneRequest(); + midi_serial.sendTuneRequest(); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendTuneRequest(); + midi_usb.sendTuneRequest(); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1338,18 +1488,21 @@ void handleClock_MIDI_DEVICE_USB(void) Serial.print(F("[MIDI_USB] Clock")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::Clock); + midi_serial.sendRealTime(midi::Clock); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::Clock); + midi_usb.sendRealTime(midi::Clock); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1363,18 +1516,21 @@ void handleStart_MIDI_DEVICE_USB(void) Serial.print(F("[MIDI_USB] Start")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::Start); + midi_serial.sendRealTime(midi::Start); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::Start); + midi_usb.sendRealTime(midi::Start); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1388,18 +1544,21 @@ void handleContinue_MIDI_DEVICE_USB(void) Serial.print(F("[MIDI_USB] Continue")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::Continue); + midi_serial.sendRealTime(midi::Continue); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::Continue); + midi_usb.sendRealTime(midi::Continue); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1413,18 +1572,21 @@ void handleStop_MIDI_DEVICE_USB(void) Serial.print(F("[MIDI_USB] Stop")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::Stop); + midi_serial.sendRealTime(midi::Stop); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::Stop); + midi_usb.sendRealTime(midi::Stop); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1438,18 +1600,21 @@ void handleActiveSensing_MIDI_DEVICE_USB(void) Serial.print(F("[MIDI_USB] ActiveSensing")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::ActiveSensing); + midi_serial.sendRealTime(midi::ActiveSensing); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::ActiveSensing); + midi_usb.sendRealTime(midi::ActiveSensing); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1463,18 +1628,21 @@ void handleSystemReset_MIDI_DEVICE_USB(void) Serial.print(F("[MIDI_USB] SystemReset")); #endif #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { #ifdef MIDI_DEVICE_DIN - midi_serial.sendRealTime(midi::SystemReset); + midi_serial.sendRealTime(midi::SystemReset); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); + Serial.print(F(" THRU->MIDI_DIN")); #endif #endif #ifdef MIDI_DEVICE_USB_HOST - midi_usb.sendRealTime(midi::SystemReset); + midi_usb.sendRealTime(midi::SystemReset); #ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); + Serial.print(F(" THRU->MIDI_USB_HOST")); #endif #endif + } #ifdef DEBUG Serial.println(); #endif @@ -1482,29 +1650,32 @@ void handleSystemReset_MIDI_DEVICE_USB(void) } /* void handleRealTimeSystem_MIDI_DEVICE_USB(byte inRealTime) -{ + { handleRealTimeSystem(); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F("[MIDI_USB] RealTimeSystem")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_DIN + #endif + #ifdef MIDI_MERGE_THRU + if (configuration.midi_soft_thru == true) + { + #ifdef MIDI_DEVICE_DIN midi_serial.sendRealTime((midi::MidiType)inRealTime); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_DIN")); -#endif -#endif -#ifdef MIDI_DEVICE_USB_HOST + #endif + #endif + #ifdef MIDI_DEVICE_USB_HOST midi_usb.sendRealTime(inRealTime); -#ifdef DEBUG + #ifdef DEBUG Serial.print(F(" THRU->MIDI_USB_HOST")); -#endif -#endif -#ifdef DEBUG + #endif + #endif + } + #ifdef DEBUG Serial.println(); -#endif -#endif -} */ + #endif + #endif + } */ #endif // MIDI_DEVICE_USB /*****************************************