From f1f406fdb9c7308c0d379f402abca7f1bfc0ccc8 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Wed, 13 Jun 2018 15:32:20 +0200 Subject: [PATCH] Smaller fixes and additions. --- MicroDexed.ino | 16 +++++++++++----- config.h | 15 ++++++++++----- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 7e8bfd8..3baa7de 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -43,7 +43,7 @@ AudioConnection patchCord3(queue1, 0, i2s1, 1); AudioControlSGTL5000 sgtl5000_1; //xy=507,403 // GUItool: end automatically generated code -MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI); +MIDI_CREATE_INSTANCE(HardwareSerial, MIDI_DEVICE, MIDI); Dexed* dexed = new Dexed(SAMPLE_RATE); bool sd_card_available = false; uint8_t bank = EEPROM.read(EEPROM_BANK_ADDR); @@ -76,7 +76,7 @@ void setup() delay(200); Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed")); Serial.println(F("(c)2018 H. Wirtz ")); - Serial.println(F("setup start")); + Serial.println(F("")); // start up USB host #ifdef USE_ONBOARD_USB_HOST @@ -127,7 +127,7 @@ void setup() sched_note_off.begin(note_off, 6333333); #endif - Serial.println(F("setup end")); + Serial.println(F("")); show_cpu_and_mem_usage(); #ifdef TEST_NOTE @@ -180,6 +180,9 @@ void handle_midi_input(void) usb_host.Task(); while (midi_usb.read()) { +#ifdef DEBUG + Serial.println(F("MIDI-USB")); +#endif if (MIDI.getType() == 0xF0) // SysEX { handle_sysex_parameter(MIDI.getSysExArray(), MIDI.getSysExArrayLength()); @@ -191,6 +194,9 @@ void handle_midi_input(void) while (MIDI.read()) { +#ifdef DEBUG + Serial.println(F("MIDI-Serial")); +#endif if (MIDI.getType() == 0xF0) // SYSEX { handle_sysex_parameter(MIDI.getSysExArray(), MIDI.getSysExArrayLength()); @@ -288,8 +294,8 @@ bool handle_master_key(uint8_t data) { Serial.print(F("Loading voice number ")); Serial.println(num, DEC); - EEPROM.write(EEPROM_VOICE_ADDR,num); - EEPROM.write(EEPROM_BANK_ADDR,bank); + EEPROM.write(EEPROM_VOICE_ADDR, num); + EEPROM.write(EEPROM_BANK_ADDR, bank); } } return (true); diff --git a/config.h b/config.h index 5fbc2d3..efc0397 100644 --- a/config.h +++ b/config.h @@ -25,22 +25,27 @@ #include "midinotes.h" // Initial values +#define MIDI_DEVICE Serial1 #define VOLUME 0.1 #define SAMPLE_RATE 44100 //#define DEXED_ENGINE DEXED_ENGINE_MODERN -#define USE_ONBOARD_USB_HOST 1 -#define MAX_NOTES 16 +//#define USE_ONBOARD_USB_HOST 1 +#if !defined(__MK66FX1M0__) // check for Teensy-3.6 +#define MAX_NOTES 11 // No? +#else +#define MAX_NOTES 16 // Yes +#endif #define AUDIO_MEM 2 #define DEFAULT_SYSEXBANK 0 #define DEFAULT_SYSEXSOUND 0 -// Master key handling (comment out for disabling) +// Master key handling (comment for disabling) #define MASTER_KEY_MIDI MIDI_C6 #define MASTER_NUM1 MIDI_C1 // Debug output #define SERIAL_SPEED 38400 -//#define SHOW_DEXED_TIMING 1 +#define SHOW_DEXED_TIMING 1 #define DEBUG 1 #define SHOW_MIDI_EVENT 1 #define SHOW_XRUN 1 @@ -52,7 +57,7 @@ #define REDUCE_LOUDNESS 2 // Enable TEST_NOTE for adding code to drop some midi notes for testing without keyboard -//#define TEST_NOTE MIDI_E2 +#define TEST_NOTE MIDI_E2 #define TEST_VEL_MIN 60 #define TEST_VEL_MAX 110