Added more menu functions.

Fixed volume setup.
pull/3/head
Holger Wirtz 5 years ago
parent 1daf236276
commit b778712003
  1. 185
      MicroDexed.ino
  2. 233
      UI.hpp
  3. 46
      config.h
  4. BIN
      doc/Audio-Chain.png

@ -64,7 +64,7 @@ AudioConnection patchCord8(modchorus_filter, 0, master_mixer_l, 3);
AudioConnection patchCord9(modchorus, 0, master_mixer_r, 3); AudioConnection patchCord9(modchorus, 0, master_mixer_r, 3);
AudioConnection patchCord10(modchorus, 0, master_mixer_l, 3); AudioConnection patchCord10(modchorus, 0, master_mixer_l, 3);
#endif #endif
#ifdef USE_REVERB #if defined(USE_REVERB)
AudioEffectFreeverbStereo freeverbs1; AudioEffectFreeverbStereo freeverbs1;
AudioConnection patchCord11(queue1, 0, freeverbs1, 0); AudioConnection patchCord11(queue1, 0, freeverbs1, 0);
AudioConnection patchCord12(queue1, 0, freeverbs1, 1); AudioConnection patchCord12(queue1, 0, freeverbs1, 1);
@ -125,15 +125,9 @@ uint8_t midi_timing_counter = 0; // 24 per qarter
elapsedMillis midi_timing_timestep; elapsedMillis midi_timing_timestep;
uint16_t midi_timing_quarter = 0; uint16_t midi_timing_quarter = 0;
elapsedMillis long_button_pressed; elapsedMillis long_button_pressed;
SoftenValue <float> soften_volume; SoftenValue <uint8_t> soften_volume;
SoftenValue <float> soften_filter_res[NUM_DEXED]; SoftenValue <uint8_t> soften_filter_res[NUM_DEXED];
SoftenValue <float> soften_filter_cut[NUM_DEXED]; SoftenValue <uint8_t> 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;
elapsedMicros fill_audio_buffer; elapsedMicros fill_audio_buffer;
elapsedMillis control_rate; elapsedMillis control_rate;
uint8_t active_voices = 0; uint8_t active_voices = 0;
@ -142,11 +136,11 @@ elapsedMillis cpu_mem_millis;
#endif #endif
config_t configuration = { config_t configuration = {
0xffff, 0xffff,
DEFAULT_SYSEXBANK, SYSEXBANK_DEFAULT,
DEFAULT_SYSEXSOUND, SYSEXSOUND_DEFAULT,
VOLUME, VOLUME_DEFAULT,
0.5f, // pan PANORAMA_DEFAULT, // pan
0, // mono MONO_DEFAULT, // mono
DEFAULT_MIDI_CHANNEL, DEFAULT_MIDI_CHANNEL,
REVERB_ROOMSIZE_DEFAULT, REVERB_ROOMSIZE_DEFAULT,
REVERB_DAMPING_DEFAULT, REVERB_DAMPING_DEFAULT,
@ -154,7 +148,10 @@ config_t configuration = {
CHORUS_FREQUENCY_DEFAULT, CHORUS_FREQUENCY_DEFAULT,
CHORUS_WAVEFORM_DEFAULT, CHORUS_WAVEFORM_DEFAULT,
CHORUS_DEPTH_DEFAULT, CHORUS_DEPTH_DEFAULT,
CHORUS_LEVEL_DEFAULT CHORUS_LEVEL_DEFAULT,
FILTER_CUTOFF_DEFAULT,
FILTER_RESONANCE_DEFAULT,
LOUDNESS_DEFAULT
}; };
bool eeprom_update_flag = false; bool eeprom_update_flag = false;
@ -370,7 +367,7 @@ void setup()
// set initial volume and pan (read from EEPROM) // set initial volume and pan (read from EEPROM)
set_volume(configuration.vol, configuration.pan); 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) #if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
// Initialize processor and memory measurements // Initialize processor and memory measurements
@ -430,10 +427,6 @@ void loop()
if (peak1.read() > 0.99) if (peak1.read() > 0.99)
peak++; peak++;
} }
#ifndef TEENSY_AUDIO_BOARD
for (uint8_t i = 0; i < AUDIO_BLOCK_SAMPLES; i++)
audio_buffer[i] *= configuration.vol;
#endif
queue1.playBuffer(); queue1.playBuffer();
} }
@ -506,7 +499,7 @@ void loop()
set_volume(soften_volume.value(), configuration.pan); set_volume(soften_volume.value(), configuration.pan);
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Volume: ")); Serial.print(F("Volume: "));
Serial.print(configuration.vol, 5); Serial.print(configuration.vol, DEC);
Serial.print(F(" step: ")); Serial.print(F(" step: "));
Serial.print(soften_volume.steps()); Serial.print(soften_volume.steps());
Serial.print(F(" diff: ")); Serial.print(F(" diff: "));
@ -563,73 +556,107 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
} }
break; break;
case 1: case 1:
MicroDexed[0]->controllers.modwheel_cc = inValue; for (uint8_t i = 0; i < NUM_DEXED; i++)
MicroDexed[0]->controllers.refresh(); {
MicroDexed[i]->controllers.modwheel_cc = inValue;
MicroDexed[i]->controllers.refresh();
}
break; break;
case 2: case 2:
MicroDexed[0]->controllers.breath_cc = inValue; for (uint8_t i = 0; i < NUM_DEXED; i++)
MicroDexed[0]->controllers.refresh(); {
MicroDexed[i]->controllers.breath_cc = inValue;
MicroDexed[i]->controllers.refresh();
}
break; break;
case 4: case 4:
MicroDexed[0]->controllers.foot_cc = inValue; for (uint8_t i = 0; i < NUM_DEXED; i++)
MicroDexed[0]->controllers.refresh(); {
MicroDexed[i]->controllers.foot_cc = inValue;
MicroDexed[i]->controllers.refresh();
}
break; break;
case 7: // Volume case 7: // Volume
configuration.vol = float(inValue) / 0x7f; configuration.vol = map(inValue, 0, 0x7f, VOLUME_MIN, VOLUME_MAX);
set_volume(configuration.vol, configuration.pan); soften_volume.update(configuration.vol, SOFTEN_VALUE_CHANGE_STEPS);
break; break;
case 10: // Pan case 10: // Pan
configuration.pan = float(inValue) / 128; configuration.pan = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX);
set_volume(configuration.vol, configuration.pan); set_volume(configuration.vol, configuration.pan);
break; break;
case 32: // BankSelect LSB case 32: // BankSelect LSB
configuration.bank = inValue; configuration.bank = inValue;
break; break;
case 64: case 64:
MicroDexed[0]->setSustain(inValue > 63); for (uint8_t i = 0; i < NUM_DEXED; i++)
if (!MicroDexed[0]->getSustain()) { {
for (uint8_t note = 0; note < MicroDexed[0]->getMaxNotes(); note++) { MicroDexed[i]->setSustain(inValue > 63);
if (MicroDexed[0]->voices[note].sustained && !MicroDexed[0]->voices[note].keydown) { if (!MicroDexed[i]->getSustain()) {
MicroDexed[0]->voices[note].dx7_note->keyup(); for (uint8_t note = 0; note < MicroDexed[0]->getMaxNotes(); note++) {
MicroDexed[0]->voices[note].sustained = false; 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; break;
case 103: // CC 103: filter resonance case 103: // CC 103: filter resonance
effect_filter_resonance = map(inValue, 0, 127, 0, ENC_FILTER_RES_STEPS); configuration.filter_resonance = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX);
MicroDexed[0]->fx.Reso = 1.0 - float(effect_filter_resonance) / ENC_FILTER_RES_STEPS; for (uint8_t i = 0; i < NUM_DEXED; i++)
{
MicroDexed[i]->fx.Reso = configuration.filter_resonance / 100.0;
}
break; break;
case 104: // CC 104: filter cutoff case 104: // CC 104: filter cutoff
effect_filter_cutoff = map(inValue, 0, 127, 0, ENC_FILTER_CUT_STEPS); configuration.filter_cutoff = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX);
MicroDexed[0]->fx.Cutoff = 1.0 - float(effect_filter_cutoff) / ENC_FILTER_CUT_STEPS; for (uint8_t i = 0; i < NUM_DEXED; i++)
{
MicroDexed[i]->fx.Cutoff = configuration.filter_cutoff / 100.0;
}
break; break;
case 105: // CC 105: delay time case 105: // CC 105: delay time
effect_delay_time = map(inValue, 0, 127, 0, ENC_DELAY_TIME_STEPS); configuration.delay_time = map(inValue, 0, 0x7f, DELAY_TIME_MIN, DELAY_TIME_MAX);
////delay.delay(0, mapfloat(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); delay1.delay(0, configuration.delay_time * 10);
break;
case 106: // CC 106: delay feedback case 106: // CC 106: delay feedback
effect_delay_feedback = map(inValue, 0, 127, 0, ENC_DELAY_FB_STEPS); configuration.delay_feedback = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX);
////delay_mixer_r.gain(1, mapfloat(float(effect_delay_feedback), 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); 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; break;
case 107: // CC 107: delay volume case 107: // CC 107: delay volume
effect_delay_volume = map(inValue, 0, 127, 0, ENC_DELAY_VOLUME_STEPS); configuration.delay_level = map(inValue, 0, 0x7f, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX);
////delay_mixer_l.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delay tap1 signal (with added feedback) master_mixer_r.gain(2, configuration.delay_level / 100.0);
master_mixer_l.gain(2, configuration.delay_level / 100.0);
break; break;
case 120: case 120:
MicroDexed[0]->panic(); for (uint8_t i = 0; i < NUM_DEXED; i++)
{
MicroDexed[i]->panic();
}
break; break;
case 121: case 121:
MicroDexed[0]->resetControllers(); for (uint8_t i = 0; i < NUM_DEXED; i++)
{
MicroDexed[i]->resetControllers();
}
break; break;
case 123: case 123:
MicroDexed[0]->notesOff(); for (uint8_t i = 0; i < NUM_DEXED; i++)
{
MicroDexed[i]->notesOff();
}
break; break;
case 126: case 126:
MicroDexed[0]->setMonoMode(true); for (uint8_t i = 0; i < NUM_DEXED; i++)
{
MicroDexed[i]->setMonoMode(true);
}
break; break;
case 127: case 127:
MicroDexed[0]->setMonoMode(false); for (uint8_t i = 0; i < NUM_DEXED; i++)
{
MicroDexed[i]->setMonoMode(false);
}
break; break;
} }
} }
@ -637,13 +664,19 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
void handleAfterTouch(byte inChannel, byte inPressure) void handleAfterTouch(byte inChannel, byte inPressure)
{ {
MicroDexed[0]->controllers.aftertouch_cc = inPressure; for (uint8_t i = 0; i < NUM_DEXED; i++)
MicroDexed[0]->controllers.refresh(); {
MicroDexed[i]->controllers.aftertouch_cc = inPressure;
MicroDexed[i]->controllers.refresh();
}
} }
void handlePitchBend(byte inChannel, int inPitch) 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) void handleProgramChange(byte inChannel, byte inProgram)
@ -934,19 +967,23 @@ bool checkMidiChannel(byte inChannel)
VOLUME HELPER VOLUME HELPER
******************************************************************************/ ******************************************************************************/
void set_volume(float v, float p) void set_volume(uint8_t v, int8_t p)
{ {
configuration.vol = v; configuration.vol = v;
configuration.pan = p; configuration.pan = p;
MicroDexed[0]->fx.Gain = v; uint16_t tmp = v / 100.0 * 1023.0 + 0.5;
float tmp2 = mapfloat(configuration.pan, PANORAMA_MIN, PANORAMA_MAX, 0.0, 1.0);
uint16_t tmp = v * 1023.0 + 0.5;
float tmp2 = configuration.pan;
float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20); 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(F("Setting volume: VOL="));
Serial.print(value, DEC); Serial.print(configuration.vol, DEC);
Serial.print(F("[")); Serial.print(F("["));
Serial.print(tmp3, 3); Serial.print(tmp3, 3);
Serial.print(F("] PAN=")); Serial.print(F("] PAN="));
@ -959,15 +996,21 @@ void set_volume(float v, float p)
Serial.println(tmp3 * cosf(tmp2 * PI / 2), 3); Serial.println(tmp3 * cosf(tmp2 * PI / 2), 3);
#endif #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) if (configuration.mono == 2)
{
volume_r.gain(1.0);
volume_l.gain(0.0); volume_l.gain(0.0);
}
else if (configuration.mono == 3) else if (configuration.mono == 3)
{
volume_r.gain(0.0); 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 // https://www.dr-lex.be/info-stuff/volumecontrols.html#table1
@ -1011,10 +1054,8 @@ void initial_values_from_eeprom(void)
Serial.println(); Serial.println();
#endif #endif
if (configuration.vol > 1.0) if (configuration.vol > 100)
configuration.vol = 1.0; configuration.vol = 100;
else if (configuration.vol < 0.0)
configuration.vol = 0.0;
} }
void eeprom_write(void) void eeprom_write(void)

