From 7276815bab2cb5f61b4e5c696527b48583bb9180 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 17 Mar 2020 14:21:49 +0100 Subject: [PATCH] Several fixes. Moced velocity level code out of the Dexed class. --- MicroDexed.ino | 12 +++++------- UI.hpp | 1 - config.h | 4 ++-- dexed.cpp | 13 ------------- dexed.h | 3 --- 5 files changed, 7 insertions(+), 26 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 5bdc3b2..a41cf69 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -336,18 +336,17 @@ void setup() //sgtl5000_1.dacVolumeRampDisable(); sgtl5000_1.unmuteHeadphone(); sgtl5000_1.unmuteLineout(); - sgtl5000_1.autoVolumeDisable(); // turn off AGC sgtl5000_1.volume(0.5, 0.5); // Headphone volume - sgtl5000_1.audioPostProcessorEnable(); + //sgtl5000_1.audioPostProcessorEnable(); sgtl5000_1.autoVolumeControl(1, 1, 1, 0.9, 0.01, 0.05); //sgtl5000_1.autoVolumeEnable(); sgtl5000_1.autoVolumeDisable(); //sgtl5000_1.surroundSoundEnable(); sgtl5000_1.surroundSoundDisable(); - sgtl5000_1.surroundSound(7, 2); // Configures virtual surround width from 0 (mono) to 7 (widest). select may be set to 1 (disable), 2 (mono input) or 3 (stereo input). + //sgtl5000_1.surroundSound(7, 2); // Configures virtual surround width from 0 (mono) to 7 (widest). select may be set to 1 (disable), 2 (mono input) or 3 (stereo input). //sgtl5000_1.enhanceBassEnable(); sgtl5000_1.enhanceBassDisable(); - sgtl5000_1.enhanceBass(1.0, 0.2, 1, 2); // Configures the bass enhancement by setting the levels of the original stereo signal and the bass-enhanced mono level which will be mixed together. The high-pass filter may be enabled (0) or bypassed (1). + //sgtl5000_1.enhanceBass(1.0, 0.2, 1, 2); // Configures the bass enhancement by setting the levels of the original stereo signal and the bass-enhanced mono level which will be mixed together. The high-pass filter may be enabled (0) or bypassed (1). /* The cutoff frequency is specified as follows: value frequency 0 80Hz @@ -697,7 +696,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) if (checkMidiChannel(inChannel, instance_id)) { if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note) - MicroDexed[instance_id]->keydown(inNumber, inVelocity); + MicroDexed[instance_id]->keydown(inNumber, uint8_t(float(configuration.dexed[instance_id].velocity_level / 127.0)*inVelocity + 0.5)); } } } @@ -1346,7 +1345,6 @@ void initial_values_from_eeprom(bool init) MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign); MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled); MicroDexed[instance_id]->doRefreshVoice(); - MicroDexed[instance_id]->setVelocityLevel(configuration.dexed[instance_id].velocity_level); #if defined(USE_FX) chorus_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].chorus_send / 100.0); @@ -1559,7 +1557,7 @@ uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https:/ void generate_version_string(char* buffer, uint8_t len) { char tmp[3]; - strncat(&buffer[0], VERSION, len); + strncat(buffer, VERSION, len); #if defined(TEENSY3_5) strncat(buffer, "-3.5", 4); #elif defined(TEENSY3_6) diff --git a/UI.hpp b/UI.hpp index 5bbeb62..44aac80 100644 --- a/UI.hpp +++ b/UI.hpp @@ -3028,7 +3028,6 @@ void UI_func_velocity_level(uint8_t param) } } - MicroDexed[instance_id]->setVelocityLevel(configuration.dexed[instance_id].velocity_level); lcd_display_bar_int("Velocity Lvl", configuration.dexed[instance_id].velocity_level, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX, 3, false, false, false, false); } diff --git a/config.h b/config.h index 5397f7f..d04f036 100644 --- a/config.h +++ b/config.h @@ -85,7 +85,7 @@ #define MOD_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT #define MOD_FILTER_CUTOFF_HZ 3000 // FX-CHAIN ENABLE/DISABLE -//#define USE_FX 1 +#define USE_FX 1 //************************************************************************************************* //* AUDIO SOFTWARE SETTINGS @@ -217,7 +217,7 @@ #define AUTOSTORE_MS 5000 // EEPROM address -#define EEPROM_START_ADDRESS 100 +#define EEPROM_START_ADDRESS 0xFF #define MAX_BANKS 100 #define MAX_VOICES 32 // voices per bank diff --git a/dexed.cpp b/dexed.cpp index da2a8d0..e764b4b 100644 --- a/dexed.cpp +++ b/dexed.cpp @@ -83,8 +83,6 @@ Dexed::Dexed(int rate) sustain = false; - velocity_level = (100.0 / 127.0); - setEngineType(DEXED_ENGINE); } @@ -170,7 +168,6 @@ void Dexed::keydown(int16_t pitch, uint8_t velo) { } pitch += data[144] - TRANSPOSE_FIX; - velo = float(velo) * velocity_level + 0.5; // 100/127 int previousKeyDown = lastKeyDown; lastKeyDown = pitch; @@ -730,13 +727,3 @@ void Dexed::setPortamentoMode(uint8_t portamento_mode, uint8_t portamento_glissa controllers.refresh(); } - -void Dexed::setVelocityLevel(uint8_t velocity_level) -{ - velocity_level = float(velocity_level) / 127.0; -} - -float Dexed::getVelocityLevel(void) -{ - return (velocity_level); -} diff --git a/dexed.h b/dexed.h index 77fb005..c481635 100644 --- a/dexed.h +++ b/dexed.h @@ -172,8 +172,6 @@ class Dexed void setBCController(uint8_t bc_range, uint8_t bc_assign); void setATController(uint8_t at_range, uint8_t pb_assign); void setPortamentoMode(uint8_t portamento_mode, uint8_t portamento_glissando, uint8_t portamento_time); - void setVelocityLevel(uint8_t velocity_level); - float getVelocityLevel(void); ProcessorVoice voices[MAX_NOTES]; Controllers controllers; @@ -209,7 +207,6 @@ class Dexed FmCore* engineMsfa; EngineMkI* engineMkI; EngineOpl* engineOpl; - float velocity_level; }; #endif // PLUGINPROCESSOR_H_INCLUDED