Fixes for resetting sustain mode when fire up panic().

Fixes for preprocessor code for selecting the right number of voices dependent on USE_FX, CPU speed and processor.
pull/32/head
Holger Wirtz 5 years ago
parent a66ca41eed
commit 5377d12336
  1. 31
      MicroDexed.ino
  2. 3
      UI.hpp
  3. 43
      config.h
  4. 1
      dexed.cpp

@ -236,7 +236,7 @@ extern void getNoteName(char* noteName, uint8_t noteNumber);
void setup() void setup()
{ {
// Start audio system // Start audio system
AudioNoInterrupts(); //AudioNoInterrupts();
AudioMemory(AUDIO_MEM); AudioMemory(AUDIO_MEM);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
@ -259,6 +259,7 @@ void setup()
#endif #endif
#endif #endif
#ifdef DEBUG #ifdef DEBUG
generate_version_string(version_string, sizeof(version_string)); generate_version_string(version_string, sizeof(version_string));
@ -269,7 +270,11 @@ void setup()
Serial.println(version_string); Serial.println(version_string);
Serial.print(F("CPU-Speed: ")); Serial.print(F("CPU-Speed: "));
Serial.print(F_CPU / 1000000.0, 1); Serial.print(F_CPU / 1000000.0, 1);
Serial.println(F(" MHz")); Serial.print(F(" MHz / "));
Serial.print(NUM_DEXED, DEC);
Serial.print(F(" Instances with "));
Serial.print(MAX_NOTES);
Serial.println(F(" notes for each instance"));
Serial.println(F("<setup start>")); Serial.println(F("<setup start>"));
Serial.flush(); Serial.flush();
#endif #endif
@ -473,7 +478,7 @@ void setup()
master_mixer_r.gain(3, 0.0); master_mixer_r.gain(3, 0.0);
master_mixer_l.gain(3, 0.0); master_mixer_l.gain(3, 0.0);
AudioInterrupts(); //AudioInterrupts();
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("<setup end>")); Serial.println(F("<setup end>"));
@ -1504,11 +1509,7 @@ void check_configuration(void)
configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX); configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX);
configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose, TRANSPOSE_MIN, TRANSPOSE_MAX); configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose, TRANSPOSE_MIN, TRANSPOSE_MAX);
configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune, TUNE_MIN, TUNE_MAX); configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune, TUNE_MIN, TUNE_MAX);
#if NUM_DEXED > 1
configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony + ((POLYPHONY_MAX % 2) - instance_id) , POLYPHONY_MIN, POLYPHONY_MAX / 2);
#else
configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony, POLYPHONY_MIN, POLYPHONY_MAX); configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony, POLYPHONY_MIN, POLYPHONY_MAX);
#endif
configuration.dexed[instance_id].velocity_level = constrain(configuration.dexed[instance_id].velocity_level, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX); configuration.dexed[instance_id].velocity_level = constrain(configuration.dexed[instance_id].velocity_level, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX);
configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine, ENGINE_MIN, ENGINE_MAX); configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine, ENGINE_MIN, ENGINE_MAX);
configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly, MONOPOLY_MIN, MONOPOLY_MAX); configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly, MONOPOLY_MIN, MONOPOLY_MAX);
@ -1576,11 +1577,7 @@ void init_configuration(void)
configuration.dexed[instance_id].pan = PANORAMA_DEFAULT; configuration.dexed[instance_id].pan = PANORAMA_DEFAULT;
configuration.dexed[instance_id].transpose = TRANSPOSE_DEFAULT; configuration.dexed[instance_id].transpose = TRANSPOSE_DEFAULT;
configuration.dexed[instance_id].tune = TUNE_DEFAULT; configuration.dexed[instance_id].tune = TUNE_DEFAULT;
#if NUM_DEXED > 1
configuration.dexed[instance_id].polyphony = (POLYPHONY_DEFAULT / 2) + (POLYPHONY_DEFAULT % 2) - instance_id;
#else
configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT; configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT;
#endif
configuration.dexed[instance_id].velocity_level = VELOCITY_LEVEL_DEFAULT; configuration.dexed[instance_id].velocity_level = VELOCITY_LEVEL_DEFAULT;
configuration.dexed[instance_id].engine = ENGINE_DEFAULT; configuration.dexed[instance_id].engine = ENGINE_DEFAULT;
configuration.dexed[instance_id].monopoly = MONOPOLY_DEFAULT; configuration.dexed[instance_id].monopoly = MONOPOLY_DEFAULT;
@ -1616,18 +1613,8 @@ void init_configuration(void)
configuration.performance.bank[instance_id] = SYSEXBANK_DEFAULT; configuration.performance.bank[instance_id] = SYSEXBANK_DEFAULT;
configuration.performance.voice[instance_id] = SYSEXSOUND_DEFAULT; configuration.performance.voice[instance_id] = SYSEXSOUND_DEFAULT;
#if NUM_DEXED > 1
configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT / 2;
#else
if (instance_id == 0)
{
configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT; configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT;
}
else
{
configuration.dexed[instance_id].polyphony = 0;
}
#endif
#if NUM_DEXED > 1 #if NUM_DEXED > 1
MicroDexed[instance_id]->controllers.refresh(); MicroDexed[instance_id]->controllers.refresh();

