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 4 years ago
parent a66ca41eed
commit 5377d12336
  1. 33
      MicroDexed.ino
  2. 3
      UI.hpp
  3. 71
      config.h
  4. 1
      dexed.cpp

@ -236,7 +236,7 @@ extern void getNoteName(char* noteName, uint8_t noteNumber);
void setup()
{
// Start audio system
AudioNoInterrupts();
//AudioNoInterrupts();
AudioMemory(AUDIO_MEM);
#ifdef DISPLAY_LCD_SPI
@ -259,6 +259,7 @@ void setup()
#endif
#endif
#ifdef DEBUG
generate_version_string(version_string, sizeof(version_string));
@ -269,7 +270,11 @@ void setup()
Serial.println(version_string);
Serial.print(F("CPU-Speed: "));
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.flush();
#endif
@ -473,7 +478,7 @@ void setup()
master_mixer_r.gain(3, 0.0);
master_mixer_l.gain(3, 0.0);
AudioInterrupts();
//AudioInterrupts();
#ifdef DEBUG
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].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);
#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);
#endif
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].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].transpose = TRANSPOSE_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;
#endif
configuration.dexed[instance_id].velocity_level = VELOCITY_LEVEL_DEFAULT;
configuration.dexed[instance_id].engine = ENGINE_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.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;
}
else
{
configuration.dexed[instance_id].polyphony = 0;
}
#endif
configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT;
#if NUM_DEXED > 1
MicroDexed[instance_id]->controllers.refresh();

@ -2041,9 +2041,6 @@ void UI_func_polyphony(uint8_t param)
{
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);
}
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
//#define USB_MIDI_SYSEX_MAX 4104
#define VERSION "0.9.9o"
#define VERSION "0.9.9p"
//*************************************************************************************************
//* DEVICE SETTINGS
@ -273,40 +273,53 @@
#define USBCON 1
#endif
#if defined(__IMXRT1062__) //Teensy-4.0
#undef MIDI_DEVICE_USB
// Teensy-4.x settings
#if defined(__IMXRT1062__) //Teensy-4.x
#define MAX_NOTES 16
#define TEENSY4
#endif
#if defined(__MK66FX1M0__) // Teensy-3.6
// Teensy-3.6 settings
#define MIDI_DEVICE_USB_HOST 1
#if defined(USE_FX)
#if NUM_DEXED == 1
#if F_CPU >= 256
#define MAX_NOTES 20
#elif F_CPU >= 216
#define MAX_NOTES 16
#else
#define MAX_NOTES 12
#endif // F_CPU >= 256
#else // NUM_DEXED != 1
#define MAX_NOTES 10 // Due to problems with lack of RAM (12 for 180MHz, 16 for 216 MHz)
#endif
#else
#if NUM_DEXED == 1
#define MAX_NOTES 16
#else
#if F_CPU >= 216
#define MAX_NOTES 16
#else
#define MAX_NOTES 13
#if defined(__MK66FX1M0__) // Teensy-3.6
# if defined(USE_FX)
# if NUM_DEXED == 1
# if F_CPU == 256000000
# define MAX_NOTES 20
# elif F_CPU == 216000000
# define MAX_NOTES 16
# else
# define MAX_NOTES 12
# endif
# else
# if F_CPU == 256000000
# define MAX_NOTES 9
# elif F_CPU == 216000000
# define MAX_NOTES 7
# else
# define MAX_NOTES 5
# endif
# endif
# else
# 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
# endif
# else
# if F_CPU == 256000000
# define MAX_NOTES 20
# elif F_CPU == 216000000
# define MAX_NOTES 16
# else
# define MAX_NOTES 8
# endif
# endif
# define TEENSY3_6
# endif
#endif
#endif // NUM_DEXED == 1
#endif // defined(USE_FX)
#define TEENSY3_6
#endif // defined(__MK66FX1M0__)
#if defined (__MK64FX512__)
// Teensy-3.5 settings

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

Loading…
Cancel
Save