233
UI.hpp

@ -30,6 +30,7 @@
#include "LiquidCrystalPlus_I2C.h" #include "LiquidCrystalPlus_I2C.h"
#include "SoftenValue.hpp" #include "SoftenValue.hpp"
#include "effect_modulated_delay.h" #include "effect_modulated_delay.h"
#include "dexed.h"
#include <LCDMenuLib2.h> #include <LCDMenuLib2.h>
#include <Encoder.h> #include <Encoder.h>
@ -50,9 +51,9 @@ extern void strip_extension(char* s, char *target);
extern void eeprom_write(void); extern void eeprom_write(void);
extern bool get_voice_names_from_bank(uint8_t b); extern bool get_voice_names_from_bank(uint8_t b);
extern bool load_sysex(uint8_t b, uint8_t v); extern bool load_sysex(uint8_t b, uint8_t v);
extern SoftenValue <float> soften_volume; extern SoftenValue <uint8_t> soften_volume;
extern SoftenValue <float> soften_filter_res[NUM_DEXED]; extern SoftenValue <uint8_t> soften_filter_res[NUM_DEXED];
extern SoftenValue <float> soften_filter_cut[NUM_DEXED]; extern SoftenValue <uint8_t> soften_filter_cut[NUM_DEXED];
extern AudioEffectDelay delay1; extern AudioEffectDelay delay1;
#ifdef USE_REVERB #ifdef USE_REVERB
extern AudioEffectFreeverbStereo freeverbs1; extern AudioEffectFreeverbStereo freeverbs1;
@ -64,6 +65,8 @@ extern AudioMixer4 master_mixer_r;
extern AudioMixer4 master_mixer_l; extern AudioMixer4 master_mixer_l;
extern AudioAmplifier volume_r; extern AudioAmplifier volume_r;
extern AudioAmplifier volume_l; extern AudioAmplifier volume_l;
extern Dexed* MicroDexed[NUM_DEXED];
extern void set_volume(uint8_t v, int8_t p);
/*********************************************************************** /***********************************************************************
GLOBAL GLOBAL
@ -450,10 +453,10 @@ void encoder_left_up(void)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("Volume +")); Serial.println(F("Volume +"));
#endif #endif
if (configuration.vol < 1.0) if (configuration.vol < VOLUME_MAX)
soften_volume.update(soften_volume.value() + 0.05, SOFTEN_VALUE_CHANGE_STEPS); soften_volume.update(soften_volume.value() + (VOLUME_MAX - VOLUME_MIN) / VOLUME_ENC_STEPS, SOFTEN_VALUE_CHANGE_STEPS);
else else
soften_volume.update(1.0, SOFTEN_VALUE_CHANGE_STEPS); soften_volume.update(VOLUME_MAX, SOFTEN_VALUE_CHANGE_STEPS);
eeprom_write(); eeprom_write();
UI_func_volume(0); UI_func_volume(0);
} }
@ -463,10 +466,10 @@ void encoder_left_down(void)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("Volume -")); Serial.println(F("Volume -"));
#endif #endif
if (configuration.vol > 0.0) if (configuration.vol > VOLUME_MIN)
soften_volume.update(soften_volume.value() - 0.05, SOFTEN_VALUE_CHANGE_STEPS); soften_volume.update(soften_volume.value() - (VOLUME_MAX - VOLUME_MIN) / VOLUME_ENC_STEPS, SOFTEN_VALUE_CHANGE_STEPS);
else else
soften_volume.update(0.0, SOFTEN_VALUE_CHANGE_STEPS); soften_volume.update(VOLUME_MIN, SOFTEN_VALUE_CHANGE_STEPS);
eeprom_write(); eeprom_write();
UI_func_volume(0); UI_func_volume(0);
} }
@ -800,7 +803,7 @@ void UI_func_chorus_frequency(uint8_t param)
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_float(configuration.chorus_frequency / 10.0, 2, 1, false, true, false); lcd_display_float(configuration.chorus_frequency / 10.0, 2, 1, false, true, false);
lcd.print(" Hz"); lcd.print(" Hz");
modulator.frequency(configuration.chorus_frequency / 10.0); 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) 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) 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) 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) 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) 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) void UI_func_stereo_mono(uint8_t param)
@ -1189,11 +1388,11 @@ void UI_func_volume(uint8_t param)
// update LCD content // update LCD content
LCDML.DISP_clear(); LCDML.DISP_clear();
lcd.show(0, 0, 8, "Volume: "); 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); lcd.setCursor(1, 1);
for (uint8_t i = 0; i < LCD_cols; i++) 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("*"); lcd.print("*");
else else
lcd.print(" "); lcd.print(" ");

@ -65,8 +65,8 @@
#define DEFAULT_MIDI_CHANNEL MIDI_CHANNEL_OMNI #define DEFAULT_MIDI_CHANNEL MIDI_CHANNEL_OMNI
#define MIDI_MERGE_THRU 1 #define MIDI_MERGE_THRU 1
#define DEFAULT_SYSEXBANK 0 #define SYSEXBANK_DEFAULT 0
#define DEFAULT_SYSEXSOUND 0 #define SYSEXSOUND_DEFAULT 0
//************************************************************************************************* //*************************************************************************************************
//* DEXED AND EFECTS SETTINGS //* DEXED AND EFECTS SETTINGS
@ -84,7 +84,6 @@
//* AUDIO SETTINGS //* AUDIO SETTINGS
//************************************************************************************************* //*************************************************************************************************
// https://rechneronline.de/funktionsgraphen/ // https://rechneronline.de/funktionsgraphen/
#define VOLUME 0.8
#define VOLUME_CURVE 0.07 #define VOLUME_CURVE 0.07
#ifndef TEENSY_AUDIO_BOARD #ifndef TEENSY_AUDIO_BOARD
#if AUDIO_BLOCK_SAMPLES == 64 #if AUDIO_BLOCK_SAMPLES == 64
@ -140,12 +139,7 @@
#define SDCARD_SCK_PIN 13 // not actually used #define SDCARD_SCK_PIN 13 // not actually used
// Encoder with button // Encoder with button
#define ENC_FILTER_RES_STEPS 100 #define ENCODER_USE_INTERRUPTS
#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 NUM_ENCODER 2 #define NUM_ENCODER 2
#define ENC_L_PIN_A 3 #define ENC_L_PIN_A 3
#define ENC_L_PIN_B 2 #define ENC_L_PIN_B 2
@ -188,8 +182,12 @@
#if defined(__MK66FX1M0__) // Teensy-3.6 #if defined(__MK66FX1M0__) // Teensy-3.6
// Teensy-3.6 settings // Teensy-3.6 settings
#define MIDI_DEVICE_USB_HOST 1 #define MIDI_DEVICE_USB_HOST 1
#if defined(USE_REVERB)
#define MAX_NOTES 16 #define MAX_NOTES 16
#else #else
#define MAX_NOTES 14
#endif
#else
// Teensy-3.5 settings // Teensy-3.5 settings
#undef MIDI_DEVICE_USB_HOST #undef MIDI_DEVICE_USB_HOST
#define MAX_NOTES 11 #define MAX_NOTES 11
@ -215,9 +213,18 @@
#define MOD_LINKWITZ_RILEY_FILTER_OUTPUT 2 #define MOD_LINKWITZ_RILEY_FILTER_OUTPUT 2
#define MONO_MIN 0 #define MONO_MIN 0
#define MONO_MAX 1 #define MONO_MAX 3
#define MONO_DEFAULT 0 #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_MIN MIDI_CHANNEL_OMNI
#define MIDI_CHANNEL_MAX 16 #define MIDI_CHANNEL_MAX 16
#define MIDI_CHANNEL_DEFAULT MIDI_CHANNEL_OMNI #define MIDI_CHANNEL_DEFAULT MIDI_CHANNEL_OMNI
@ -262,13 +269,25 @@
#define DELAY_LEVEL_MAX 100 #define DELAY_LEVEL_MAX 100
#define DELAY_LEVEL_DEFAULT 0 #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 for holding the current configuration
struct config_t { struct config_t {
uint32_t checksum; uint32_t checksum;
uint8_t bank; uint8_t bank;
uint8_t voice; uint8_t voice;
float vol; uint8_t vol;
float pan; int8_t pan;
uint8_t mono; uint8_t mono;
uint8_t midi_channel; uint8_t midi_channel;
uint8_t reverb_roomsize; uint8_t reverb_roomsize;
@ -281,6 +300,9 @@ struct config_t {
uint8_t delay_time; uint8_t delay_time;
uint8_t delay_feedback; uint8_t delay_feedback;
uint8_t delay_level; uint8_t delay_level;
uint8_t filter_cutoff;
uint8_t filter_resonance;
uint8_t loudness;
}; };
// struct for smoothing value changes // struct for smoothing value changes

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Loading…
Cancel
Save