@ -2041,9 +2041,6 @@ void UI_func_polyphony(uint8_t param)
{ {
if (LCDML.BT_checkDown()) if (LCDML.BT_checkDown())
{ {
#if NUM_DEXED > 1
if (configuration.dexed[0].polyphony + configuration.dexed[1].polyphony + 1 <= POLYPHONY_MAX)
#endif
configuration.dexed[selected_instance_id].polyphony = constrain(configuration.dexed[selected_instance_id].polyphony + 1, POLYPHONY_MIN, POLYPHONY_MAX); configuration.dexed[selected_instance_id].polyphony = constrain(configuration.dexed[selected_instance_id].polyphony + 1, POLYPHONY_MIN, POLYPHONY_MAX);
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())

@ -56,7 +56,7 @@
// sed -i.orig 's/^#define USB_MIDI_SYSEX_MAX 290/#define USB_MIDI_SYSEX_MAX 4104/' /usr/local/arduino-teensy-1.8.12/hardware/teensy/avr/cores/teensy3/usb_midi.h // sed -i.orig 's/^#define USB_MIDI_SYSEX_MAX 290/#define USB_MIDI_SYSEX_MAX 4104/' /usr/local/arduino-teensy-1.8.12/hardware/teensy/avr/cores/teensy3/usb_midi.h
//#define USB_MIDI_SYSEX_MAX 4104 //#define USB_MIDI_SYSEX_MAX 4104
#define VERSION "0.9.9o" #define VERSION "0.9.9p"
//************************************************************************************************* //*************************************************************************************************
//* DEVICE SETTINGS //* DEVICE SETTINGS
@ -273,40 +273,53 @@
#define USBCON 1 #define USBCON 1
#endif #endif
#if defined(__IMXRT1062__) //Teensy-4.0 // Teensy-4.x settings
#undef MIDI_DEVICE_USB #if defined(__IMXRT1062__) //Teensy-4.x
#define MAX_NOTES 16 #define MAX_NOTES 16
#define TEENSY4 #define TEENSY4
#endif #endif
#if defined(__MK66FX1M0__) // Teensy-3.6
// Teensy-3.6 settings // Teensy-3.6 settings
#define MIDI_DEVICE_USB_HOST 1 #if defined(__MK66FX1M0__) // Teensy-3.6
# if defined(USE_FX) # if defined(USE_FX)
# if NUM_DEXED == 1 # if NUM_DEXED == 1
#if F_CPU >= 256 # if F_CPU == 256000000
# define MAX_NOTES 20 # define MAX_NOTES 20
#elif F_CPU >= 216 # elif F_CPU == 216000000
# define MAX_NOTES 16 # define MAX_NOTES 16
# else # else
# define MAX_NOTES 12 # define MAX_NOTES 12
#endif // F_CPU >= 256 # endif
#else // NUM_DEXED != 1 # else
#define MAX_NOTES 10 // Due to problems with lack of RAM (12 for 180MHz, 16 for 216 MHz) # if F_CPU == 256000000
# define MAX_NOTES 9
# elif F_CPU == 216000000
# define MAX_NOTES 7
# else
# define MAX_NOTES 5
# endif
# endif # endif
# else # else
# if NUM_DEXED == 1 # if NUM_DEXED == 1
# if F_CPU == 256000000
# define MAX_NOTES 20
# elif F_CPU == 216000000
# define MAX_NOTES 20
# else
# define MAX_NOTES 16 # define MAX_NOTES 16
# endif
# else # else
#if F_CPU >= 216 # if F_CPU == 256000000
# define MAX_NOTES 20
# elif F_CPU == 216000000
# define MAX_NOTES 16 # define MAX_NOTES 16
# else # else
#define MAX_NOTES 13 # define MAX_NOTES 8
# endif
# endif # endif
#endif // NUM_DEXED == 1
#endif // defined(USE_FX)
# define TEENSY3_6 # define TEENSY3_6
#endif // defined(__MK66FX1M0__) # endif
#endif
#if defined (__MK64FX512__) #if defined (__MK64FX512__)
// Teensy-3.5 settings // Teensy-3.5 settings

@ -421,6 +421,7 @@ void Dexed::panic(void)
} }
} }
} }
setSustain(0);
} }
void Dexed::resetControllers(void) void Dexed::resetControllers(void)

Loading…
Cancel
Save