Several Fixes.

pull/112/head
Holger Wirtz 3 years ago
parent d2bb545e5d
commit 3b08955c43
  1. 17
      MicroDexed.ino
  2. 4
      UI.hpp
  3. 7
      config.h
  4. 184
      dexed_sd.cpp
  5. 1
      dexed_sd.h

@ -2612,6 +2612,23 @@ void set_voiceconfig_params(uint8_t instance_id)
mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
}
void set_epiano_params(void)
{
ep.setDecay(mapfloat(configuration.epiano.decay, EP_DECAY_MIN, EP_DECAY_MAX, 0, 1.0));
ep.setRelease(mapfloat(configuration.epiano.release, EP_RELEASE_MIN, EP_RELEASE_MAX, 0, 1.0));
ep.setHardness(mapfloat(configuration.epiano.hardness, EP_HARDNESS_MIN, EP_HARDNESS_MAX, 0, 1.0));
ep.setTreble(mapfloat(configuration.epiano.treble, EP_TREBLE_MIN, EP_TREBLE_MAX, 0, 1.0));
ep.setPanTremolo(mapfloat(configuration.epiano.pan_tremolo, EP_PAN_TREMOLO_MIN, EP_PAN_TREMOLO_MAX, 0, 1.0));
ep.setPanLFO(mapfloat(configuration.epiano.pan_lfo, EP_PAN_LFO_MIN, EP_PAN_LFO_MAX, 0, 1.0));
ep.setVelocitySense(mapfloat(configuration.epiano.velocity_sense, EP_VELOCITY_SENSE_MIN, EP_VELOCITY_SENSE_MAX, 0, 1.0));
ep.setStereo(mapfloat(configuration.epiano.stereo, EP_STEREO_MIN, EP_STEREO_MAX, 0, 1.0));
ep.setPolyphony(configuration.epiano.polyphony);
ep.setTune((configuration.epiano.tune - 100) / 100.0);
ep.setDetune(mapfloat(configuration.epiano.detune, EP_DETUNE_MIN, EP_DETUNE_MAX, 0, 1.0));
ep.setOverdrive(mapfloat(configuration.epiano.overdrive, EP_OVERDRIVE_MIN, EP_OVERDRIVE_MAX, 0, 1.0));
ep.setVolume(mapfloat(configuration.epiano.sound_intensity, EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX, 0, 1.0));
}
void set_sys_params(void)
{
// set initial volume

@ -2671,7 +2671,7 @@ void UI_func_epiano_stereo(uint8_t param)
}
lcd_display_bar_int("EPiano Stereo", configuration.epiano.stereo, 1.0, EP_STEREO_MIN, EP_STEREO_MAX, 3, false, false, false);
ep.setTreble(mapfloat(configuration.epiano.stereo, EP_STEREO_MIN, EP_STEREO_MAX, 0, 1.0));
ep.setStereo(mapfloat(configuration.epiano.stereo, EP_STEREO_MIN, EP_STEREO_MAX, 0, 1.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2964,7 +2964,7 @@ void UI_func_epiano_velocity_sense(uint8_t param)
}
lcd_display_bar_int("EPiano VelSense", configuration.epiano.velocity_sense, 1.0, EP_VELOCITY_SENSE_MIN, EP_VELOCITY_SENSE_MAX, 3, false, false, false);
ep.setOverdrive(mapfloat(configuration.epiano.velocity_sense, EP_VELOCITY_SENSE_MIN, EP_VELOCITY_SENSE_MAX, 0, 1.0));
ep.setVelocitySense(mapfloat(configuration.epiano.velocity_sense, EP_VELOCITY_SENSE_MIN, EP_VELOCITY_SENSE_MAX, 0, 1.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********

@ -338,6 +338,7 @@
#define FX_CONFIG_NAME "fx"
#define VOICE_CONFIG_NAME "voice"
#define SYS_CONFIG_NAME "sys"
#define EPIANO_CONFIG_NAME "epiano"
#define MAX_PERF_MOD 30
@ -349,7 +350,7 @@
#define SAVE_SYS_MS 5000
#define VOL_MAX_FLOAT 0.95
#define EEPROM_MARKER 0x4243
#define EEPROM_MARKER 0x4242
#ifndef NUM_DRUMS
#define NUM_DRUMS 0
@ -641,10 +642,6 @@
#define PERFORMANCE_NUM_MAX 99
#define PERFORMANCE_NUM_DEFAULT 0
#define FX_CONFIG_MIN 0
#define FX_CONFIG_MAX 99
#define FX_CONFIG_DEFAULT 0
#define VELOCITY_CONFIG_MIN 0
#define VELOCITY_CONFIG_MAX 99
#define VELOCITY_CONFIG_DEFAULT 0

@ -43,6 +43,7 @@ extern void init_MIDI_send_CC(void);
extern void check_configuration_dexed(uint8_t instance_id);
extern void check_configuration_performance(void);
extern void check_configuration_fx(void);
extern void check_configuration_epiano(void);
extern void sequencer();
extern sequencer_t seq;
#ifdef USE_SEQUENCER
@ -771,18 +772,18 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id)
/******************************************************************************
SD FX
******************************************************************************/
bool load_sd_fx_json(uint8_t fx)
bool load_sd_fx_json(uint8_t number)
{
fx = constrain(fx, FX_CONFIG_MIN, FX_CONFIG_MAX);
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
load_sd_drumsettings_json(fx);
load_sd_drumsettings_json(number);
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[CONFIG_FILENAME_LEN];
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, fx, FX_CONFIG_NAME);
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, FX_CONFIG_NAME);
// first check if file exists...
AudioNoInterrupts();
@ -839,6 +840,11 @@ bool load_sd_fx_json(uint8_t fx)
configuration.fx.eq_5 = data_json["eq_5"];
configuration.fx.eq_6 = data_json["eq_6"];
configuration.fx.eq_7 = data_json["eq_7"];
configuration.fx.ep_chorus_frequency = data_json["ep_chorus_frequency"];
configuration.fx.ep_chorus_waveform = data_json["ep_chorus_waveform"];
configuration.fx.ep_chorus_depth = data_json["ep_chorus_dept"];
configuration.fx.ep_chorus_level = data_json["ep_chorus_level"];
configuration.fx.ep_reverb_send = data_json["ep_reverb_send"];
check_configuration_fx();
set_fx_params();
@ -866,22 +872,22 @@ bool load_sd_fx_json(uint8_t fx)
return (false);
}
bool save_sd_fx_json(uint8_t fx)
bool save_sd_fx_json(uint8_t number)
{
char filename[CONFIG_FILENAME_LEN];
fx = constrain(fx, FX_CONFIG_MIN, FX_CONFIG_MAX);
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
save_sd_drumsettings_json(fx);
save_sd_drumsettings_json(number);
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, fx, FX_CONFIG_NAME);
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, FX_CONFIG_NAME);
#ifdef DEBUG
Serial.print(F("Saving fx config "));
Serial.print(fx);
Serial.print(number);
Serial.print(F(" to "));
Serial.println(filename);
#endif
@ -920,6 +926,163 @@ bool save_sd_fx_json(uint8_t fx)
data_json["eq_5"] = configuration.fx.eq_5;
data_json["eq_6"] = configuration.fx.eq_6;
data_json["eq_7"] = configuration.fx.eq_7;
data_json["ep_chorus_frequency"] = configuration.fx.ep_chorus_frequency;
data_json["ep_chorus_waveform"] = configuration.fx.ep_chorus_waveform;
data_json["ep_chorus_dept"] = configuration.fx.ep_chorus_depth;
data_json["ep_chorus_level"] = configuration.fx.ep_chorus_level;
data_json["ep_reverb_send"] = configuration.fx.ep_reverb_send;
#ifdef DEBUG
Serial.println(F("Write JSON data:"));
serializeJsonPretty(data_json, Serial);
Serial.println();
#endif
serializeJsonPretty(data_json, json);
json.close();
AudioInterrupts();
return (true);
}
json.close();
}
else
{
#ifdef DEBUG
Serial.print(F("E : Cannot open "));
Serial.print(filename);
Serial.println(F(" on SD."));
#endif
}
AudioInterrupts();
return (false);
}
/******************************************************************************
SD EPIANO
******************************************************************************/
bool load_sd_epiano_json(uint8_t number)
{
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[CONFIG_FILENAME_LEN];
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, EPIANO_CONFIG_NAME);
// first check if file exists...
AudioNoInterrupts();
if (SD.exists(filename))
{
// ... and if: load
#ifdef DEBUG
Serial.print(F("Found epiano configuration ["));
Serial.print(filename);
Serial.println(F("]... loading..."));
#endif
json = SD.open(filename);
if (json)
{
deserializeJson(data_json, json);
json.close();
AudioInterrupts();
#ifdef DEBUG
Serial.println(F("Read JSON data:"));
serializeJsonPretty(data_json, Serial);
Serial.println();
#endif
configuration.epiano.decay = data_json["decay"];
configuration.epiano.release = data_json["release"];
configuration.epiano.hardness = data_json["hardness"];
configuration.epiano.treble = data_json["trebl"];
configuration.epiano.pan_tremolo = data_json["pan_tremolo"];
configuration.epiano.pan_lfo = data_json["pan_lf"];
configuration.epiano.velocity_sense = data_json["velocity"];
configuration.epiano.stereo = data_json["stereo"];
configuration.epiano.polyphony = data_json["polyphony"];
configuration.epiano.tune = data_json["tune"];
configuration.epiano.detune = data_json["detune"];
configuration.epiano.overdrive = data_json["overdrive"];
configuration.epiano.lowest_note = data_json["lowest_note"];
configuration.epiano.highest_note = data_json["highest_note"];
configuration.epiano.transpose = data_json["transpo"];
configuration.epiano.sound_intensity = data_json["sound_int"];
configuration.epiano.pan = data_json["pa"];
configuration.epiano.midi_channel = data_json["midi_ch"];
check_configuration_epiano();
set_epiano_params();
return (true);
}
#ifdef DEBUG
else
{
Serial.print(F("E : Cannot open "));
Serial.print(filename);
Serial.println(F(" on SD."));
}
}
else
{
Serial.print(F("No "));
Serial.print(filename);
Serial.println(F(" available."));
#endif
}
}
AudioInterrupts();
return (false);
}
bool save_sd_epiano_json(uint8_t number)
{
char filename[CONFIG_FILENAME_LEN];
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, EPIANO_CONFIG_NAME);
#ifdef DEBUG
Serial.print(F("Saving epiano config "));
Serial.print(number);
Serial.print(F(" to "));
Serial.println(filename);
#endif
AudioNoInterrupts();
SD.begin();
SD.remove(filename);
json = SD.open(filename, FILE_WRITE);
if (json)
{
data_json["decay"] = configuration.epiano.decay;
data_json["release"] = configuration.epiano.release;
data_json["hardness"] = configuration.epiano.hardness;
data_json["treble"] = configuration.epiano.treble;
data_json["pan_tremolo"] = configuration.epiano.pan_tremolo;
data_json["pan_lfo"] = configuration.epiano.pan_lfo;
data_json["velocity_sense"] = configuration.epiano.velocity_sense;
data_json["stereo"] = configuration.epiano.stereo;
data_json["polyphony"] = configuration.epiano.polyphony;
data_json["tune"] = configuration.epiano.tune;
data_json["detune"] = configuration.epiano.detune;
data_json["overdrive"] = configuration.epiano.overdrive;
data_json["lowest_note"] = configuration.epiano.lowest_note;
data_json["highest_note"] = configuration.epiano.highest_note;
data_json["transpose"] = configuration.epiano.transpose;
data_json["sound_intensity"] = configuration.epiano.sound_intensity;
data_json["pan"] = configuration.epiano.pan;
data_json["midi_channel"] = configuration.epiano.midi_channel;
#ifdef DEBUG
Serial.println(F("Write JSON data:"));
serializeJsonPretty(data_json, Serial);
@ -1205,6 +1368,8 @@ bool save_sd_performance_json(uint8_t seq_number)
#endif
save_sd_fx_json(seq_number);
save_sd_epiano_json(seq_number);
for (uint8_t i = 0; i < MAX_DEXED; i++)
{
sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, seq_number, VOICE_CONFIG_NAME, i);
@ -1533,6 +1698,7 @@ bool load_sd_performance_json(uint8_t seq_number)
load_sd_seq_sub_patterns_json(seq_number);
load_sd_seq_sub_vel_json(seq_number);
load_sd_fx_json(seq_number);
load_sd_epiano_json(seq_number);
if (sd_card > 0)
{

@ -44,6 +44,7 @@ extern uint32_t crc32(byte * calc_start, uint16_t calc_bytes);
extern void set_fx_params(void);
extern void set_voiceconfig_params(uint8_t instance_id);
extern void set_sys_params(void);
extern void set_epiano_params(void);
bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id);
bool save_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id);

Loading…
Cancel
Save