diff --git a/MicroDexed.ino b/MicroDexed.ino index 9bc0995..b886dae 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -221,7 +221,7 @@ void note_on(void) queue_midi_event(0x90, TEST_NOTE + 32, random(TEST_VEL_MIN, TEST_VEL_MAX)); // 9 queue_midi_event(0x90, TEST_NOTE + 37, random(TEST_VEL_MIN, TEST_VEL_MAX)); // 10 queue_midi_event(0x90, TEST_NOTE + 40, random(TEST_VEL_MIN, TEST_VEL_MAX)); // 11 - queue_midi_event(0x90, TEST_NOTE + 44, random(TEST_VEL_MIN, TEST_VEL_MAX)); // 12 + queue_midi_event(0x90, TEST_NOTE + 46, random(TEST_VEL_MIN, TEST_VEL_MAX)); // 12 queue_midi_event(0x90, TEST_NOTE + 49, random(TEST_VEL_MIN, TEST_VEL_MAX)); // 13 queue_midi_event(0x90, TEST_NOTE + 52, random(TEST_VEL_MIN, TEST_VEL_MAX)); // 14 queue_midi_event(0x90, TEST_NOTE + 57, random(TEST_VEL_MIN, TEST_VEL_MAX)); // 15 @@ -241,18 +241,13 @@ void note_off(void) queue_midi_event(0x80, TEST_NOTE + 32, 0); // 9 queue_midi_event(0x80, TEST_NOTE + 37, 0); // 10 queue_midi_event(0x80, TEST_NOTE + 40, 0); // 11 - queue_midi_event(0x80, TEST_NOTE + 44, 0); // 12 + queue_midi_event(0x80, TEST_NOTE + 46, 0); // 12 queue_midi_event(0x80, TEST_NOTE + 49, 0); // 13 queue_midi_event(0x80, TEST_NOTE + 52, 0); // 14 queue_midi_event(0x80, TEST_NOTE + 57, 0); // 15 queue_midi_event(0x80, TEST_NOTE + 60, 0); // 16 - //bool success=true; - //bool success = load_sysex("ROM1A.SYX", (++_voice_counter)-1); - //bool success=load_sysex("ROM1B.SYX", (++_voice_counter)-1); - //bool success=load_sysex("RITCH01-32.SYX", (++_voice_counter)-1); - //bool success=load_sysex("RITCH33-64.SYX", (++_voice_counter)-1); - bool success = load_sysex(DEFAULT_SYSEXFILE, (++_voice_counter) - 1); + bool success = load_sysex(DEFAULT_SYSEXBANK, (++_voice_counter) - 1); if (success == false) Serial.println(F("E: Cannot load SYSEX data")); else diff --git a/config.h b/config.h index ba33875..12ae091 100644 --- a/config.h +++ b/config.h @@ -31,8 +31,8 @@ #define SERIAL_SPEED 38400 #define VOLUME 0.1 #define SAMPLE_RATE 44100 -#define DEXED_ENGINE DEXED_ENGINE_MODERN -//#define USE_ONBOARD_USB_HOST 1 +//#define DEXED_ENGINE DEXED_ENGINE_MODERN +#define USE_ONBOARD_USB_HOST 1 //#define SHOW_DEXED_TIMING 1 #define SHOW_MIDI_EVENT 1 #define SHOW_XRUN 1 @@ -47,6 +47,8 @@ #define MASTER_NUM1 24 // C1 #define MASTER_BANK_SELECT 83 // B5 +#define USE_TEENSY_DSP 1 + // Use these with the Teensy Audio Shield #define SDCARD_CS_PIN 10 #define SDCARD_MOSI_PIN 7 diff --git a/dexed.cpp b/dexed.cpp index 0894cf2..6f4a67c 100644 --- a/dexed.cpp +++ b/dexed.cpp @@ -34,6 +34,9 @@ #include "controllers.h" #include #include +#ifdef USE_TEENSY_DSP +#include +#endif extern uint8_t bank; extern bool load_sysex(uint8_t bank, uint8_t voice_number); @@ -140,7 +143,11 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer) for (uint8_t j = 0; j < _N_; ++j) { int32_t val = audiobuf.get()[j]; val = val >> 4; +#ifdef USE_TEENSY_DSP + int32_t clip_val=signed_saturate_rshift(32,24,9); +#else int32_t clip_val = val < -(1 << 24) ? 0x8000 : val >= (1 << 24) ? 0x7fff : val >> 9; +#endif float f = static_cast(clip_val >> 1) / 0x8000; if (f > 1) f = 1; if (f < -1) f = -1;