pull/44/head
Holger Wirtz 3 years ago
parent e7cb6d1eb0
commit e42232a9d5
  1. 140
      MicroDexed.ino
  2. 18
      UI.hpp
  3. 16
      dexed_sd.cpp
  4. 507
      third-party/Synth_Dexed/src/synth_dexed.cpp
  5. 246
      third-party/Synth_Dexed/src/synth_dexed.h

@ -176,7 +176,7 @@ AudioConnection * dynamicConnections[NUM_DEXED * 5];
#endif
void create_audio_engine_chain(uint8_t instance_id)
{
MicroDexed[instance_id] = new AudioSynthDexed(SAMPLE_RATE);
MicroDexed[instance_id] = new AudioSynthDexed(MAX_VOICES,SAMPLE_RATE);
mono2stereo[instance_id] = new AudioEffectMonoStereo();
#if defined(USE_FX)
chorus_modulator[instance_id] = new AudioSynthWaveform();
@ -722,22 +722,22 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
#ifdef DEBUG
Serial.println(F("MODWHEEL CC"));
#endif
MicroDexed[instance_id]->controllers.modwheel_cc = inValue;
MicroDexed[instance_id]->controllers.refresh();
MicroDexed[instance_id]->setModWheel(inValue);
MicroDexed[instance_id]->ControllersRefresh();
break;
case 2:
#ifdef DEBUG
Serial.println(F("BREATH CC"));
#endif
MicroDexed[instance_id]->controllers.breath_cc = inValue;
MicroDexed[instance_id]->controllers.refresh();
MicroDexed[instance_id]->setBreathController(inValue);
MicroDexed[instance_id]->ControllersRefresh();
break;
case 4:
#ifdef DEBUG
Serial.println(F("FOOT CC"));
#endif
MicroDexed[instance_id]->controllers.foot_cc = inValue;
MicroDexed[instance_id]->controllers.refresh();
MicroDexed[instance_id]->setFootController(inValue);
MicroDexed[instance_id]->ControllersRefresh();
break;
case 5: // Portamento time
configuration.dexed[instance_id].portamento_time = inValue;
@ -748,7 +748,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
Serial.println(F("VOLUME CC"));
#endif
configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 0x7f, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX);
MicroDexed[instance_id]->fx.Gain = pseudo_log_curve(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX));
MicroDexed[instance_id]->setGain(pseudo_log_curve(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)));
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sound_intensity))
{
LCDML.OTHER_updateFunc();
@ -803,7 +803,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
break;
case 94: // CC 94: (de)tune
configuration.dexed[selected_instance_id].tune = map(inValue, 0, 0x7f, TUNE_MIN, TUNE_MAX);
MicroDexed[selected_instance_id]->controllers.masterTune = (int((configuration.dexed[selected_instance_id].tune - 100) / 100.0 * 0x4000) << 11) * (1.0 / 12);
MicroDexed[selected_instance_id]->setMasterTune((int((configuration.dexed[selected_instance_id].tune - 100) / 100.0 * 0x4000) << 11) * (1.0 / 12));
MicroDexed[selected_instance_id]->doRefreshVoice();
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_tune))
{
@ -833,7 +833,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
break;
case 103: // CC 103: filter resonance
configuration.fx.filter_resonance[instance_id] = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX);
MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.fx.filter_resonance[instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0);
MicroDexed[instance_id]->setFilterResonance(mapfloat(configuration.fx.filter_resonance[instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0));
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_filter_resonance))
{
LCDML.OTHER_updateFunc();
@ -842,7 +842,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
break;
case 104: // CC 104: filter cutoff
configuration.fx.filter_cutoff[instance_id] = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX);
MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.fx.filter_cutoff[instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
MicroDexed[instance_id]->setFilterCutoff(mapfloat(configuration.fx.filter_cutoff[instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0));;
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_filter_cutoff))
{
LCDML.OTHER_updateFunc();
@ -909,8 +909,8 @@ void handleAfterTouch(byte inChannel, byte inPressure)
{
if (checkMidiChannel(inChannel, instance_id))
{
MicroDexed[instance_id]->controllers.aftertouch_cc = inPressure;
MicroDexed[instance_id]->controllers.refresh();
MicroDexed[instance_id]->setAftertouch(inPressure);
MicroDexed[instance_id]->ControllersRefresh();
}
}
}
@ -921,7 +921,7 @@ void handlePitchBend(byte inChannel, int inPitch)
{
if (checkMidiChannel(inChannel, instance_id))
{
MicroDexed[instance_id]->controllers.values_[kControllerPitch] = inPitch + 0x2000; // -8192 to +8191 --> 0 to 16383
MicroDexed[instance_id]->setPitchbend(inPitch);
}
}
}
@ -1035,7 +1035,7 @@ void handleSystemExclusive(byte * sysex, uint len)
Serial.print(" Value: ");
Serial.println(sysex[5], DEC);
#endif
MicroDexed[instance_id]->data[sysex[4] + ((sysex[3] & 0x03) * 128)] = sysex[5];
MicroDexed[instance_id]->setVoiceDataElement(sysex[4] + ((sysex[3] & 0x03) * 128), sysex[5]);
}
else if ((sysex[3] & 0x7c) >> 2 == 2)
{
@ -1050,7 +1050,7 @@ void handleSystemExclusive(byte * sysex, uint len)
{
case 65:
configuration.dexed[instance_id].pb_range = constrain(sysex[5], PB_RANGE_MIN, PB_RANGE_MAX);
MicroDexed[instance_id]->controllers.values_[kControllerPitchRange] = configuration.dexed[instance_id].pb_range;
MicroDexed[instance_id]->setPitchbendRange(configuration.dexed[instance_id].pb_range);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_pb_range))
{
LCDML.OTHER_updateFunc();
@ -1059,7 +1059,7 @@ void handleSystemExclusive(byte * sysex, uint len)
break;
case 66:
configuration.dexed[instance_id].pb_step = constrain(sysex[5], PB_STEP_MIN, PB_STEP_MAX);
MicroDexed[instance_id]->controllers.values_[kControllerPitchStep] = configuration.dexed[instance_id].pb_step;
MicroDexed[instance_id]->setPitchbendRange(configuration.dexed[instance_id].pb_step);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_pb_step))
{
LCDML.OTHER_updateFunc();
@ -1095,7 +1095,7 @@ void handleSystemExclusive(byte * sysex, uint len)
break;
case 70:
configuration.dexed[instance_id].mw_range = constrain(sysex[5], MW_RANGE_MIN, MW_RANGE_MAX);
MicroDexed[instance_id]->controllers.wheel.setRange(configuration.dexed[instance_id].mw_range);
MicroDexed[instance_id]->setModWheelRange(configuration.dexed[instance_id].mw_range);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_mw_range))
{
LCDML.OTHER_updateFunc();
@ -1104,7 +1104,7 @@ void handleSystemExclusive(byte * sysex, uint len)
break;
case 71:
configuration.dexed[instance_id].mw_assign = constrain(sysex[5], MW_ASSIGN_MIN, MW_ASSIGN_MAX);
MicroDexed[instance_id]->controllers.wheel.setTarget(configuration.dexed[instance_id].mw_assign);
MicroDexed[instance_id]->setModWheelTarget(configuration.dexed[instance_id].mw_assign);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_mw_assign))
{
LCDML.OTHER_updateFunc();
@ -1113,7 +1113,7 @@ void handleSystemExclusive(byte * sysex, uint len)
break;
case 72:
configuration.dexed[instance_id].fc_range = constrain(sysex[5], FC_RANGE_MIN, FC_RANGE_MAX);
MicroDexed[instance_id]->controllers.foot.setRange(configuration.dexed[instance_id].fc_range);
MicroDexed[instance_id]->setFootControllerRange(configuration.dexed[instance_id].fc_range);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_fc_range))
{
LCDML.OTHER_updateFunc();
@ -1122,7 +1122,7 @@ void handleSystemExclusive(byte * sysex, uint len)
break;
case 73:
configuration.dexed[instance_id].fc_assign = constrain(sysex[5], FC_ASSIGN_MIN, FC_ASSIGN_MAX);
MicroDexed[instance_id]->controllers.foot.setTarget(configuration.dexed[instance_id].fc_assign);
MicroDexed[instance_id]->setFootControllerTarget(configuration.dexed[instance_id].fc_assign);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_fc_assign))
{
LCDML.OTHER_updateFunc();
@ -1131,7 +1131,7 @@ void handleSystemExclusive(byte * sysex, uint len)
break;
case 74:
configuration.dexed[instance_id].bc_range = constrain(sysex[5], BC_RANGE_MIN, BC_RANGE_MAX);
MicroDexed[instance_id]->controllers.breath.setRange(configuration.dexed[instance_id].bc_range);
MicroDexed[instance_id]->setBreathControllerRange(configuration.dexed[instance_id].bc_range);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_bc_range))
{
LCDML.OTHER_updateFunc();
@ -1140,7 +1140,7 @@ void handleSystemExclusive(byte * sysex, uint len)
break;
case 75:
configuration.dexed[instance_id].bc_assign = constrain(sysex[5], BC_ASSIGN_MIN, BC_ASSIGN_MAX);
MicroDexed[instance_id]->controllers.breath.setTarget(configuration.dexed[instance_id].bc_assign);
MicroDexed[instance_id]->setBreathControllerTarget(configuration.dexed[instance_id].bc_assign);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_bc_assign))
{
LCDML.OTHER_updateFunc();
@ -1149,7 +1149,7 @@ void handleSystemExclusive(byte * sysex, uint len)
break;
case 76:
configuration.dexed[instance_id].at_range = constrain(sysex[5], AT_RANGE_MIN, AT_RANGE_MAX);
MicroDexed[instance_id]->controllers.at.setRange(configuration.dexed[instance_id].at_range);
MicroDexed[instance_id]->setAftertouchRange(configuration.dexed[instance_id].at_range);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_at_range))
{
LCDML.OTHER_updateFunc();
@ -1158,7 +1158,7 @@ void handleSystemExclusive(byte * sysex, uint len)
break;
case 77:
configuration.dexed[instance_id].at_assign = constrain(sysex[5], AT_ASSIGN_MIN, AT_ASSIGN_MAX);
MicroDexed[instance_id]->controllers.at.setTarget(configuration.dexed[instance_id].at_assign);
MicroDexed[instance_id]->setAftertouchTarget(configuration.dexed[instance_id].at_assign);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_at_assign))
{
LCDML.OTHER_updateFunc();
@ -1166,10 +1166,10 @@ void handleSystemExclusive(byte * sysex, uint len)
}
break;
default:
MicroDexed[instance_id]->data[sysex[4]] = sysex[5]; // set function parameter
MicroDexed[instance_id]->setVoiceDataElement(sysex[4], sysex[5]); // set function parameter
break;
}
MicroDexed[instance_id]->controllers.refresh();
MicroDexed[instance_id]->ControllersRefresh();
}
#ifdef DEBUG
else
@ -1762,10 +1762,10 @@ void init_configuration(void)
#if NUM_DEXED > 1
MicroDexed[instance_id]->controllers.refresh();
MicroDexed[instance_id]->ControllersRefresh();
#else
if (instance_id == 0)
MicroDexed[instance_id]->controllers.refresh();
MicroDexed[instance_id]->ControllersRefresh();
#endif
}
@ -1930,8 +1930,8 @@ void set_fx_params(void)
reverb_mixer_l.gain(instance_id, pseudo_log_curve(mapfloat(configuration.fx.reverb_send[instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0)));
// DEXED FILTER
MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.fx.filter_resonance[instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0);
MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.fx.filter_cutoff[instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
MicroDexed[instance_id]->setFilterResonance(mapfloat(configuration.fx.filter_resonance[instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0));
MicroDexed[instance_id]->setFilterCutoff(mapfloat(configuration.fx.filter_cutoff[instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0));
MicroDexed[instance_id]->doRefreshVoice();
}
@ -1968,14 +1968,14 @@ void set_voiceconfig_params(uint8_t instance_id)
MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign, configuration.dexed[instance_id].fc_mode);
MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign, configuration.dexed[instance_id].bc_mode);
MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign, configuration.dexed[instance_id].at_mode);
MicroDexed[instance_id]->controllers.refresh();
MicroDexed[instance_id]->ControllersRefresh();
MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled);
MicroDexed[instance_id]->doRefreshVoice();
MicroDexed[instance_id]->setMaxNotes(configuration.dexed[instance_id].polyphony);
MicroDexed[instance_id]->setMonoMode(configuration.sys.mono);
// Dexed output level
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]->setGain(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));
@ -2253,9 +2253,9 @@ void show_cpu_and_mem_usage(void)
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
sum_xrun += MicroDexed[instance_id]->xrun;
sum_render_time_max += MicroDexed[instance_id]->render_time_max;
MicroDexed[instance_id]->render_time_max = 0;
sum_xrun += MicroDexed[instance_id]->getXRun();
sum_render_time_max += MicroDexed[instance_id]->getRenderTimeMax();
MicroDexed[instance_id]->resetRenderTimeMax();
}
if (AudioProcessorUsageMax() > 99.9)
{
@ -2412,51 +2412,51 @@ void show_patch(uint8_t instance_id)
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]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_R1));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R2]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_R2));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R3]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_R3));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_R4]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_R4));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L1]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_L1));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L2]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_L2));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L3]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_L3));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_EG_L4]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_L4));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_LEV_SCL_BRK_PT]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_LEV_SCL_BRK_PT));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_LEFT_DEPTH]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_SCL_LEFT_DEPTH));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_RGHT_DEPTH]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((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]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_SCL_LEFT_CURVE));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_SCL_RGHT_CURVE]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_SCL_RGHT_CURVE));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OSC_RATE_SCALE]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_OSC_RATE_SCALE));
Serial.print(F(" |"));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_AMP_MOD_SENS]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_AMP_MOD_SENS));
Serial.print(F(" |"));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_KEY_VEL_SENS]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_KEY_VEL_SENS));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OUTPUT_LEV]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_OUTPUT_LEV));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OSC_MODE]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_OSC_MODE));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_FREQ_COARSE]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_FREQ_COARSE));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_FREQ_FINE]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_FREQ_FINE));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[(i * 21) + DEXED_OP_OSC_DETUNE]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_OSC_DETUNE));
Serial.println(F(" |"));
}
Serial.println(F("+=======+=====+=+=======+===+===+======++====+==+==+====+====+==+======+======+=====+=+====================+"));
@ -2465,36 +2465,36 @@ void show_patch(uint8_t instance_id)
Serial.print(F("| "));
for (int8_t i = 0; i < 8; i++)
{
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + i]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + i));
Serial.print(F(" | "));
}
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_ALGORITHM]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + DEXED_ALGORITHM));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_FEEDBACK]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + DEXED_FEEDBACK));
Serial.print(F(" |"));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(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]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + DEXED_LFO_SPEED));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_DELAY]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + DEXED_LFO_DELAY));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_SYNC]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + DEXED_LFO_SYNC));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_WAVE]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + DEXED_LFO_WAVE));
Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS]);
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS));
Serial.print(F(" | "));
strncpy(vn, (char *)&MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_NAME], VOICE_NAME_LEN - 1);
MicroDexed[instance_id]->getName(vn);
Serial.print(vn);
Serial.println(F(" |"));
Serial.println(F("+=========+=========+=========+=========+==========+==========+=========+==================================+"));

