From 5ed8f5ee236146dc00b439af5a7a2b3bd991804b Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Wed, 19 Feb 2020 14:13:25 +0100 Subject: [PATCH] Disabled CPU_OVERLOAD_THROTTLE. Small fixes. --- MicroDexed.ino | 29 +++++++++++++++++++---------- config.h | 6 +++--- dexed.cpp | 2 +- dexed_sysex.cpp | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index b6abc49..67c64b9 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -258,7 +258,7 @@ void setup() pinMode(U8X8_CS_PIN, OUTPUT); #endif - delay(320); // necessary, because before this time no serial output is done :( + delay(320); // necessary, because before no serial output is done :( #ifdef ENABLE_LCD_UI setup_ui(); @@ -271,6 +271,9 @@ void setup() Serial.println(F("https://codeberg.org/dcoredump/MicroDexed")); Serial.print(F("Version: ")); Serial.println(VERSION); + Serial.print(F("CPU-Speed: ")); + Serial.print(F_CPU / 1000000.0, 1); + Serial.println(F(" MHz")); Serial.println(F("")); Serial.flush(); @@ -296,8 +299,9 @@ void setup() } } - // Init EEPROM if both buttons are pressed at startup - /* if (digitalRead(BUT_R_PIN) == LOW) + /* + // Init EEPROM if both buttons are pressed at startup + if (digitalRead(BUT_R_PIN) == HIGH && digitalRead(BUT_L_PIN) == HIGH) { Serial.println(F("Init EEPROM")); lcd.clear(); @@ -306,9 +310,10 @@ void setup() lcd.setCursor(0, 1); lcd.print(F("EEPROM")); initial_values_from_eeprom(true); + delay(2000); } else - initial_values_from_eeprom(false); */ + */ initial_values_from_eeprom(false); #if defined(TEENSY_AUDIO_BOARD) @@ -650,7 +655,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) { if (checkMidiChannel(inChannel, instance_id)) { - if (inNumber >= configuration.dexed[instance_id].note_start && inNumber <= configuration.dexed[instance_id].note_end) + if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note) MicroDexed[instance_id]->keydown(inNumber, inVelocity); } } @@ -662,7 +667,8 @@ void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity) { if (checkMidiChannel(inChannel, instance_id)) { - MicroDexed[instance_id]->keyup(inNumber); + if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note) + MicroDexed[instance_id]->keyup(inNumber); } } } @@ -1408,8 +1414,8 @@ void init_configuration(void) configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL; configuration.dexed[instance_id].bank = SYSEXBANK_DEFAULT; configuration.dexed[instance_id].voice = SYSEXSOUND_DEFAULT; - configuration.dexed[instance_id].note_start = INSTANCE_NOTE_START_DEFAULT; - configuration.dexed[instance_id].note_end = INSTANCE_NOTE_END_DEFAULT; + configuration.dexed[instance_id].lowest_note = INSTANCE_LOWEST_NOTE_MIN; + configuration.dexed[instance_id].highest_note = INSTANCE_HIGHEST_NOTE_MAX; configuration.dexed[instance_id].reverb_send = REVERB_SEND_DEFAULT; configuration.dexed[instance_id].chorus_send = CHORUS_SEND_DEFAULT; configuration.dexed[instance_id].delay_send = DELAY_SEND_DEFAULT; @@ -1615,7 +1621,7 @@ void show_configuration(void) Serial.print(F("Chorus Level ")); Serial.println(configuration.chorus_level, DEC); Serial.print(F("Delay Time ")); Serial.println(configuration.delay_time, DEC); Serial.print(F("Delay Feedback ")); Serial.println(configuration.delay_feedback, DEC); - Serial.print(F("Delay Level ")); Serial.println(configuration.delay_level, DEC); + Serial.print(F("Delay Level ")); Serial.println(configuration.delay_level, DEC); Serial.flush(); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { @@ -1625,12 +1631,14 @@ void show_configuration(void) Serial.print(F(" MIDI-Channel ")); Serial.println(configuration.dexed[instance_id].midi_channel, DEC); Serial.print(F(" Bank ")); Serial.println(configuration.dexed[instance_id].bank, DEC); Serial.print(F(" Voice ")); Serial.println(configuration.dexed[instance_id].voice, DEC); + Serial.print(F(" Lowest Note ")); Serial.println(configuration.dexed[instance_id].lowest_note, DEC); + Serial.print(F(" Highest Note ")); Serial.println(configuration.dexed[instance_id].highest_note, DEC); Serial.print(F(" Reverb Send ")); Serial.println(configuration.dexed[instance_id].reverb_send, DEC); Serial.print(F(" Chorus Send ")); Serial.println(configuration.dexed[instance_id].chorus_send, DEC); Serial.print(F(" Delay Send ")); Serial.println(configuration.dexed[instance_id].delay_send, DEC); Serial.print(F(" Filter Cutoff ")); Serial.println(configuration.dexed[instance_id].filter_cutoff, DEC); Serial.print(F(" Filter Resonance ")); Serial.println(configuration.dexed[instance_id].filter_resonance, DEC); - Serial.print(F(" Loudness ")); Serial.println(configuration.dexed[instance_id].sound_intensity, DEC); + Serial.print(F(" Sound Intensity ")); Serial.println(configuration.dexed[instance_id].sound_intensity, DEC); Serial.print(F(" Panorama ")); Serial.println(configuration.dexed[instance_id].pan, DEC); Serial.print(F(" Transpose ")); Serial.println(configuration.dexed[instance_id].transpose, DEC); Serial.print(F(" Tune ")); Serial.println(configuration.dexed[instance_id].tune, DEC); @@ -1646,6 +1654,7 @@ void show_configuration(void) Serial.print(F(" BreathCtrl Range ")); Serial.println(configuration.dexed[instance_id].bc_range, DEC); Serial.print(F(" Breathctrl Assign ")); Serial.println(configuration.dexed[instance_id].bc_assign, DEC); Serial.print(F(" Aftertouch Range ")); Serial.println(configuration.dexed[instance_id].at_range, DEC); + Serial.print(F(" Aftertouch Assign ")); Serial.println(configuration.dexed[instance_id].at_range, DEC); Serial.print(F(" Portamento Mode ")); Serial.println(configuration.dexed[instance_id].portamento_mode, DEC); Serial.print(F(" Portamento Glissando ")); Serial.println(configuration.dexed[instance_id].portamento_glissando, DEC); Serial.print(F(" Portamento Time ")); Serial.println(configuration.dexed[instance_id].portamento_time, DEC); diff --git a/config.h b/config.h index 2b78611..8ea1d12 100644 --- a/config.h +++ b/config.h @@ -37,6 +37,7 @@ // 2. Build the firmware with "MIDI_DEVICE_USB" enabled in config.h. // 3. Afterconnecting to a Linux system there should be a MIDI an audio device available that is called "MicroMDexed", so you can start the following: // $ aplaymidi -p 20:0 # e.g. test.mid +// $ vkeybd --addr 20:0 // $ arecord -f cd -Dhw:1,0 /tmp/.wav // @@ -167,7 +168,7 @@ //#define SDCARD_SCK_PIN 14 #ifndef TEENSY4 // Teensy 3.5 & 3.6 SD card -#define SDCARD_CS_PIN 4 //BUILTIN_SDCARD +#define SDCARD_CS_PIN BUILTIN_SDCARD #define SDCARD_MOSI_PIN 11 #define SDCARD_SCK_PIN 13 #else @@ -212,7 +213,7 @@ #define NUM_DEXED 1 #define MAX_DEXED 2 #define NORMALIZE_DX_VELOCITY 1 -#define CPU_OVERLOAD_THROTTLE 95.0 // Level (in percent) when throttling should start +//#define CPU_OVERLOAD_THROTTLE 95.0 // Level (in percent) when throttling should start #define CPU_OVERLOAD_THROTTLE_TIMER 100 // timer (in ms) when next throttling is possible enum { DEXED, CHORUS, DELAY, REVERB}; @@ -446,7 +447,6 @@ enum { DEXED, CHORUS, DELAY, REVERB}; #define INSTANCE_NOTE_START_MAX MIDI_B7 #define INSTANCE_NOTE_START_DEFAULT INSTANCE_NOTE_START_MIN -======= #define INSTANCE_NOTE_END_MIN MIDI_AIS0 #define INSTANCE_NOTE_END_MAX MIDI_B7 #define INSTANCE_NOTE_END_DEFAULT INSTANCE_NOTE_END_MAX diff --git a/dexed.cpp b/dexed.cpp index 2b931e2..fa2d2de 100644 --- a/dexed.cpp +++ b/dexed.cpp @@ -190,7 +190,7 @@ void Dexed::keydown(int16_t pitch, uint8_t velo) { pitch += data[144] - TRANSPOSE_FIX; #if defined(NORMALIZE_DX_VELOCITY) - velo = ((float)velo) * 0.7874015; // 100/127 + velo = (((float)velo) * 0.7874015 + 0.5); // 100/127 #endif int previousKeyDown = lastKeyDown; diff --git a/dexed_sysex.cpp b/dexed_sysex.cpp index 0749f04..20016ad 100644 --- a/dexed_sysex.cpp +++ b/dexed_sysex.cpp @@ -531,7 +531,7 @@ bool save_sysex_setup(uint8_t b, uint8_t v, config_t configuration) create_sysex_filename(b, sysex_file_name, v); - sysex = SD.create(sysex_file_name); + sysex = SD.open(sysex_file_name); if (!sysex) { #ifdef DEBUG