Fixing bank and voice boundaries.

Adding possibility to fine tune +/- 99 cent (with automatic transpose
reconfiguration when tuning down).
pull/32/head
Holger Wirtz 5 years ago
parent 15c05470c6
commit 57fd9a2229
  1. 12
      MicroDexed.ino
  2. 24
      UI.hpp
  3. 6
      config.h
  4. 2
      dexed.cpp
  5. 10
      dexed_sysex.cpp
  6. 2
      dx7note.cpp

@ -319,7 +319,7 @@ void setup()
Serial.print(F("/")); Serial.print(F("/"));
Serial.print(bank_name[instance_id]); Serial.print(bank_name[instance_id]);
Serial.println(F("]")); Serial.println(F("]"));
for (uint8_t n = 0; n < MAX_VOICES; n++) for (uint8_t n = 0; n < MAX_VOICES - 1; n++)
{ {
if (n < 10) if (n < 10)
Serial.print(F(" ")); Serial.print(F(" "));
@ -584,7 +584,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
switch (inCtrl) { switch (inCtrl) {
case 0: case 0:
if (inValue < MAX_BANKS) if (inValue < MAX_BANKS - 1)
{ {
configuration.dexed[instance_id].bank = inValue; configuration.dexed[instance_id].bank = inValue;
} }
@ -618,7 +618,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("VOLUME CC")); Serial.println(F("VOLUME CC"));
#endif #endif
configuration.dexed[instance_id].loudness = map(inValue, 0, 0x7f,LOUDNESS_MIN, LOUDNESS_MAX); configuration.dexed[instance_id].loudness = map(inValue, 0, 0x7f, LOUDNESS_MIN, LOUDNESS_MAX);
MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].loudness, LOUDNESS_MIN, LOUDNESS_MAX, 0.0, 1.0); MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].loudness, LOUDNESS_MIN, LOUDNESS_MAX, 0.0, 1.0);
break; break;
case 10: // Pan case 10: // Pan
@ -722,7 +722,7 @@ void handleProgramChange(byte inChannel, byte inProgram)
{ {
if (checkMidiChannel(inChannel, instance_id)) if (checkMidiChannel(inChannel, instance_id))
{ {
if (inProgram < MAX_VOICES) if (inProgram < MAX_VOICES - 1)
{ {
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
@ -1181,8 +1181,8 @@ void check_configuration(void)
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{ {
configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel, MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX); configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel, MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
configuration.dexed[instance_id].bank = constrain(configuration.dexed[instance_id].bank, 0, MAX_BANKS); configuration.dexed[instance_id].bank = constrain(configuration.dexed[instance_id].bank, 0, MAX_BANKS - 1);
configuration.dexed[instance_id].voice = constrain(configuration.dexed[instance_id].voice, 0, MAX_VOICES); configuration.dexed[instance_id].voice = constrain(configuration.dexed[instance_id].voice, 0, MAX_VOICES - 1);
configuration.dexed[instance_id].reverb_send = constrain(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX); configuration.dexed[instance_id].reverb_send = constrain(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX);
configuration.dexed[instance_id].chorus_send = constrain(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX); configuration.dexed[instance_id].chorus_send = constrain(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX);
configuration.dexed[instance_id].delay_send = constrain(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX); configuration.dexed[instance_id].delay_send = constrain(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX);

@ -577,7 +577,7 @@ void encoder_right_up(void)
switch (menu_voice) switch (menu_voice)
{ {
case MENU_VOICE_BANK: case MENU_VOICE_BANK:
if (configuration.dexed[instance_id].bank < MAX_BANKS) if (configuration.dexed[instance_id].bank < MAX_BANKS - 1)
{ {
configuration.dexed[instance_id].bank++; configuration.dexed[instance_id].bank++;
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
@ -596,7 +596,7 @@ void encoder_right_up(void)
configuration.dexed[instance_id].voice++; configuration.dexed[instance_id].voice++;
else else
{ {
if (configuration.dexed[instance_id].bank < MAX_BANKS) if (configuration.dexed[instance_id].bank < MAX_BANKS - 1)
{ {
configuration.dexed[instance_id].bank++; configuration.dexed[instance_id].bank++;
configuration.dexed[instance_id].voice = 0; configuration.dexed[instance_id].voice = 0;
@ -1619,6 +1619,8 @@ void UI_func_tune(uint8_t param)
// setup function // setup function
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("Tune")); lcd.print(F("Tune"));
lcd.setCursor(6, 1);
lcd.print(F("cent"));
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -1633,6 +1635,11 @@ void UI_func_tune(uint8_t param)
{ {
if (configuration.dexed[instance_id].tune < TUNE_MAX) if (configuration.dexed[instance_id].tune < TUNE_MAX)
{ {
if (configuration.dexed[instance_id].tune == 99)
{
MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_TRANSPOSE]++;
configuration.dexed[instance_id].transpose++;
}
configuration.dexed[instance_id].tune++; configuration.dexed[instance_id].tune++;
} }
} }
@ -1640,17 +1647,22 @@ void UI_func_tune(uint8_t param)
{ {
if (configuration.dexed[instance_id].tune > TUNE_MIN) if (configuration.dexed[instance_id].tune > TUNE_MIN)
{ {
if (configuration.dexed[instance_id].tune == 100)
{
MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_TRANSPOSE]--;
configuration.dexed[instance_id].transpose--;
}
configuration.dexed[instance_id].tune--; configuration.dexed[instance_id].tune--;
} }
} }
MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] = configuration.dexed[instance_id].tune; MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] = configuration.dexed[instance_id].tune;
MicroDexed[instance_id]->controllers.masterTune = (MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] / 10 * 0x4000 << 11) * (1.0 / 12); MicroDexed[instance_id]->controllers.masterTune = (int(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] % 100 / 100.0 * 0x4000) << 11) * (1.0 / 12);
MicroDexed[instance_id]->doRefreshVoice(); MicroDexed[instance_id]->doRefreshVoice();
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.dexed[instance_id].tune, 2, true, true, false); lcd_display_int(configuration.dexed[instance_id].tune - 100, 1, false, true, true);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2719,10 +2731,10 @@ void UI_func_portamento_mode(uint8_t param)
switch (configuration.dexed[instance_id].portamento_mode) switch (configuration.dexed[instance_id].portamento_mode)
{ {
case 0: case 0:
lcd.print(F("[RETAIN ]")); lcd.print(F("[RETAIN]"));
break; break;
case 1: case 1:
lcd.print(F("[FOLLOW ]")); lcd.print(F("[FOLLOW]"));
break; break;
} }
} }

@ -336,9 +336,9 @@ enum { DEXED, REVERB, DELAY, CHORUS };
#define TRANSPOSE_MAX 48 #define TRANSPOSE_MAX 48
#define TRANSPOSE_DEFAULT 12 #define TRANSPOSE_DEFAULT 12
#define TUNE_MIN 0 #define TUNE_MIN 1
#define TUNE_MAX 10 #define TUNE_MAX 199
#define TUNE_DEFAULT 0 #define TUNE_DEFAULT 100
#define LOUDNESS_MIN 0 #define LOUDNESS_MIN 0
#define LOUDNESS_MAX 100 #define LOUDNESS_MAX 100

@ -331,6 +331,8 @@ void Dexed::setMonoMode(bool mode) {
if (monoMode == mode) if (monoMode == mode)
return; return;
//panic();
notesOff();
monoMode = mode; monoMode = mode;
} }

@ -72,7 +72,7 @@ bool get_voice_names_from_bank(uint8_t b, uint8_t instance_id)
int32_t bulk_checksum_calc = 0; int32_t bulk_checksum_calc = 0;
int8_t bulk_checksum; int8_t bulk_checksum;
b %= MAX_BANKS; b = constrain(b, 0, MAX_BANKS - 1);
// erase all data for voice names // erase all data for voice names
memset(voice_names[instance_id], 0, MAX_VOICES * VOICE_NAME_LEN); memset(voice_names[instance_id], 0, MAX_VOICES * VOICE_NAME_LEN);
@ -223,8 +223,8 @@ bool load_sysex(uint8_t b, uint8_t v, uint8_t instance_id)
#if DEBUG #if DEBUG
bool found = false; bool found = false;
#endif #endif
v = constrain(v, 0, MAX_VOICES); v = constrain(v, 0, MAX_VOICES - 1);
b = constrain(b, 0, MAX_BANKS); b = constrain(b, 0, MAX_BANKS - 1);
if (sd_card_available) if (sd_card_available)
{ {
@ -459,8 +459,8 @@ bool load_sysex_setup(uint8_t b, uint8_t v, uint8_t instance_id)
#if DEBUG #if DEBUG
bool found = false; bool found = false;
#endif #endif
v %= MAX_VOICES; v = constrain(v, 0, MAX_VOICES - 1);
b %= MAX_BANKS; b = constrain(b, 0, MAX_BANKS - 1);
if (sd_card_available) if (sd_card_available)
{ {

@ -340,7 +340,7 @@ void Dx7Note::peekVoiceStatus(VoiceStatus &status) {
} }
/** /**
Used in monophonic mode to transfert voice state from different notes Used in monophonic mode to transfer voice state from different notes
*/ */
void Dx7Note::transferState(Dx7Note &src) { void Dx7Note::transferState(Dx7Note &src) {
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {

Loading…
Cancel
Save