diff --git a/MicroDexed.ino b/MicroDexed.ino index 1d50b82..1b45e52 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -756,8 +756,8 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) #ifdef DEBUG Serial.println(F("VOLUME CC")); #endif - //configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 0x7f, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); - MicroDexed[instance_id]->fx.Gain = pseudo_log_curve(mapfloat(map(inValue, 0, 0x7f, 0, configuration.dexed[instance_id].sound_intensity), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); + configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 0x7f, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); + MicroDexed[instance_id]->fx.Gain = pseudo_log_curve(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sound_intensity)) { LCDML.OTHER_updateFunc(); diff --git a/UI.hpp b/UI.hpp index bd4a215..cdc5adc 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1868,9 +1868,16 @@ void UI_func_sound_intensity(uint8_t param) encoderDir[ENC_R].reset(); if (LCDML.BT_checkDown()) + { configuration.dexed[selected_instance_id].sound_intensity = constrain(configuration.dexed[selected_instance_id].sound_intensity + ENCODER[ENC_R].speed(), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 7, configuration.dexed[selected_instance_id].sound_intensity); + } else if (LCDML.BT_checkUp()) + { configuration.dexed[selected_instance_id].sound_intensity = constrain(configuration.dexed[selected_instance_id].sound_intensity - ENCODER[ENC_R].speed(), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 7, configuration.dexed[selected_instance_id].sound_intensity); + } + #if NUM_DEXED > 1 else if (LCDML.BT_checkEnter()) { @@ -1885,7 +1892,6 @@ void UI_func_sound_intensity(uint8_t param) } lcd_display_bar_int("Voice Level", configuration.dexed[selected_instance_id].sound_intensity, 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false); - MicroDexed[selected_instance_id]->fx.Gain = pseudo_log_curve(mapfloat(configuration.dexed[selected_instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); } diff --git a/config.h b/config.h index 91fdc38..33351d9 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/hardware/teensy/avr/cores/teensy3/usb_midi.h //#define USB_MIDI_SYSEX_MAX 4104 -#define VERSION "1.0.8" +#define VERSION "1.0.9" //************************************************************************************************* //* DEVICE SETTINGS @@ -92,7 +92,7 @@ //************************************************************************************************* //* DEBUG OUTPUT SETTINGS //************************************************************************************************* -//#define DEBUG 1 +#define DEBUG 1 #define SERIAL_SPEED 230400 #define SHOW_XRUN 1 #define SHOW_CPU_LOAD_MSEC 5000 diff --git a/midi_devices.hpp b/midi_devices.hpp index c9183fa..189be13 100644 --- a/midi_devices.hpp +++ b/midi_devices.hpp @@ -74,6 +74,7 @@ void handleStop(void); void handleActiveSensing(void); void handleSystemReset(void); //void handleRealTimeSystem(void); +void MD_sendControlChange(byte channel, byte cc, byte value); /***************************************** MIDI_DEVICE_DIN @@ -1570,6 +1571,39 @@ void handleSystemReset_MIDI_DEVICE_USB(void) } */ #endif // MIDI_DEVICE_USB +void MD_sendControlChange(byte channel, byte cc, byte value) +{ +#ifdef DEBUG + Serial.print(F("[MD] SendControlChange CH:")); + Serial.print(channel, DEC); + Serial.print(F(" CC:")); + Serial.print(cc); + Serial.print(F(" VAL:")); + Serial.print(value); +#endif +#ifdef MIDI_DEVICE_DIN + midi_serial.sendControlChange(cc, value, channel); +#ifdef DEBUG + Serial.print(F(" MIDI-DIN")); +#endif +#endif +#ifdef MIDI_DEVICE_USB_HOST + midi_usb.sendControlChange(cc, value, channel); +#ifdef DEBUG + Serial.print(F(" MIDI-USB-HOST")); +#endif +#endif +#ifdef MIDI_DEVICE_USB + usbMIDI.sendControlChange(cc, value, channel); +#ifdef DEBUG + Serial.print(F(" MIDI-USB")); +#endif +#endif +#ifdef DEBUG + Serial.println(); +#endif +} + /***************************************** HELPER FUCNTIONS *****************************************/