From 4219e0985486b02ea42044968f58973a35ca3fc1 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 13 Mar 2020 13:40:26 +0100 Subject: [PATCH] Small fixes for audio output level. Debug output of voice data now with a better format. --- MicroDexed.ino | 188 +++++++++++++++++++++++++++---------------------- UI.hpp | 2 +- config.h | 5 +- 3 files changed, 107 insertions(+), 88 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 0d5a8a1..240b463 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -473,7 +473,7 @@ void setup() chorus_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 1.0)); // DEXED FILTER - //MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX/100.0); + //MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX); MicroDexed[instance_id]->fx.Gain = 1.0; MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0); MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0); @@ -481,7 +481,7 @@ void setup() #endif // Dexed output level - dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX / 100.0)); + dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); // PANORAMA mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); @@ -739,9 +739,9 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) #endif configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 0x7f, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); #ifdef USE_FX - MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX / 100.0); + MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX); #else - dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX / 100.0)); + dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); #endif eeprom_write(); break; @@ -1325,7 +1325,7 @@ void initial_values_from_eeprom(bool init) MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0); #endif MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled); - dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX / 100.0)); + dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); } } Serial.println(F("OK, loaded!")); @@ -1664,98 +1664,116 @@ void show_configuration(void) void show_patch(uint8_t instance_id) { - uint8_t i; char voicename[VOICE_NAME_LEN]; Serial.print(F("INSTANCE ")); Serial.println(instance_id, DEC); memset(voicename, 0, sizeof(voicename)); - for (i = 0; i < 6; i++) + Serial.println(F("+==========================================================================================================+")); + for (int8_t i = 5; i >= 0; --i) { - Serial.print(F("OP")); + Serial.println(F("+==========================================================================================================+")); + Serial.print(F("| OP")); Serial.print(6 - i, DEC); - Serial.println(F(": ")); - Serial.println(F("R1 | R2 | R3 | R4 | L1 | L2 | L3 | L4 LEV_SCL_BRK_PT | SCL_LEFT_DEPTH | SCL_RGHT_DEPTH")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R1], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R2], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R3], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R4], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L1], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L2], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L3], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L4], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_LEV_SCL_BRK_PT], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_LEFT_DEPTH], DEC); - Serial.print(F(" ")); - Serial.println(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_RGHT_DEPTH], DEC); - Serial.println(F("SCL_L_CURVE | SCL_R_CURVE | RT_SCALE | AMS | KVS | OUT_LEV | OP_MOD | FRQ_C | FRQ_F | DETUNE")); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_LEFT_CURVE], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_RGHT_CURVE], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OSC_RATE_SCALE], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_AMP_MOD_SENS], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_KEY_VEL_SENS], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OUTPUT_LEV], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OSC_MODE], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_FREQ_COARSE], DEC); - Serial.print(F(" ")); - Serial.print(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_FREQ_FINE], DEC); - Serial.print(F(" ")); - Serial.println(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OSC_DETUNE], DEC); - Serial.flush(); + Serial.println(F(" |")); + Serial.println(F("+======+======+======+======+======+======+======+======+================+================+================+")); + Serial.println(F("| R1 | R2 | R3 | R4 | L1 | L2 | L3 | L4 | LEV_SCL_BRK_PT | SCL_LEFT_DEPTH | SCL_RGHT_DEPTH |")); + Serial.println(F("+------+------+------+------+------+------+------+------+----------------+----------------+----------------+")); + Serial.print("| "); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R1]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R2]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R3]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R4]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L1]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L2]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L3]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L4]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_LEV_SCL_BRK_PT]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_LEFT_DEPTH]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_RGHT_DEPTH]); + Serial.println(F(" |")); + Serial.println(F("+======+======+======+======+======+===+==+==+===+======+====+========+==+====+=======+===+================+")); + Serial.println(F("| SCL_L_CURVE | SCL_R_CURVE | RT_SCALE | AMS | KVS | OUT_LEV | OP_MOD | FRQ_C | FRQ_F | DETUNE |")); + Serial.println(F("+-------------+-------------+----------+-----+-----+---------+--------+-------+-------+--------------------+")); + Serial.print(F("| ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_LEFT_CURVE]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_RGHT_CURVE]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OSC_RATE_SCALE]); + Serial.print(F(" |")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_AMP_MOD_SENS]); + Serial.print(F(" |")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_KEY_VEL_SENS]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OUTPUT_LEV]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OSC_MODE]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_FREQ_COARSE]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_FREQ_FINE]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OSC_DETUNE]); + Serial.println(F(" |")); } - Serial.println(F("PR1 | PR2 | PR3 | PR4 | PL1 | PL2 | PL3 | PL4")); - Serial.print(F(" ")); - for (i = 0; i < 8; i++) + Serial.println(F("+=======+=====+=+=======+===+===+======++====+==+==+====+====+==+======+======+=====+=+====================+")); + Serial.println(F("| PR1 | PR2 | PR3 | PR4 | PL1 | PL2 | PL3 | PL4 | ALG | FB | OKS | TRANSPOSE |")); + Serial.println(F("+-------+-------+-------+-------+-------+-------+-------+-------+------+------+-----+----------------------+")); + Serial.print(F("| ")); + for (int8_t i = 0; i < 8; i++) { - Serial.print(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + i], DEC); - Serial.print(F(" ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + i]); + Serial.print(F(" | ")); } - Serial.println(); - Serial.print(F("ALG: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_ALGORITHM], DEC); - Serial.print(F("FB: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_FEEDBACK], DEC); - Serial.print(F("OKS: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC], DEC); - Serial.print(F("LFO SPD: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED], DEC); - Serial.print(F("LFO_DLY: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_DELAY], DEC); - Serial.print(F("LFO PMD: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP], DEC); - Serial.print(F("LFO_AMD: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP], DEC); - Serial.print(F("LFO_SYNC: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_SYNC], DEC); - Serial.print(F("LFO_WAVEFRM: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_WAVE], DEC); - Serial.print(F("LFO_PMS: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS], DEC); - Serial.print(F("TRNSPSE: ")); - Serial.println(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE], DEC); - Serial.print(F("NAME: ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_ALGORITHM]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_FEEDBACK]); + Serial.print(F(" |")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE]); + Serial.println(F(" |")); + Serial.println(F("+=======+=+=====+===+===+=====+=+=======+=======+==+====+=====+=+======++=====+=====+======================+")); + Serial.println(F("| LFO SPD | LFO DLY | LFO PMD | LFO AMD | LFO SYNC | LFO WAVE | LFO PMS | NAME |")); + Serial.println(F("+---------+---------+---------+---------+----------+----------+---------+----------------------------------+")); + Serial.print(F("| ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_DELAY]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_SYNC]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_WAVE]); + Serial.print(F(" | ")); + SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS]); + Serial.print(F(" | ")); strncpy(voicename, (char *)&MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_NAME], sizeof(voicename) - 1); - Serial.print(F("[")); Serial.print(voicename); - Serial.println(F("]")); - Serial.flush(); + Serial.println(F(" |")); + Serial.println(F("+=========+=========+=========+=========+==========+==========+=========+==================================+")); + Serial.println(F("+==========================================================================================================+")); +} + +void SerialPrintFormatInt3(uint8_t num) +{ + char buf[4]; + sprintf(buf, "%3d", num); + Serial.print(buf); } #endif diff --git a/UI.hpp b/UI.hpp index 3a3896a..786bedf 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1713,7 +1713,7 @@ void UI_func_sound_intensity(uint8_t param) } //MicroDexed[instance_id]->fx.Gain = configuration.dexed[instance_id].sound_intensity / 100.0; - dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX / 100.0)); + dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); } lcd_display_bar_int("Sound Intens.", configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false, false); diff --git a/config.h b/config.h index 54047b2..1bcf45a 100644 --- a/config.h +++ b/config.h @@ -387,8 +387,9 @@ enum { DEXED, CHORUS, DELAY, REVERB}; #define TUNE_DEFAULT 100 #define SOUND_INTENSITY_MIN 0 -#define SOUND_INTENSITY_MAX 255 -#define SOUND_INTENSITY_DEFAULT 100 +#define SOUND_INTENSITY_MAX 100 +#define SOUND_INTENSITY_DEFAULT 50 +#define SOUND_INTENSITY_AMP_MAX 3.0 #define POLYPHONY_MIN 1 #define POLYPHONY_MAX MAX_NOTES