@ -1633,7 +1633,7 @@ void UI_func_filter_cutoff(uint8_t param)
lcd_display_bar_int("Filter Cutoff", configuration.fx.filter_cutoff[selected_instance_id], 1.0, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 3, false, false, false);
MicroDexed[selected_instance_id]->fx.Cutoff = mapfloat(configuration.fx.filter_cutoff[selected_instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
MicroDexed[selected_instance_id]->setFilterCutoff(mapfloat(configuration.fx.filter_cutoff[selected_instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1686,7 +1686,7 @@ void UI_func_filter_resonance(uint8_t param)
lcd_display_bar_int("Filter Reso.", configuration.fx.filter_resonance[selected_instance_id], 1.0, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 3, false, false, false);
MicroDexed[selected_instance_id]->fx.Reso = mapfloat(configuration.fx.filter_resonance[selected_instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0);
MicroDexed[selected_instance_id]->setFilterResonance(mapfloat(configuration.fx.filter_resonance[selected_instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1734,7 +1734,7 @@ void UI_func_transpose(uint8_t param)
lcd_display_meter_int("Transpose", configuration.dexed[selected_instance_id].transpose, 1.0, -24.0, TRANSPOSE_MIN, TRANSPOSE_MAX, 2, false, true, true);
MicroDexed[selected_instance_id]->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE] = configuration.dexed[selected_instance_id].transpose;
MicroDexed[selected_instance_id]->setTranspose(configuration.dexed[selected_instance_id].transpose);
MicroDexed[selected_instance_id]->notesOff();
send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 144, configuration.dexed[selected_instance_id].transpose, 0);
}
@ -1789,7 +1789,7 @@ void UI_func_tune(uint8_t param)
lcd_display_meter_int("Fine Tune", configuration.dexed[selected_instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, true, false);
MicroDexed[selected_instance_id]->controllers.masterTune = (int((configuration.dexed[selected_instance_id].tune - 100) / 100.0 * 0x4000) << 11) * (1.0 / 12);
MicroDexed[selected_instance_id]->setMasterTune((int((configuration.dexed[selected_instance_id].tune - 100) / 100.0 * 0x4000) << 11) * (1.0 / 12));
MicroDexed[selected_instance_id]->doRefreshVoice();
}
@ -2015,7 +2015,7 @@ void UI_func_sound_intensity(uint8_t param)
}
lcd_display_bar_int("Voice Level", configuration.dexed[selected_instance_id].sound_intensity, 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false);
MicroDexed[selected_instance_id]->fx.Gain = pseudo_log_curve(mapfloat(configuration.dexed[selected_instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX));
MicroDexed[selected_instance_id]->setGain(pseudo_log_curve(mapfloat(configuration.dexed[selected_instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2712,7 +2712,7 @@ void UI_func_mw_mode(uint8_t param)
}
MicroDexed[selected_instance_id]->setMWController(configuration.dexed[selected_instance_id].mw_range, configuration.dexed[selected_instance_id].mw_assign, configuration.dexed[selected_instance_id].mw_mode);
MicroDexed[selected_instance_id]->controllers.refresh();
MicroDexed[selected_instance_id]->ControllersRefresh();
lcd.setCursor(0, 1);
switch (configuration.dexed[selected_instance_id].mw_mode)
@ -2895,7 +2895,7 @@ void UI_func_fc_mode(uint8_t param)
}
MicroDexed[selected_instance_id]->setFCController(configuration.dexed[selected_instance_id].fc_range, configuration.dexed[selected_instance_id].fc_assign, configuration.dexed[selected_instance_id].fc_mode);
MicroDexed[selected_instance_id]->controllers.refresh();
MicroDexed[selected_instance_id]->ControllersRefresh();
lcd.setCursor(0, 1);
switch (configuration.dexed[selected_instance_id].fc_mode)
@ -3078,7 +3078,7 @@ void UI_func_bc_mode(uint8_t param)
}
MicroDexed[selected_instance_id]->setBCController(configuration.dexed[selected_instance_id].bc_range, configuration.dexed[selected_instance_id].bc_assign, configuration.dexed[selected_instance_id].bc_mode);
MicroDexed[selected_instance_id]->controllers.refresh();
MicroDexed[selected_instance_id]->ControllersRefresh();
lcd.setCursor(0, 1);
switch (configuration.dexed[selected_instance_id].bc_mode)
@ -3261,7 +3261,7 @@ void UI_func_at_mode(uint8_t param)
}
MicroDexed[selected_instance_id]->setATController(configuration.dexed[selected_instance_id].at_range, configuration.dexed[selected_instance_id].at_assign, configuration.dexed[selected_instance_id].at_mode);
MicroDexed[selected_instance_id]->controllers.refresh();
MicroDexed[selected_instance_id]->ControllersRefresh();
lcd.setCursor(0, 1);
switch (configuration.dexed[selected_instance_id].at_mode)

@ -50,7 +50,7 @@ bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id)
get_bank_name(b, bank_name, sizeof(bank_name));
sprintf(filename, "/%d/%s.syx", b, bank_name);
sysex = SD.open(filename);
if (!sysex)
{
@ -73,12 +73,14 @@ bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id)
Serial.print(voice_name);
Serial.println(F("]"));
#endif
bool ret = MicroDexed[instance_id]->decodeVoice(data, MicroDexed[instance_id]->data);
uint8_t tmp_data[156];
bool ret = MicroDexed[instance_id]->decodeVoice(data, tmp_data);
MicroDexed[instance_id]->loadVoiceParameters(tmp_data);
#ifdef DEBUG
show_patch(instance_id);
#endif
configuration.dexed[instance_id].transpose = MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE];
configuration.dexed[instance_id].transpose = MicroDexed[instance_id]->getTranspose();
sysex.close();
@ -130,7 +132,8 @@ bool save_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id)
{
#ifdef DEBUG
char voice_name[VOICE_NAME_LEN];
strncpy(voice_name, (char*)&MicroDexed[instance_id]->data[145], sizeof(voice_name));
MicroDexed[instance_id]->getName(voice_name);
Serial.print(F("Saving voice to "));
Serial.print(filename);
Serial.print(F(" ["));
@ -219,6 +222,7 @@ bool get_sd_voice(File sysex, uint8_t voice_number, uint8_t* data)
{
#ifdef DEBUG
Serial.print(F("E : Bulk checksum mismatch : 0x"));
Serial.print(bulk_checksum_calc, HEX);
Serial.print(F(" != 0x"));
Serial.println(bulk_checksum, HEX);
@ -226,7 +230,7 @@ bool get_sd_voice(File sysex, uint8_t voice_number, uint8_t* data)
return (false);
}
MicroDexed[0]->render_time_max = 0;
MicroDexed[0]->resetRenderTimeMax();
return (true);
}
@ -607,7 +611,7 @@ bool load_sd_performance(int8_t p)
load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id);
load_sd_voiceconfig(configuration.performance.voiceconfig_number[instance_id], instance_id);
MicroDexed[instance_id]->controllers.refresh();
MicroDexed[instance_id]->ControllersRefresh();
MicroDexed[instance_id]->panic();
}
load_sd_fx(configuration.performance.fx_number);

@ -284,7 +284,7 @@ float PluginFx::getGain(void)
//extern config_t configuration;
Dexed::Dexed(int rate)
Dexed::Dexed(uint8_t maxnotes, int rate)
{
uint8_t i;
@ -301,9 +301,10 @@ Dexed::Dexed(int rate)
engineMsfa = new FmCore;
loadInitVoice();
max_notes=maxnotes;
voices=new ProcessorVoice[max_notes];
for (i = 0; i < MAX_ACTIVE_NOTES; i++)
for (i = 0; i < max_notes; i++)
{
voices[i].dx7_note = new Dx7Note;
voices[i].keydown = false;
@ -312,7 +313,6 @@ Dexed::Dexed(int rate)
voices[i].key_pressed_timer = 0;
}
max_notes = MAX_NOTES;
currentNote = 0;
resetControllers();
controllers.masterTune = 0;
@ -326,15 +326,23 @@ Dexed::Dexed(int rate)
setMonoMode(false);
sustain = false;
loadInitVoice();
xrun = 0;
render_time_max = 0;
}
Dexed::~Dexed()
{
currentNote = -1;
for (uint8_t note = 0; note < MAX_ACTIVE_NOTES; note++)
for (uint8_t note = 0; note < max_notes; note++)
delete voices[note].dx7_note;
for (uint8_t note = 0; note < max_notes; note++)
delete &voices[note];
delete(engineMsfa);
}
@ -538,6 +546,8 @@ void Dexed::keydown(int16_t pitch, uint8_t velo) {
void Dexed::keyup(int16_t pitch) {
uint8_t note;
pitch = constrain(pitch, 0, 127);
pitch += data[144] - TRANSPOSE_FIX;
for (note = 0; note < max_notes; note++) {
@ -621,7 +631,7 @@ bool Dexed::getSustain(void)
void Dexed::panic(void)
{
for (uint8_t i = 0; i < MAX_ACTIVE_NOTES; i++)
for (uint8_t i = 0; i < max_notes; i++)
{
if (voices[i].live == true) {
voices[i].keydown = false;
@ -653,7 +663,7 @@ void Dexed::resetControllers(void)
}
void Dexed::notesOff(void) {
for (uint8_t i = 0; i < MAX_ACTIVE_NOTES; i++) {
for (uint8_t i = 0; i < max_notes; i++) {
if (voices[i].live == true) {
voices[i].keydown = false;
voices[i].live = false;
@ -662,7 +672,7 @@ void Dexed::notesOff(void) {
}
void Dexed::setMaxNotes(uint8_t n) {
if (n <= MAX_ACTIVE_NOTES)
if (n <= max_notes)
{
notesOff();
max_notes = n;
@ -857,26 +867,36 @@ bool Dexed::getVoiceData(uint8_t* data_copy)
return (true);
}
bool Dexed::loadVoiceParameters(uint8_t* new_data)
void Dexed::setVoiceDataElement(uint8_t address, uint8_t value)
{
address = constrain(address, 0, NUM_VOICE_PARAMETERS);
data[address] = value;
}
uint8_t Dexed::getVoiceDataElement(uint8_t address)
{
address = constrain(address, 0, NUM_VOICE_PARAMETERS);
return (data[address]);
}
void Dexed::loadVoiceParameters(uint8_t* new_data)
{
#ifdef DEBUG
char dexed_voice_name[11];
#endif
panic();
memcpy(&data, new_data, 155);
doRefreshVoice();
//activate();
strncpy(dexed_voice_name, (char *)&new_data[145], sizeof(dexed_voice_name) - 1);
dexed_voice_name[10] = '\0';
#ifdef DEBUG
dexed_voice_name[10] = '\0';
Serial.print(F("Voice ["));
Serial.print(dexed_voice_name);
Serial.println(F("] loaded."));
#endif
return (true);
}
void Dexed::loadInitVoice(void)
@ -890,8 +910,8 @@ void Dexed::setPBController(uint8_t pb_range, uint8_t pb_step)
Serial.println(F("Dexed::setPBController"));
#endif
pb_range = constrain(pb_range, PB_RANGE_MIN, PB_RANGE_MAX);
pb_step = constrain(pb_step, PB_STEP_MIN, PB_STEP_MAX);
pb_range = constrain(pb_range, 0, 12);
pb_step = constrain(pb_step, 0, 12);
controllers.values_[kControllerPitchRange] = pb_range;
controllers.values_[kControllerPitchStep] = pb_step;
@ -905,9 +925,9 @@ void Dexed::setMWController(uint8_t mw_range, uint8_t mw_assign, uint8_t mw_mode
Serial.println(F("Dexed::setMWController"));
#endif
mw_range = constrain(mw_range, MW_RANGE_MIN, MW_RANGE_MAX);
mw_assign = constrain(mw_assign, MW_ASSIGN_MIN, MW_ASSIGN_MAX);
mw_mode = constrain(mw_mode, MW_MODE_MIN, MW_MODE_MAX);
mw_range = constrain(mw_range, 0, 99);
mw_assign = constrain(mw_assign, 0, 7);
mw_mode = constrain(mw_mode, 0, MIDI_CONTROLLER_MODE_MAX);
controllers.wheel.setRange(mw_range);
controllers.wheel.setTarget(mw_assign);
@ -922,9 +942,9 @@ void Dexed::setFCController(uint8_t fc_range, uint8_t fc_assign, uint8_t fc_mode
Serial.println(F("Dexed::setFCController"));
#endif
fc_range = constrain(fc_range, FC_RANGE_MIN, FC_RANGE_MAX);
fc_assign = constrain(fc_assign, FC_ASSIGN_MIN, FC_ASSIGN_MAX);
fc_mode = constrain(fc_mode, FC_MODE_MIN, FC_MODE_MAX);
fc_range = constrain(fc_range, 0, 99);
fc_assign = constrain(fc_assign, 0, 7);
fc_mode = constrain(fc_mode, 0, MIDI_CONTROLLER_MODE_MAX);
controllers.foot.setRange(fc_range);
controllers.foot.setTarget(fc_assign);
@ -939,9 +959,9 @@ void Dexed::setBCController(uint8_t bc_range, uint8_t bc_assign, uint8_t bc_mode
Serial.println(F("Dexed::setBCController"));
#endif
bc_range = constrain(bc_range, BC_RANGE_MIN, BC_RANGE_MAX);
bc_assign = constrain(bc_assign, BC_ASSIGN_MIN, BC_ASSIGN_MAX);
bc_mode = constrain(bc_mode, BC_MODE_MIN, BC_MODE_MAX);
bc_range = constrain(bc_range, 0, 99);
bc_assign = constrain(bc_assign, 0, 7);
bc_mode = constrain(bc_mode, 0, MIDI_CONTROLLER_MODE_MAX);
controllers.breath.setRange(bc_range);
controllers.breath.setTarget(bc_assign);
@ -956,9 +976,9 @@ void Dexed::setATController(uint8_t at_range, uint8_t at_assign, uint8_t at_mode
Serial.println(F("Dexed::setATController"));
#endif
at_range = constrain(at_range, AT_RANGE_MIN, AT_RANGE_MAX);
at_assign = constrain(at_assign, AT_ASSIGN_MIN, AT_ASSIGN_MAX);
at_mode = constrain(at_mode, AT_MODE_MIN, AT_MODE_MAX);
at_range = constrain(at_range, 0, 99);
at_assign = constrain(at_assign, 0, 7);
at_mode = constrain(at_mode, 0, MIDI_CONTROLLER_MODE_MAX);
controllers.at.setRange(at_range);
controllers.at.setTarget(at_assign);
@ -969,6 +989,10 @@ void Dexed::setATController(uint8_t at_range, uint8_t at_assign, uint8_t at_mode
void Dexed::setPortamentoMode(uint8_t portamento_mode, uint8_t portamento_glissando, uint8_t portamento_time)
{
portamento_mode = constrain(portamento_mode, 0, 1);
portamento_glissando = constrain(portamento_glissando, 0, 1);
portamento_mode = constrain(portamento_mode, 0, 99);
controllers.portamento_cc = portamento_time;
controllers.portamento_enable_cc = portamento_mode > 63;
@ -982,42 +1006,249 @@ void Dexed::setPortamentoMode(uint8_t portamento_mode, uint8_t portamento_glissa
controllers.refresh();
}
void AudioSynthDexed::update(void)
{
if (in_update == true)
{
xrun++;
return;
}
else
in_update = true;
uint32_t Dexed::getXRun(void)
{
return (xrun);
}
elapsedMicros render_time;
audio_block_t *lblock;
uint16_t Dexed::getRenderTimeMax(void)
{
return (render_time_max);
}
lblock = allocate();
void Dexed::resetRenderTimeMax(void)
{
render_time_max = 0;
}
if (!lblock)
{
in_update = false;
return;
}
void Dexed::ControllersRefresh(void)
{
controllers.refresh();
}
void Dexed::setMasterTune(int8_t mastertune)
{
mastertune = constrain(mastertune, -99, 99);
controllers.masterTune = (int(mastertune / 100.0 * 0x4000) << 11) * (1.0 / 12.0);
}
getSamples(AUDIO_BLOCK_SAMPLES, lblock->data);
int8_t Dexed::getMasterTune(void)
{
return (controllers.masterTune);
}
void Dexed::setModWheel(uint8_t value)
{
value = constrain(value, 0, 127);
controllers.modwheel_cc = value;
}
uint8_t Dexed::getModWheel(void)
{
return (controllers.modwheel_cc);
}
void Dexed::setBreathController(uint8_t value)
{
value = constrain(value, 0, 127);
controllers.breath_cc = value;
}
uint8_t Dexed::getBreathController(void)
{
return (controllers.breath_cc);
}
void Dexed::setFootController(uint8_t value)
{
value = constrain(value, 0, 127);
if (render_time > audio_block_time_us) // everything greater audio_block_time_us (2.9ms for buffer size of 128) is a buffer underrun!
xrun++;
controllers.foot_cc = value;
}
uint8_t Dexed::getFootController(void)
{
return (controllers.foot_cc);
}
if (render_time > render_time_max)
render_time_max = render_time;
void Dexed::setAftertouch(uint8_t value)
{
value = constrain(value, 0, 127);
transmit(lblock, 0);
release(lblock);
controllers.aftertouch_cc = value;
}
in_update = false;
};
uint8_t Dexed::getAftertouch(void)
{
return (controllers.aftertouch_cc);
}
void Dexed::setPitchbend(int16_t value)
{
value = constrain(value, -8192, 8191);
controllers.values_[kControllerPitch] = value + 0x2000; // -8192 to +8191 --> 0 to 16383
}
int16_t Dexed::getPitchbend(void)
{
return (controllers.values_[kControllerPitch] - 0x2000);
}
void Dexed::setPitchbendRange(uint8_t range)
{
range = constrain(range, 0, 12);
controllers.values_[kControllerPitchRange] = range;
}
uint8_t Dexed::getPitchbendRange(void)
{
return (controllers.values_[kControllerPitchRange]);
}
void Dexed::setPitchbendStep(uint8_t step)
{
step = constrain(step, 0, 12);
controllers.values_[kControllerPitchStep] = step;
}
uint8_t Dexed::getPitchbendStep(void)
{
return (controllers.values_[kControllerPitchStep]);
}
void AudioSynthDexed::setOPRateAll(uint8_t rate)
void Dexed::setModWheelRange(uint8_t range)
{
range = constrain(range, 0, 12);
controllers.wheel.setRange(range);
}
uint8_t Dexed::getModWheelRange(void)
{
return (controllers.wheel.getRange());
}
void Dexed::setModWheelTarget(uint8_t target)
{
target = constrain(target, 0, 7);
controllers.wheel.setTarget(target);
}
uint8_t Dexed::getModWheelTarget(void)
{
return (controllers.wheel.getTarget());
}
void Dexed::setFootControllerRange(uint8_t range)
{
range = constrain(range, 0, 12);
controllers.foot.setRange(range);
}
uint8_t Dexed::getFootControllerRange(void)
{
return (controllers.foot.getRange());
}
void Dexed::setFootControllerTarget(uint8_t target)
{
target = constrain(target, 0, 7);
controllers.foot.setTarget(target);
}
uint8_t Dexed::getFootControllerTarget(void)
{
return (controllers.foot.getTarget());
}
void Dexed::setBreathControllerRange(uint8_t range)
{
range = constrain(range, 0, 12);
controllers.breath.setRange(range);
}
uint8_t Dexed::getBreathControllerRange(void)
{
return (controllers.breath.getRange());
}
void Dexed::setBreathControllerTarget(uint8_t target)
{
target = constrain(target, 0, 7);
controllers.breath.setTarget(target);
}
uint8_t Dexed::getBreathControllerTarget(void)
{
return (controllers.breath.getTarget());
}
void Dexed::setAftertouchRange(uint8_t range)
{
range = constrain(range, 0, 12);
controllers.at.setRange(range);
}
uint8_t Dexed::getAftertouchRange(void)
{
return (controllers.at.getRange());
}
void Dexed::setAftertouchTarget(uint8_t target)
{
target = constrain(target, 0, 7);
controllers.at.setTarget(target);
}
uint8_t Dexed::getAftertouchTarget(void)
{
return (controllers.at.getTarget());
}
void Dexed::setFilterCutoff(float cutoff)
{
fx.Cutoff = cutoff;
}
float Dexed::getFilterCutoff(void)
{
return (fx.Cutoff);
}
void Dexed::setFilterResonance(float resonance)
{
fx.Reso = resonance;
}
float Dexed::getFilterResonance(void)
{
return (fx.Reso);
}
void Dexed::setGain(float gain)
{
fx.Gain = gain;
}
float Dexed::getGain(void)
{
return (fx.Gain);
}
void Dexed::setOPRateAll(uint8_t rate)
{
rate = constrain(rate, 0, 99);
@ -1030,7 +1261,7 @@ void AudioSynthDexed::setOPRateAll(uint8_t rate)
}
}
void AudioSynthDexed::setOPLevelAll(uint8_t level)
void Dexed::setOPLevelAll(uint8_t level)
{
level = constrain(level, 0, 99);
@ -1043,7 +1274,7 @@ void AudioSynthDexed::setOPLevelAll(uint8_t level)
}
}
void AudioSynthDexed::setOPRateAllModulator(uint8_t step, uint8_t rate)
void Dexed::setOPRateAllModulator(uint8_t step, uint8_t rate)
{
uint8_t op_carrier = controllers.core->get_carrier_operators(data[134]); // look for carriers
@ -1057,7 +1288,7 @@ void AudioSynthDexed::setOPRateAllModulator(uint8_t step, uint8_t rate)
}
}
void AudioSynthDexed::setOPLevelAllModulator(uint8_t step, uint8_t level)
void Dexed::setOPLevelAllModulator(uint8_t step, uint8_t level)
{
uint8_t op_carrier = controllers.core->get_carrier_operators(data[134]); // look for carriers
@ -1071,7 +1302,7 @@ void AudioSynthDexed::setOPLevelAllModulator(uint8_t step, uint8_t level)
}
}
void AudioSynthDexed::setOPRateAllCarrier(uint8_t step, uint8_t rate)
void Dexed::setOPRateAllCarrier(uint8_t step, uint8_t rate)
{
uint8_t op_carrier = controllers.core->get_carrier_operators(data[134]); // look for carriers
@ -1085,7 +1316,7 @@ void AudioSynthDexed::setOPRateAllCarrier(uint8_t step, uint8_t rate)
}
}
void AudioSynthDexed::setOPLevelAllCarrier(uint8_t step, uint8_t level)
void Dexed::setOPLevelAllCarrier(uint8_t step, uint8_t level)
{
uint8_t op_carrier = controllers.core->get_carrier_operators(data[134]); // look for carriers
@ -1099,7 +1330,7 @@ void AudioSynthDexed::setOPLevelAllCarrier(uint8_t step, uint8_t level)
}
}
void AudioSynthDexed::setOPRate(uint8_t op, uint8_t step, uint8_t rate)
void Dexed::setOPRate(uint8_t op, uint8_t step, uint8_t rate)
{
op = constrain(op, 0, 5);
step = constrain(step, 0, 3);
@ -1108,7 +1339,7 @@ void AudioSynthDexed::setOPRate(uint8_t op, uint8_t step, uint8_t rate)
data[(op * 21) + DEXED_OP_EG_R1 + step] = rate;
}
uint8_t AudioSynthDexed::getOPRate(uint8_t op, uint8_t step)
uint8_t Dexed::getOPRate(uint8_t op, uint8_t step)
{
op = constrain(op, 0, 5);
step = constrain(step, 0, 3);
@ -1116,7 +1347,7 @@ uint8_t AudioSynthDexed::getOPRate(uint8_t op, uint8_t step)
return (data[(op * 21) + DEXED_OP_EG_R1 + step]);
}
void AudioSynthDexed::setOPLevel(uint8_t op, uint8_t step, uint8_t level)
void Dexed::setOPLevel(uint8_t op, uint8_t step, uint8_t level)
{
op = constrain(op, 0, 5);
step = constrain(step, 0, 3);
@ -1125,7 +1356,7 @@ void AudioSynthDexed::setOPLevel(uint8_t op, uint8_t step, uint8_t level)
data[(op * 21) + DEXED_OP_EG_L1 + step] = level;
}
uint8_t AudioSynthDexed::getOPLevel(uint8_t op, uint8_t step)
uint8_t Dexed::getOPLevel(uint8_t op, uint8_t step)
{
op = constrain(op, 0, 5);
step = constrain(step, 0, 3);
@ -1133,7 +1364,7 @@ uint8_t AudioSynthDexed::getOPLevel(uint8_t op, uint8_t step)
return (data[(op * 21) + DEXED_OP_EG_L1 + step]);
}
void AudioSynthDexed::setOPKeyboardLevelScalingBreakPoint(uint8_t op, uint8_t level)
void Dexed::setOPKeyboardLevelScalingBreakPoint(uint8_t op, uint8_t level)
{
op = constrain(op, 0, 5);
level = constrain(level, 0, 99);
@ -1141,14 +1372,14 @@ void AudioSynthDexed::setOPKeyboardLevelScalingBreakPoint(uint8_t op, uint8_t le
data[(op * 21) + DEXED_OP_LEV_SCL_BRK_PT] = level;
}
uint8_t AudioSynthDexed::getOPKeyboardLevelScalingBreakPoint(uint8_t op)
uint8_t Dexed::getOPKeyboardLevelScalingBreakPoint(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_LEV_SCL_BRK_PT]);
}
void AudioSynthDexed::setOPKeyboardLevelScalingDepthLeft(uint8_t op, uint8_t depth)
void Dexed::setOPKeyboardLevelScalingDepthLeft(uint8_t op, uint8_t depth)
{
op = constrain(op, 0, 5);
depth = constrain(depth, 0, 99);
@ -1156,14 +1387,14 @@ void AudioSynthDexed::setOPKeyboardLevelScalingDepthLeft(uint8_t op, uint8_t dep
data[(op * 21) + DEXED_OP_SCL_LEFT_DEPTH] = depth;
}
uint8_t AudioSynthDexed::getOPKeyboardLevelScalingDepthLeft(uint8_t op)
uint8_t Dexed::getOPKeyboardLevelScalingDepthLeft(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_SCL_LEFT_DEPTH]);
}
void AudioSynthDexed::setOPKeyboardLevelScalingDepthRight(uint8_t op, uint8_t depth)
void Dexed::setOPKeyboardLevelScalingDepthRight(uint8_t op, uint8_t depth)
{
op = constrain(op, 0, 5);
depth = constrain(depth, 0, 99);
@ -1171,14 +1402,14 @@ void AudioSynthDexed::setOPKeyboardLevelScalingDepthRight(uint8_t op, uint8_t de
data[(op * 21) + DEXED_OP_SCL_RGHT_DEPTH] = depth;
}
uint8_t AudioSynthDexed::getOPKeyboardLevelScalingDepthRight(uint8_t op)
uint8_t Dexed::getOPKeyboardLevelScalingDepthRight(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_SCL_RGHT_DEPTH]);
}
void AudioSynthDexed::setOPKeyboardLevelScalingCurveLeft(uint8_t op, uint8_t curve)
void Dexed::setOPKeyboardLevelScalingCurveLeft(uint8_t op, uint8_t curve)
{
op = constrain(op, 0, 5);
curve = constrain(curve, 0, 3);
@ -1186,14 +1417,14 @@ void AudioSynthDexed::setOPKeyboardLevelScalingCurveLeft(uint8_t op, uint8_t cur
data[(op * 21) + DEXED_OP_SCL_LEFT_CURVE] = curve;
}
uint8_t AudioSynthDexed::getOPKeyboardLevelScalingCurveLeft(uint8_t op)
uint8_t Dexed::getOPKeyboardLevelScalingCurveLeft(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_SCL_LEFT_CURVE]);
}
void AudioSynthDexed::setOPKeyboardLevelScalingCurveRight(uint8_t op, uint8_t curve)
void Dexed::setOPKeyboardLevelScalingCurveRight(uint8_t op, uint8_t curve)
{
op = constrain(op, 0, 5);
curve = constrain(curve, 0, 3);
@ -1201,14 +1432,14 @@ void AudioSynthDexed::setOPKeyboardLevelScalingCurveRight(uint8_t op, uint8_t cu
data[(op * 21) + DEXED_OP_SCL_RGHT_CURVE] = curve;
}
uint8_t AudioSynthDexed::getOPKeyboardLevelScalingCurveRight(uint8_t op)
uint8_t Dexed::getOPKeyboardLevelScalingCurveRight(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_SCL_RGHT_CURVE]);
}
void AudioSynthDexed::setOPKeyboardRateScale(uint8_t op, uint8_t scale)
void Dexed::setOPKeyboardRateScale(uint8_t op, uint8_t scale)
{
op = constrain(op, 0, 5);
scale = constrain(scale, 0, 7);
@ -1216,14 +1447,14 @@ void AudioSynthDexed::setOPKeyboardRateScale(uint8_t op, uint8_t scale)
data[(op * 21) + DEXED_OP_OSC_RATE_SCALE] = scale;
}
uint8_t AudioSynthDexed::getOPKeyboardRateScale(uint8_t op)
uint8_t Dexed::getOPKeyboardRateScale(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_OSC_RATE_SCALE]);
}
void AudioSynthDexed::setOPAmpModulationSensity(uint8_t op, uint8_t sensitivity)
void Dexed::setOPAmpModulationSensity(uint8_t op, uint8_t sensitivity)
{
op = constrain(op, 0, 5);
sensitivity = constrain(sensitivity, 0, 3);
@ -1231,14 +1462,14 @@ void AudioSynthDexed::setOPAmpModulationSensity(uint8_t op, uint8_t sensitivity)
data[(op * 21) + DEXED_OP_AMP_MOD_SENS] = sensitivity;
}
uint8_t AudioSynthDexed::getOPAmpModulationSensity(uint8_t op)
uint8_t Dexed::getOPAmpModulationSensity(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_AMP_MOD_SENS]);
}
void AudioSynthDexed::setOPKeyboardVelocitySensity(uint8_t op, uint8_t sensitivity)
void Dexed::setOPKeyboardVelocitySensity(uint8_t op, uint8_t sensitivity)
{
op = constrain(op, 0, 5);
sensitivity = constrain(sensitivity, 0, 7);
@ -1246,14 +1477,14 @@ void AudioSynthDexed::setOPKeyboardVelocitySensity(uint8_t op, uint8_t sensitivi
data[(op * 21) + DEXED_OP_KEY_VEL_SENS] = sensitivity;
}
uint8_t AudioSynthDexed::getOPKeyboardVelocitySensity(uint8_t op)
uint8_t Dexed::getOPKeyboardVelocitySensity(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_KEY_VEL_SENS]);
}
void AudioSynthDexed::setOPOutputLevel(uint8_t op, uint8_t level)
void Dexed::setOPOutputLevel(uint8_t op, uint8_t level)
{
op = constrain(op, 0, 5);
level = constrain(level, 0, 99);
@ -1261,14 +1492,14 @@ void AudioSynthDexed::setOPOutputLevel(uint8_t op, uint8_t level)
data[(op * 21) + DEXED_OP_OUTPUT_LEV] = level;
}
uint8_t AudioSynthDexed::getOPOutputLevel(uint8_t op)
uint8_t Dexed::getOPOutputLevel(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_OUTPUT_LEV]);
}
void AudioSynthDexed::setOPMode(uint8_t op, uint8_t mode)
void Dexed::setOPMode(uint8_t op, uint8_t mode)
{
op = constrain(op, 0, 5);
mode = constrain(mode, 0, 1);
@ -1276,14 +1507,14 @@ void AudioSynthDexed::setOPMode(uint8_t op, uint8_t mode)
data[(op * 21) + DEXED_OP_OSC_MODE] = mode;
}
uint8_t AudioSynthDexed::getOPMode(uint8_t op)
uint8_t Dexed::getOPMode(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_OSC_MODE]);
}
void AudioSynthDexed::setOPFrequencyCoarse(uint8_t op, uint8_t frq_coarse)
void Dexed::setOPFrequencyCoarse(uint8_t op, uint8_t frq_coarse)
{
op = constrain(op, 0, 5);
frq_coarse = constrain(frq_coarse, 0, 31);
@ -1291,14 +1522,14 @@ void AudioSynthDexed::setOPFrequencyCoarse(uint8_t op, uint8_t frq_coarse)
data[(op * 21) + DEXED_OP_FREQ_COARSE] = frq_coarse;
}
uint8_t AudioSynthDexed::getOPFrequencyCoarse(uint8_t op)
uint8_t Dexed::getOPFrequencyCoarse(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_FREQ_COARSE ]);
}
void AudioSynthDexed::setOPFrequencyFine(uint8_t op, uint8_t frq_fine)
void Dexed::setOPFrequencyFine(uint8_t op, uint8_t frq_fine)
{
op = constrain(op, 0, 5);
frq_fine = constrain(frq_fine, 0, 99);
@ -1306,14 +1537,14 @@ void AudioSynthDexed::setOPFrequencyFine(uint8_t op, uint8_t frq_fine)
data[(op * 21) + DEXED_OP_FREQ_FINE] = frq_fine;
}
uint8_t AudioSynthDexed::getOPFrequencyFine(uint8_t op)
uint8_t Dexed::getOPFrequencyFine(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_FREQ_FINE]);
}
void AudioSynthDexed::setOPDetune(uint8_t op, uint8_t detune)
void Dexed::setOPDetune(uint8_t op, uint8_t detune)
{
op = constrain(op, 0, 5);
detune = constrain(detune, 0, 14);
@ -1321,14 +1552,14 @@ void AudioSynthDexed::setOPDetune(uint8_t op, uint8_t detune)
data[(op * 21) + DEXED_OP_OSC_DETUNE] = detune;
}
uint8_t AudioSynthDexed::getOPDetune(uint8_t op)
uint8_t Dexed::getOPDetune(uint8_t op)
{
op = constrain(op, 0, 5);
return (data[(op * 21) + DEXED_OP_OSC_DETUNE]);
}
void AudioSynthDexed::setPitchRate(uint8_t step, uint8_t rate)
void Dexed::setPitchRate(uint8_t step, uint8_t rate)
{
step = constrain(step, 0, 3);
rate = constrain(rate, 0, 99);
@ -1336,14 +1567,14 @@ void AudioSynthDexed::setPitchRate(uint8_t step, uint8_t rate)
data[DEXED_VOICE_OFFSET + DEXED_PITCH_EG_R1 + step] = rate;
}
uint8_t AudioSynthDexed::getPitchRate(uint8_t step)
uint8_t Dexed::getPitchRate(uint8_t step)
{
step = constrain(step, 0, 3);
return (data[DEXED_VOICE_OFFSET + DEXED_PITCH_EG_R1 + step]);
}
void AudioSynthDexed::setPitchLevel(uint8_t step, uint8_t level)
void Dexed::setPitchLevel(uint8_t step, uint8_t level)
{
step = constrain(step, 0, 3);
level = constrain(level, 0, 99);
@ -1351,150 +1582,186 @@ void AudioSynthDexed::setPitchLevel(uint8_t step, uint8_t level)
data[DEXED_VOICE_OFFSET + DEXED_PITCH_EG_L1 + step] = level;
}
uint8_t AudioSynthDexed::getPitchLevel(uint8_t step)
uint8_t Dexed::getPitchLevel(uint8_t step)
{
step = constrain(step, 0, 3);
return (data[DEXED_VOICE_OFFSET + DEXED_PITCH_EG_L1 + step]);
}
void AudioSynthDexed::setAlgorithm(uint8_t algorithm)
void Dexed::setAlgorithm(uint8_t algorithm)
{
algorithm = constrain(algorithm, 0, 31);
data[DEXED_VOICE_OFFSET + DEXED_ALGORITHM] = algorithm;
}
uint8_t AudioSynthDexed::getAlgorithm(void)
uint8_t Dexed::getAlgorithm(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_ALGORITHM]);
}
void AudioSynthDexed::setFeedback(uint8_t feedback)
void Dexed::setFeedback(uint8_t feedback)
{
feedback = constrain(feedback, 0, 31);
data[DEXED_VOICE_OFFSET + DEXED_FEEDBACK] = feedback;
}
uint8_t AudioSynthDexed::getFeedback(void)
uint8_t Dexed::getFeedback(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_FEEDBACK]);
}
void AudioSynthDexed::setOscillatorSync(bool sync)
void Dexed::setOscillatorSync(bool sync)
{
data[DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC] = sync;
}
bool AudioSynthDexed::getOscillatorSync(void)
bool Dexed::getOscillatorSync(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC]);
}
void AudioSynthDexed::setLFOSpeed(uint8_t speed)
void Dexed::setLFOSpeed(uint8_t speed)
{
speed = constrain(speed, 0, 99);
data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED] = speed;
}
uint8_t AudioSynthDexed::getLFOSpeed(void)
uint8_t Dexed::getLFOSpeed(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED]);
}
void AudioSynthDexed::setLFODelay(uint8_t delay)
void Dexed::setLFODelay(uint8_t delay)
{
delay = constrain(delay, 0, 99);
data[DEXED_VOICE_OFFSET + DEXED_LFO_DELAY] = delay;
}
uint8_t AudioSynthDexed::getLFODelay(void)
uint8_t Dexed::getLFODelay(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_LFO_DELAY]);
}
void AudioSynthDexed::setLFOPitchModulationDepth(uint8_t depth)
void Dexed::setLFOPitchModulationDepth(uint8_t depth)
{
depth = constrain(depth, 0, 99);
data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP] = depth;
}
uint8_t AudioSynthDexed::getLFOPitchModulationDepth(void)
uint8_t Dexed::getLFOPitchModulationDepth(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP]);
}
void AudioSynthDexed::setLFOAmpModulationDepth(uint8_t depth)
void Dexed::setLFOAmpModulationDepth(uint8_t depth)
{
depth = constrain(depth, 0, 99);
data[DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP] = depth;
}
uint8_t AudioSynthDexed::getLFOAmpModulationDepth(void)
uint8_t Dexed::getLFOAmpModulationDepth(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP]);
}
void AudioSynthDexed::setLFOSync(bool sync)
void Dexed::setLFOSync(bool sync)
{
data[DEXED_VOICE_OFFSET + DEXED_LFO_SYNC] = sync;
}
bool AudioSynthDexed::getLFOSync(void)
bool Dexed::getLFOSync(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_LFO_SYNC]);
}
void AudioSynthDexed::setLFOWaveform(uint8_t waveform)
void Dexed::setLFOWaveform(uint8_t waveform)
{
waveform = constrain(waveform, 0, 5);
data[DEXED_VOICE_OFFSET + DEXED_LFO_WAVE] = waveform;
}
uint8_t AudioSynthDexed::getLFOWaveform(void)
uint8_t Dexed::getLFOWaveform(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_LFO_WAVE]);
}
void AudioSynthDexed::setLFOPitchModulationSensitivity(uint8_t sensitivity)
void Dexed::setLFOPitchModulationSensitivity(uint8_t sensitivity)
{
sensitivity = constrain(sensitivity, 0, 5);
data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS] = sensitivity;
}
uint8_t AudioSynthDexed::getLFOPitchModulationSensitivity(void)
uint8_t Dexed::getLFOPitchModulationSensitivity(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS]);
}
void AudioSynthDexed::setTranspose(uint8_t transpose)
void Dexed::setTranspose(uint8_t transpose)
{
transpose = constrain(transpose, 0, 48);
data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE] = transpose;
}
uint8_t AudioSynthDexed::getTranspose(void)
uint8_t Dexed::getTranspose(void)
{
return (data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE]);
}
void AudioSynthDexed::setName(char* name)
void Dexed::setName(char* name)
{
strncpy(name, (char*)&data[DEXED_VOICE_OFFSET + DEXED_NAME], 10);
}
void AudioSynthDexed::getName(char* buffer)
void Dexed::getName(char* buffer)
{
strncpy((char*)&data[DEXED_VOICE_OFFSET + DEXED_NAME], buffer, 10);
buffer[10] = '\0';
}
void AudioSynthDexed::update(void)
{
if (in_update == true)
{
xrun++;
return;
}
else
in_update = true;
elapsedMicros render_time;
audio_block_t *lblock;
lblock = allocate();
if (!lblock)
{
in_update = false;
return;
}
getSamples(AUDIO_BLOCK_SAMPLES, lblock->data);
if (render_time > audio_block_time_us) // everything greater audio_block_time_us (2.9ms for buffer size of 128) is a buffer underrun!
xrun++;
if (render_time > render_time_max)
render_time_max = render_time;
transmit(lblock, 0);
release(lblock);
in_update = false;
};
/*
// https://www.musicdsp.org/en/latest/Effects/169-compressor.html#
void compress

@ -72,61 +72,25 @@
#undef USE_FX
#endif
#define PB_RANGE_MIN 0
#define PB_RANGE_MAX 12
#define PB_RANGE_DEFAULT 1
#define NUM_VOICE_PARAMETERS 156
#define PB_STEP_MIN 0
#define PB_STEP_MAX 12
#define PB_RANGE_DEFAULT 1
#define PB_STEP_DEFAULT 0
#define MW_RANGE_MIN 0
#define MW_RANGE_MAX 99
#define MW_RANGE_DEFAULT 50
#define MW_ASSIGN_MIN 0
#define MW_ASSIGN_MAX 7
#define MW_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias
#define MW_MODE_MIN 0
#define MW_MODE_MAX MIDI_CONTROLLER_MODE_MAX
#define MW_MODE_DEFAULT 0
#define FC_RANGE_MIN 0
#define FC_RANGE_MAX 99
#define FC_RANGE_DEFAULT 50
#define FC_ASSIGN_MIN 0
#define FC_ASSIGN_MAX 7
#define FC_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias
#define FC_MODE_MIN 0
#define FC_MODE_MAX MIDI_CONTROLLER_MODE_MAX
#define FC_MODE_DEFAULT 0
#define BC_RANGE_MIN 0
#define BC_RANGE_MAX 99
#define BC_RANGE_DEFAULT 50
#define BC_ASSIGN_MIN 0
#define BC_ASSIGN_MAX 7
#define BC_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias
#define BC_MODE_MIN 0
#define BC_MODE_MAX MIDI_CONTROLLER_MODE_MAX
#define BC_MODE_DEFAULT 0
#define AT_RANGE_MIN 0
#define AT_RANGE_MAX 99
#define AT_RANGE_DEFAULT 50
#define AT_ASSIGN_MIN 0
#define AT_ASSIGN_MAX 7
#define AT_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias
#define AT_MODE_MIN 0
#define AT_MODE_MAX MIDI_CONTROLLER_MODE_MAX
#define AT_MODE_DEFAULT 0
#define PORTAMENTO_MODE_DEFAULT 0 // 0: Retain, 1: Follow
#define PORTAMENTO_GLISSANDO_DEFAULT 0
#define PORTAMENTO_TIME_DEFAULT 0
/*****************************************************
CODE: orig_code/synth.h
@ -672,6 +636,11 @@ class FmMod {
range = r < 0 && r > 99 ? 0 : r;
}
uint8_t getRange(void)
{
return (range);
}
void setTarget(uint8_t assign)
{
assign = assign < 0 && assign > 7 ? 0 : assign;
@ -680,6 +649,11 @@ class FmMod {
eg = assign & 4; // EG
}
uint8_t getTarget(void)
{
return (pitch & amp & eg);
}
void setMode(uint8_t m)
{
ctrl_mode = m > MIDI_CONTROLLER_MODE_MAX ? 0 : m;
@ -1142,30 +1116,26 @@ enum OPERATORS {
OP6
};
/* #define DEXED_GLOBAL_PARAMETER_OFFSET 155
enum DexedGlobalParameters {
DEXED_PITCHBEND_RANGE, // 0
DEXED_PITCHBEND_STEP, // 1
DEXED_MODWHEEL_RANGE, // 2
DEXED_MODWHEEL_ASSIGN, // 3
DEXED_FOOTCTRL_RANGE, // 4
DEXED_FOOTCTRL_ASSIGN, // 5
DEXED_BREATHCTRL_RANGE, // 6
DEXED_BREATHCTRL_ASSIGN, // 7
DEXED_AT_RANGE, // 8
DEXED_AT_ASSIGN, // 9
DEXED_MASTER_TUNE, // 10
DEXED_OP1_ENABLE, // 11
DEXED_OP2_ENABLE, // 12
DEXED_OP3_ENABLE, // 13
DEXED_OP4_ENABLE, // 14
DEXED_OP5_ENABLE, // 15
DEXED_OP6_ENABLE, // 16
DEXED_MAX_NOTES, // 17
DEXED_PORTAMENTO_MODE, // 18
DEXED_PORTAMENTO_GLISSANDO, // 19
DEXED_PORTAMENTO_TIME, // 20
}; */
enum CONTROLLER_ASSIGN {
NONE,
PITCH,
AMP,
PITCH_AMP,
EG,
PITCH_EG,
AMP_EG,
PITCH_AMP_EG
};
enum PORTAMENTO_MODE {
RETAIN,
FOLLOW
};
enum ON_OFF {
OFF,
ON
};
// GLOBALS
@ -1174,7 +1144,7 @@ enum OPERATORS {
class Dexed
{
public:
Dexed(int rate);
Dexed(uint8_t maxnotes, int rate);
~Dexed();
// Global methods
@ -1190,11 +1160,15 @@ class Dexed
bool decodeVoice(uint8_t* encoded_data, uint8_t* data);
bool encodeVoice(uint8_t* encoded_data);
bool getVoiceData(uint8_t* data_copy);
void setVoiceDataElement(uint8_t address, uint8_t value);
uint8_t getVoiceDataElement(uint8_t address);
void loadInitVoice(void);
bool loadVoiceParameters(uint8_t* data);
bool loadGlobalParameters(uint8_t* data);
bool initGlobalParameters(void);
void loadVoiceParameters(uint8_t* data);
uint8_t getNumNotesPlaying(void);
uint32_t getXRun(void);
uint16_t getRenderTimeMax(void);
void resetRenderTimeMax(void);
void ControllersRefresh(void);
// Sound methods
void keyup(int16_t pitch);
@ -1204,60 +1178,50 @@ class Dexed
void panic(void);
void notesOff(void);
void resetControllers(void);
void setMasterTune(int8_t mastertune);
int8_t getMasterTune(void);
void setPortamentoMode(uint8_t portamento_mode, uint8_t portamento_glissando, uint8_t portamento_time);
void setPBController(uint8_t pb_range, uint8_t pb_step);
void setMWController(uint8_t mw_range, uint8_t mw_assign, uint8_t mw_mode);
void setFCController(uint8_t fc_range, uint8_t fc_assign, uint8_t fc_mode);
void setBCController(uint8_t bc_range, uint8_t bc_assign, uint8_t bc_mode);
void setATController(uint8_t at_range, uint8_t at_assign, uint8_t at_mode);
void setPortamentoMode(uint8_t portamento_mode, uint8_t portamento_glissando, uint8_t portamento_time);
uint8_t init_voice[156] = {
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, // OP6 eg_rate_1-4, level_1-4, kbd_lev_scl_brk_pt, kbd_lev_scl_lft_depth, kbd_lev_scl_rht_depth, kbd_lev_scl_lft_curve, kbd_lev_scl_rht_curve, kbd_rate_scaling, amp_mod_sensitivity, key_vel_sensitivity, operator_output_level, osc_mode, osc_freq_coarse, osc_freq_fine, osc_detune
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, // OP5
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, // OP4
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, // OP4
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, // OP4
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 99, 00, 01, 00, 00, // OP4
99, 99, 99, 99, 50, 50, 50, 50, // 4 * pitch EG rates, 4 * pitch EG level
01, 00, 01, // algorithm, feedback, osc sync
35, 00, 00, 00, 01, 00, // lfo speed, lfo delay, lfo pitch_mod_depth, lfo_amp_mod_depth, lfo_sync, lfo_waveform
03, 48, // pitch_mod_sensitivity, transpose
73, 78, 73, 84, 32, 86, 79, 73, 67, 69 // 10 * char for name ("INIT VOICE")
}; // INIT
uint8_t data[156];
uint16_t render_time_max = 0;
Controllers controllers;
PluginFx fx;
ProcessorVoice voices[MAX_NOTES];
uint32_t xrun = 0;
protected:
int lastKeyDown;
static const uint8_t MAX_ACTIVE_NOTES = MAX_NOTES;
uint8_t max_notes = MAX_ACTIVE_NOTES;
int16_t currentNote;
bool sustain;
float vuSignal;
bool monoMode;
bool refreshMode;
bool refreshVoice;
uint8_t engineType;
VoiceStatus voiceStatus;
Lfo lfo;
FmCore* engineMsfa;
void getSamples(uint16_t n_samples, int16_t* buffer);
};
//=====================================================
/*****************************************************
CODE: orig_code/synth_microdexed.h
*****************************************************/
class AudioSynthDexed : public AudioStream, public Dexed
{
public:
AudioSynthDexed(uint16_t sample_rate) : AudioStream(0, NULL), Dexed(sample_rate) { };
void setModWheel(uint8_t value);
uint8_t getModWheel(void);
void setBreathController(uint8_t value);
uint8_t getBreathController(void);
void setFootController(uint8_t value);
uint8_t getFootController(void);
void setAftertouch(uint8_t value);
uint8_t getAftertouch(void);
void setPitchbend(int16_t value);
int16_t getPitchbend(void);
void setPitchbendRange(uint8_t range);
uint8_t getPitchbendRange(void);
void setPitchbendStep(uint8_t step);
uint8_t getPitchbendStep(void);
void setModWheelRange(uint8_t range);
uint8_t getModWheelRange(void);
void setModWheelTarget(uint8_t target);
uint8_t getModWheelTarget(void);
void setFootControllerRange(uint8_t range);
uint8_t getFootControllerRange(void);
void setFootControllerTarget(uint8_t target);
uint8_t getFootControllerTarget(void);
void setBreathControllerRange(uint8_t range);
uint8_t getBreathControllerRange(void);
void setBreathControllerTarget(uint8_t target);
uint8_t getBreathControllerTarget(void);
void setAftertouchRange(uint8_t range);
uint8_t getAftertouchRange(void);
void setAftertouchTarget(uint8_t target);
uint8_t getAftertouchTarget(void);
void setFilterCutoff(float cutoff);
float getFilterCutoff(void);
void setFilterResonance(float resonance);
float getFilterResonance(void);
void setGain(float gain);
float getGain(void);
// Voice configuration methods
void setOPRateAll(uint8_t rate);
@ -1325,6 +1289,52 @@ class AudioSynthDexed : public AudioStream, public Dexed
void setName(char* name);
void getName(char* buffer);
ProcessorVoice* voices;
protected:
uint8_t init_voice[NUM_VOICE_PARAMETERS] = {
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, // OP6 eg_rate_1-4, level_1-4, kbd_lev_scl_brk_pt, kbd_lev_scl_lft_depth, kbd_lev_scl_rht_depth, kbd_lev_scl_lft_curve, kbd_lev_scl_rht_curve, kbd_rate_scaling, amp_mod_sensitivity, key_vel_sensitivity, operator_output_level, osc_mode, osc_freq_coarse, osc_freq_fine, osc_detune
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, // OP5
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, // OP4
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, // OP4
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, // OP4
99, 99, 99, 99, 99, 99, 99, 00, 33, 00, 00, 00, 00, 00, 00, 00, 99, 00, 01, 00, 00, // OP4
99, 99, 99, 99, 50, 50, 50, 50, // 4 * pitch EG rates, 4 * pitch EG level
01, 00, 01, // algorithm, feedback, osc sync
35, 00, 00, 00, 01, 00, // lfo speed, lfo delay, lfo pitch_mod_depth, lfo_amp_mod_depth, lfo_sync, lfo_waveform
03, 48, // pitch_mod_sensitivity, transpose
73, 78, 73, 84, 32, 86, 79, 73, 67, 69 // 10 * char for name ("INIT VOICE")
};
uint8_t data[NUM_VOICE_PARAMETERS];
uint8_t max_notes;
PluginFx fx;
Controllers controllers;
int lastKeyDown;
uint32_t xrun;
uint16_t render_time_max;
int16_t currentNote;
bool sustain;
float vuSignal;
bool monoMode;
bool refreshMode;
bool refreshVoice;
uint8_t engineType;
VoiceStatus voiceStatus;
Lfo lfo;
FmCore* engineMsfa;
void getSamples(uint16_t n_samples, int16_t* buffer);
};
//=====================================================
/*****************************************************
CODE: orig_code/synth_microdexed.h
*****************************************************/
class AudioSynthDexed : public AudioStream, public Dexed
{
public:
AudioSynthDexed(uint8_t max_notes, uint16_t sample_rate) : AudioStream(0, NULL), Dexed(max_notes,sample_rate) { };
protected:
const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES);
volatile bool in_update = false;

Loading…
Cancel
Save