diff --git a/MicroDexed.ino b/MicroDexed.ino index aa5890b..f3762d9 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -64,7 +64,7 @@ AudioConnection patchCord8(modchorus_filter, 0, master_mixer_l, 3); AudioConnection patchCord9(modchorus, 0, master_mixer_r, 3); AudioConnection patchCord10(modchorus, 0, master_mixer_l, 3); #endif -#ifdef USE_REVERB +#if defined(USE_REVERB) AudioEffectFreeverbStereo freeverbs1; AudioConnection patchCord11(queue1, 0, freeverbs1, 0); AudioConnection patchCord12(queue1, 0, freeverbs1, 1); @@ -125,15 +125,9 @@ uint8_t midi_timing_counter = 0; // 24 per qarter elapsedMillis midi_timing_timestep; uint16_t midi_timing_quarter = 0; elapsedMillis long_button_pressed; -SoftenValue soften_volume; -SoftenValue soften_filter_res[NUM_DEXED]; -SoftenValue soften_filter_cut[NUM_DEXED]; -uint8_t effect_filter_cutoff = 0; -uint8_t effect_filter_resonance = 0; -uint8_t effect_delay_time = 0; -uint8_t effect_delay_feedback = 0; -uint8_t effect_delay_volume = 0; -bool effect_delay_sync = 0; +SoftenValue soften_volume; +SoftenValue soften_filter_res[NUM_DEXED]; +SoftenValue soften_filter_cut[NUM_DEXED]; elapsedMicros fill_audio_buffer; elapsedMillis control_rate; uint8_t active_voices = 0; @@ -142,11 +136,11 @@ elapsedMillis cpu_mem_millis; #endif config_t configuration = { 0xffff, - DEFAULT_SYSEXBANK, - DEFAULT_SYSEXSOUND, - VOLUME, - 0.5f, // pan - 0, // mono + SYSEXBANK_DEFAULT, + SYSEXSOUND_DEFAULT, + VOLUME_DEFAULT, + PANORAMA_DEFAULT, // pan + MONO_DEFAULT, // mono DEFAULT_MIDI_CHANNEL, REVERB_ROOMSIZE_DEFAULT, REVERB_DAMPING_DEFAULT, @@ -154,7 +148,10 @@ config_t configuration = { CHORUS_FREQUENCY_DEFAULT, CHORUS_WAVEFORM_DEFAULT, CHORUS_DEPTH_DEFAULT, - CHORUS_LEVEL_DEFAULT + CHORUS_LEVEL_DEFAULT, + FILTER_CUTOFF_DEFAULT, + FILTER_RESONANCE_DEFAULT, + LOUDNESS_DEFAULT }; bool eeprom_update_flag = false; @@ -370,7 +367,7 @@ void setup() // set initial volume and pan (read from EEPROM) set_volume(configuration.vol, configuration.pan); - soften_volume.init(configuration.vol, 0.0, 1.0); + soften_volume.init(configuration.vol, VOLUME_MIN, VOLUME_MAX); #if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) // Initialize processor and memory measurements @@ -430,10 +427,6 @@ void loop() if (peak1.read() > 0.99) peak++; } -#ifndef TEENSY_AUDIO_BOARD - for (uint8_t i = 0; i < AUDIO_BLOCK_SAMPLES; i++) - audio_buffer[i] *= configuration.vol; -#endif queue1.playBuffer(); } @@ -506,7 +499,7 @@ void loop() set_volume(soften_volume.value(), configuration.pan); #ifdef DEBUG Serial.print(F("Volume: ")); - Serial.print(configuration.vol, 5); + Serial.print(configuration.vol, DEC); Serial.print(F(" step: ")); Serial.print(soften_volume.steps()); Serial.print(F(" diff: ")); @@ -563,73 +556,107 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) } break; case 1: - MicroDexed[0]->controllers.modwheel_cc = inValue; - MicroDexed[0]->controllers.refresh(); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->controllers.modwheel_cc = inValue; + MicroDexed[i]->controllers.refresh(); + } break; case 2: - MicroDexed[0]->controllers.breath_cc = inValue; - MicroDexed[0]->controllers.refresh(); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->controllers.breath_cc = inValue; + MicroDexed[i]->controllers.refresh(); + } break; case 4: - MicroDexed[0]->controllers.foot_cc = inValue; - MicroDexed[0]->controllers.refresh(); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->controllers.foot_cc = inValue; + MicroDexed[i]->controllers.refresh(); + } break; case 7: // Volume - configuration.vol = float(inValue) / 0x7f; - set_volume(configuration.vol, configuration.pan); + configuration.vol = map(inValue, 0, 0x7f, VOLUME_MIN, VOLUME_MAX); + soften_volume.update(configuration.vol, SOFTEN_VALUE_CHANGE_STEPS); break; case 10: // Pan - configuration.pan = float(inValue) / 128; + configuration.pan = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX); set_volume(configuration.vol, configuration.pan); break; case 32: // BankSelect LSB configuration.bank = inValue; break; case 64: - MicroDexed[0]->setSustain(inValue > 63); - if (!MicroDexed[0]->getSustain()) { - for (uint8_t note = 0; note < MicroDexed[0]->getMaxNotes(); note++) { - if (MicroDexed[0]->voices[note].sustained && !MicroDexed[0]->voices[note].keydown) { - MicroDexed[0]->voices[note].dx7_note->keyup(); - MicroDexed[0]->voices[note].sustained = false; + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->setSustain(inValue > 63); + if (!MicroDexed[i]->getSustain()) { + for (uint8_t note = 0; note < MicroDexed[0]->getMaxNotes(); note++) { + if (MicroDexed[i]->voices[note].sustained && !MicroDexed[i]->voices[note].keydown) { + MicroDexed[i]->voices[note].dx7_note->keyup(); + MicroDexed[i]->voices[note].sustained = false; + } } } } break; case 103: // CC 103: filter resonance - effect_filter_resonance = map(inValue, 0, 127, 0, ENC_FILTER_RES_STEPS); - MicroDexed[0]->fx.Reso = 1.0 - float(effect_filter_resonance) / ENC_FILTER_RES_STEPS; + configuration.filter_resonance = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->fx.Reso = configuration.filter_resonance / 100.0; + } break; case 104: // CC 104: filter cutoff - effect_filter_cutoff = map(inValue, 0, 127, 0, ENC_FILTER_CUT_STEPS); - MicroDexed[0]->fx.Cutoff = 1.0 - float(effect_filter_cutoff) / ENC_FILTER_CUT_STEPS; + configuration.filter_cutoff = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->fx.Cutoff = configuration.filter_cutoff / 100.0; + } break; case 105: // CC 105: delay time - effect_delay_time = map(inValue, 0, 127, 0, ENC_DELAY_TIME_STEPS); - ////delay.delay(0, mapfloat(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); - break; + configuration.delay_time = map(inValue, 0, 0x7f, DELAY_TIME_MIN, DELAY_TIME_MAX); + delay1.delay(0, configuration.delay_time * 10); case 106: // CC 106: delay feedback - effect_delay_feedback = map(inValue, 0, 127, 0, ENC_DELAY_FB_STEPS); - ////delay_mixer_r.gain(1, mapfloat(float(effect_delay_feedback), 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); + configuration.delay_feedback = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX); + delay_fb_mixer.gain(1, configuration.delay_feedback / 100.0 ); // amount of feedback + delay_fb_mixer.gain(0, 1.0 - configuration.delay_feedback / 100.0); // original signalbreak; break; case 107: // CC 107: delay volume - effect_delay_volume = map(inValue, 0, 127, 0, ENC_DELAY_VOLUME_STEPS); - ////delay_mixer_l.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delay tap1 signal (with added feedback) + configuration.delay_level = map(inValue, 0, 0x7f, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); + master_mixer_r.gain(2, configuration.delay_level / 100.0); + master_mixer_l.gain(2, configuration.delay_level / 100.0); break; case 120: - MicroDexed[0]->panic(); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->panic(); + } break; case 121: - MicroDexed[0]->resetControllers(); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->resetControllers(); + } break; case 123: - MicroDexed[0]->notesOff(); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->notesOff(); + } break; case 126: - MicroDexed[0]->setMonoMode(true); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->setMonoMode(true); + } break; case 127: - MicroDexed[0]->setMonoMode(false); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->setMonoMode(false); + } break; } } @@ -637,13 +664,19 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) void handleAfterTouch(byte inChannel, byte inPressure) { - MicroDexed[0]->controllers.aftertouch_cc = inPressure; - MicroDexed[0]->controllers.refresh(); + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->controllers.aftertouch_cc = inPressure; + MicroDexed[i]->controllers.refresh(); + } } void handlePitchBend(byte inChannel, int inPitch) { - MicroDexed[0]->controllers.values_[kControllerPitch] = inPitch + 0x2000; // -8192 to +8191 --> 0 to 16383 + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->controllers.values_[kControllerPitch] = inPitch + 0x2000; // -8192 to +8191 --> 0 to 16383 + } } void handleProgramChange(byte inChannel, byte inProgram) @@ -934,19 +967,23 @@ bool checkMidiChannel(byte inChannel) VOLUME HELPER ******************************************************************************/ -void set_volume(float v, float p) +void set_volume(uint8_t v, int8_t p) { configuration.vol = v; configuration.pan = p; - MicroDexed[0]->fx.Gain = v; - - uint16_t tmp = v * 1023.0 + 0.5; - float tmp2 = configuration.pan; + uint16_t tmp = v / 100.0 * 1023.0 + 0.5; + float tmp2 = mapfloat(configuration.pan, PANORAMA_MIN, PANORAMA_MAX, 0.0, 1.0); float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20); -#ifdef SHOW_DEBUG + + // float v = (float)(a * (a + 2))/(float)(1 << 20); // (pseudo-) logarithmic curve for volume control + // http://files.csound-tutorial.net/floss_manual/Release03/Cs_FM_03_ScrapBook/b-panning-and-spatialization.html + volume_r.gain(tmp3 * sinf(tmp2 * PI / 2)); + volume_l.gain(tmp3 * cosf(tmp2 * PI / 2)); + +#ifdef DEBUG Serial.print(F("Setting volume: VOL=")); - Serial.print(value, DEC); + Serial.print(configuration.vol, DEC); Serial.print(F("[")); Serial.print(tmp3, 3); Serial.print(F("] PAN=")); @@ -959,15 +996,21 @@ void set_volume(float v, float p) Serial.println(tmp3 * cosf(tmp2 * PI / 2), 3); #endif - // float v = (float)(a * (a + 2))/(float)(1 << 20); // (pseudo-) logarithmic curve for volume control - // http://files.csound-tutorial.net/floss_manual/Release03/Cs_FM_03_ScrapBook/b-panning-and-spatialization.html - volume_r.gain(tmp3 * sinf(tmp2 * PI / 2)); - volume_l.gain(tmp3 * cosf(tmp2 * PI / 2)); - if (configuration.mono == 2) + { + volume_r.gain(1.0); volume_l.gain(0.0); + } else if (configuration.mono == 3) + { volume_r.gain(0.0); + volume_l.gain(1.0); + } + else + { + volume_r.gain(1.0); + volume_l.gain(1.0); + } } // https://www.dr-lex.be/info-stuff/volumecontrols.html#table1 @@ -1011,10 +1054,8 @@ void initial_values_from_eeprom(void) Serial.println(); #endif - if (configuration.vol > 1.0) - configuration.vol = 1.0; - else if (configuration.vol < 0.0) - configuration.vol = 0.0; + if (configuration.vol > 100) + configuration.vol = 100; } void eeprom_write(void) diff --git a/UI.hpp b/UI.hpp index 15e2014..2e502c7 100644 --- a/UI.hpp +++ b/UI.hpp @@ -30,6 +30,7 @@ #include "LiquidCrystalPlus_I2C.h" #include "SoftenValue.hpp" #include "effect_modulated_delay.h" +#include "dexed.h" #include #include @@ -50,9 +51,9 @@ extern void strip_extension(char* s, char *target); extern void eeprom_write(void); extern bool get_voice_names_from_bank(uint8_t b); extern bool load_sysex(uint8_t b, uint8_t v); -extern SoftenValue soften_volume; -extern SoftenValue soften_filter_res[NUM_DEXED]; -extern SoftenValue soften_filter_cut[NUM_DEXED]; +extern SoftenValue soften_volume; +extern SoftenValue soften_filter_res[NUM_DEXED]; +extern SoftenValue soften_filter_cut[NUM_DEXED]; extern AudioEffectDelay delay1; #ifdef USE_REVERB extern AudioEffectFreeverbStereo freeverbs1; @@ -64,6 +65,8 @@ extern AudioMixer4 master_mixer_r; extern AudioMixer4 master_mixer_l; extern AudioAmplifier volume_r; extern AudioAmplifier volume_l; +extern Dexed* MicroDexed[NUM_DEXED]; +extern void set_volume(uint8_t v, int8_t p); /*********************************************************************** GLOBAL @@ -450,10 +453,10 @@ void encoder_left_up(void) #ifdef DEBUG Serial.println(F("Volume +")); #endif - if (configuration.vol < 1.0) - soften_volume.update(soften_volume.value() + 0.05, SOFTEN_VALUE_CHANGE_STEPS); + if (configuration.vol < VOLUME_MAX) + soften_volume.update(soften_volume.value() + (VOLUME_MAX - VOLUME_MIN) / VOLUME_ENC_STEPS, SOFTEN_VALUE_CHANGE_STEPS); else - soften_volume.update(1.0, SOFTEN_VALUE_CHANGE_STEPS); + soften_volume.update(VOLUME_MAX, SOFTEN_VALUE_CHANGE_STEPS); eeprom_write(); UI_func_volume(0); } @@ -463,10 +466,10 @@ void encoder_left_down(void) #ifdef DEBUG Serial.println(F("Volume -")); #endif - if (configuration.vol > 0.0) - soften_volume.update(soften_volume.value() - 0.05, SOFTEN_VALUE_CHANGE_STEPS); + if (configuration.vol > VOLUME_MIN) + soften_volume.update(soften_volume.value() - (VOLUME_MAX - VOLUME_MIN) / VOLUME_ENC_STEPS, SOFTEN_VALUE_CHANGE_STEPS); else - soften_volume.update(0.0, SOFTEN_VALUE_CHANGE_STEPS); + soften_volume.update(VOLUME_MIN, SOFTEN_VALUE_CHANGE_STEPS); eeprom_write(); UI_func_volume(0); } @@ -800,7 +803,7 @@ void UI_func_chorus_frequency(uint8_t param) lcd.setCursor(0, 1); lcd_display_float(configuration.chorus_frequency / 10.0, 2, 1, false, true, false); lcd.print(" Hz"); - + modulator.frequency(configuration.chorus_frequency / 10.0); } @@ -1074,27 +1077,223 @@ void UI_func_delay_level(uint8_t param) void UI_func_filter_cutoff(uint8_t param) { - ; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("Filter Cut-Off")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.filter_cutoff < FILTER_CUTOFF_MAX) + { + configuration.filter_cutoff++; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.filter_cutoff > FILTER_CUTOFF_MIN) + { + configuration.filter_cutoff--; + } + } + lcd.setCursor(0, 1); + lcd_display_int(configuration.filter_cutoff, 3, true, true, false); + + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->fx.Cutoff = configuration.filter_cutoff / 100.0; + } + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + } } void UI_func_filter_resonance(uint8_t param) { - ; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("Filter Resonance")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.filter_resonance < FILTER_RESONANCE_MAX) + { + configuration.filter_resonance++; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.filter_resonance > FILTER_RESONANCE_MIN) + { + configuration.filter_resonance--; + } + } + lcd.setCursor(0, 1); + lcd_display_int(configuration.filter_resonance, 3, true, true, false); + + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->fx.Reso = configuration.filter_resonance / 100.0; + } + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + } } void UI_func_midi_channel(uint8_t param) { - ; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("MIDI Channel")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.midi_channel < MIDI_CHANNEL_MAX) + { + configuration.midi_channel++; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.midi_channel > MIDI_CHANNEL_MIN) + { + configuration.midi_channel--; + } + } + lcd.setCursor(0, 1); + + if (configuration.midi_channel == 0) + { + lcd.print(F("OMNI")); + } + else + { + lcd_display_int(configuration.midi_channel, 2, false, true, false); + lcd.print(F(" ")); + } + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + } } void UI_func_loudness(uint8_t param) { - ; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("Loudness")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.loudness < LOUDNESS_MAX) + { + configuration.loudness++; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.loudness > LOUDNESS_MIN) + { + configuration.loudness--; + } + } + lcd.setCursor(0, 1); + lcd_display_int(configuration.loudness, 3, true, true, false); + + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + MicroDexed[i]->fx.Gain = configuration.loudness / 100.0; + } + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + } } void UI_func_panorama(uint8_t param) { - ; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("Panorama")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.pan < PANORAMA_MAX) + { + configuration.pan++; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.loudness > PANORAMA_MIN) + { + configuration.pan--; + } + } + lcd.setCursor(0, 1); + lcd_display_int(configuration.pan, 2, false, true, true); + } + + set_volume(configuration.vol, configuration.pan); + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + } } void UI_func_stereo_mono(uint8_t param) @@ -1189,11 +1388,11 @@ void UI_func_volume(uint8_t param) // update LCD content LCDML.DISP_clear(); lcd.show(0, 0, 8, "Volume: "); - lcd.show(0, 9, 3, configuration.vol * 100.0 + 0.5); + lcd.show(0, 9, 3, configuration.vol); lcd.setCursor(1, 1); for (uint8_t i = 0; i < LCD_cols; i++) { - if (i < int((LCD_cols - 2) * configuration.vol + 0.5)) + if (i < int((LCD_cols - 2) * configuration.vol / 100.0)) lcd.print("*"); else lcd.print(" "); diff --git a/config.h b/config.h index 8434c15..380ed84 100644 --- a/config.h +++ b/config.h @@ -65,8 +65,8 @@ #define DEFAULT_MIDI_CHANNEL MIDI_CHANNEL_OMNI #define MIDI_MERGE_THRU 1 -#define DEFAULT_SYSEXBANK 0 -#define DEFAULT_SYSEXSOUND 0 +#define SYSEXBANK_DEFAULT 0 +#define SYSEXSOUND_DEFAULT 0 //************************************************************************************************* //* DEXED AND EFECTS SETTINGS @@ -84,7 +84,6 @@ //* AUDIO SETTINGS //************************************************************************************************* // https://rechneronline.de/funktionsgraphen/ -#define VOLUME 0.8 #define VOLUME_CURVE 0.07 #ifndef TEENSY_AUDIO_BOARD #if AUDIO_BLOCK_SAMPLES == 64 @@ -140,12 +139,7 @@ #define SDCARD_SCK_PIN 13 // not actually used // Encoder with button -#define ENC_FILTER_RES_STEPS 100 -#define ENC_FILTER_CUT_STEPS 100 -#define ENC_DELAY_TIME_STEPS 50 -#define ENC_DELAY_FB_STEPS 35 -#define ENC_DELAY_VOLUME_STEPS 50 -#define ENC_VOLUME_STEPS 20 +#define ENCODER_USE_INTERRUPTS #define NUM_ENCODER 2 #define ENC_L_PIN_A 3 #define ENC_L_PIN_B 2 @@ -188,8 +182,12 @@ #if defined(__MK66FX1M0__) // Teensy-3.6 // Teensy-3.6 settings #define MIDI_DEVICE_USB_HOST 1 +#if defined(USE_REVERB) #define MAX_NOTES 16 #else +#define MAX_NOTES 14 +#endif +#else // Teensy-3.5 settings #undef MIDI_DEVICE_USB_HOST #define MAX_NOTES 11 @@ -215,9 +213,18 @@ #define MOD_LINKWITZ_RILEY_FILTER_OUTPUT 2 #define MONO_MIN 0 -#define MONO_MAX 1 +#define MONO_MAX 3 #define MONO_DEFAULT 0 +#define VOLUME_MIN 0 +#define VOLUME_MAX 100 +#define VOLUME_DEFAULT 80 +#define VOLUME_ENC_STEPS 20 + +#define PANORAMA_MIN -20 +#define PANORAMA_MAX 20 +#define PANORAMA_DEFAULT 0 + #define MIDI_CHANNEL_MIN MIDI_CHANNEL_OMNI #define MIDI_CHANNEL_MAX 16 #define MIDI_CHANNEL_DEFAULT MIDI_CHANNEL_OMNI @@ -262,13 +269,25 @@ #define DELAY_LEVEL_MAX 100 #define DELAY_LEVEL_DEFAULT 0 +#define FILTER_CUTOFF_MIN 0 +#define FILTER_CUTOFF_MAX 100 +#define FILTER_CUTOFF_DEFAULT 0 + +#define FILTER_RESONANCE_MIN 0 +#define FILTER_RESONANCE_MAX 100 +#define FILTER_RESONANCE_DEFAULT 0 + +#define LOUDNESS_MIN 0 +#define LOUDNESS_MAX 100 +#define LOUDNESS_DEFAULT 100 + // struct for holding the current configuration struct config_t { uint32_t checksum; uint8_t bank; uint8_t voice; - float vol; - float pan; + uint8_t vol; + int8_t pan; uint8_t mono; uint8_t midi_channel; uint8_t reverb_roomsize; @@ -281,6 +300,9 @@ struct config_t { uint8_t delay_time; uint8_t delay_feedback; uint8_t delay_level; + uint8_t filter_cutoff; + uint8_t filter_resonance; + uint8_t loudness; }; // struct for smoothing value changes diff --git a/doc/Audio-Chain.png b/doc/Audio-Chain.png new file mode 100644 index 0000000..2f5cca2 Binary files /dev/null and b/doc/Audio-Chain.png differ