Merge remote-tracking branch 'upstream/dev' into dev

Removed all new audio FX
pull/3/head
Dirk Niggemann 5 years ago
commit f6d555b046
  1. 379
      MicroDexed.ino
  2. 106
      SoftenValue.hpp
  3. 3
      config.h
  4. 8
      dexed.cpp
  5. 4
      dexed_sysex.cpp
  6. 9689
      hex/MicroDexed_T3.5.ino.hex
  7. 10283
      hex/MicroDexed_T3.6.ino.hex

@ -37,26 +37,22 @@
#include "dexed_sysex.h" #include "dexed_sysex.h"
#include "effect_modulated_delay.h" #include "effect_modulated_delay.h"
#include "PluginFx.h" #include "PluginFx.h"
#include "SoftenValue.hpp"
AudioPlayQueue dexed1; AudioPlayQueue queue1;
AudioAnalyzePeak peak1; AudioAnalyzePeak peak1;
AudioEffectDelay delay_r; AudioEffectDelay delay1;
AudioEffectDelay delay_l; #ifdef USE_REVERB
AudioEffectFreeverbStereo freeverbs1; AudioEffectFreeverbStereo freeverbs1;
AudioEffectModulatedDelay modchorus_r; #endif
AudioEffectModulatedDelay modchorus_l; AudioEffectModulatedDelay modchorus;
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
AudioFilterBiquad modchorus_filter_r; AudioFilterBiquad modchorus_filter;
AudioFilterBiquad modchorus_filter_l;
#endif #endif
AudioSynthWaveform modulator; AudioSynthWaveform modulator;
AudioAmplifier inverter; AudioMixer4 chorus_mixer;
AudioMixer4 chorus_mixer_r; AudioMixer4 delay_mixer;
AudioMixer4 chorus_mixer_l; AudioMixer4 delay_fb_mixer;
AudioMixer4 delay_mixer_r;
AudioMixer4 delay_mixer_l;
AudioMixer4 delay_fb_mixer_r;
AudioMixer4 delay_fb_mixer_l;
AudioMixer4 reverb_mixer_r; AudioMixer4 reverb_mixer_r;
AudioMixer4 reverb_mixer_l; AudioMixer4 reverb_mixer_l;
AudioAmplifier volume_r; AudioAmplifier volume_r;
@ -64,68 +60,63 @@ AudioAmplifier volume_l;
#if defined(AUDIO_DEVICE_USB) #if defined(AUDIO_DEVICE_USB)
AudioOutputUSB usb1; AudioOutputUSB usb1;
#endif #endif
AudioConnection patchCord0(dexed1, peak1); AudioConnection patchCord0(queue1, peak1);
AudioConnection patchCord1(dexed1, 0, chorus_mixer_r, 0); AudioConnection patchCord1(queue1, 0, chorus_mixer, 0);
AudioConnection patchCord2(dexed1, 0, chorus_mixer_l, 0); AudioConnection patchCord3(queue1, 0, delay_mixer, 0);
AudioConnection patchCord3(dexed1, 0, delay_mixer_r, 0); AudioConnection patchCord4(queue1, 0, delay_fb_mixer, 0);
AudioConnection patchCord4(dexed1, 0, delay_mixer_l, 0); #ifdef USE_REVERB
AudioConnection patchCord5(dexed1, 0, delay_fb_mixer_r, 0); AudioConnection patchCord5(queue1, 0, reverb_mixer_r, 0);
AudioConnection patchCord6(dexed1, 0, delay_fb_mixer_l, 0); AudioConnection patchCord6(queue1, 0, reverb_mixer_l, 0);
AudioConnection patchCord7(dexed1, 0, reverb_mixer_r, 0); #endif
AudioConnection patchCord8(dexed1, 0, reverb_mixer_l, 0); AudioConnection patchCord7(queue1, 0, modchorus, 0);
AudioConnection patchCord9(dexed1, 0, modchorus_r, 0); AudioConnection patchCord8(modulator, 0, modchorus, 1);
AudioConnection patchCord10(dexed1, 0, modchorus_l, 0);
AudioConnection patchCord11(modulator, 0, modchorus_r, 1);
AudioConnection patchCord12(modulator, inverter);
AudioConnection patchCord13(inverter, 0, modchorus_l, 1);
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
AudioConnection patchCord14(modchorus_r, modchorus_filter_r); AudioConnection patchCord9(modchorus, modchorus_filter);
AudioConnection patchCord15(modchorus_l, modchorus_filter_l); AudioConnection patchCord10(modchorus_filter, 0, chorus_mixer, 1);
AudioConnection patchCord16(modchorus_filter_r, 0, chorus_mixer_r, 1); #else
AudioConnection patchCord17(modchorus_filter_l, 0, chorus_mixer_l, 1); AudioConnection patchCord9(modchorus, 0, chorus_mixer, 1);
#endif
AudioConnection patchCord11(chorus_mixer, 0, delay_mixer, 1);
AudioConnection patchCord12(delay_fb_mixer, 0, delay_mixer, 1);
AudioConnection patchCord13(delay_mixer, 0, reverb_mixer_r, 0);
AudioConnection patchCord14(delay_mixer, 0, reverb_mixer_l, 0);
AudioConnection patchCord15(delay1, 0, delay_mixer, 2);
AudioConnection patchCord16(delay_fb_mixer, delay1);
#ifdef USE_REVERB
AudioConnection patchCord17(delay_mixer, 0, freeverbs1, 0);
AudioConnection patchCord18(delay_mixer, 0, freeverbs1, 1);
AudioConnection patchCord19(freeverbs1, 0, reverb_mixer_r, 1);
AudioConnection patchCord20(freeverbs1, 1, reverb_mixer_l, 1);
AudioConnection patchCord21(reverb_mixer_r, volume_r);
AudioConnection patchCord22(reverb_mixer_l, volume_l);
#else #else
AudioConnection patchCord14(modchorus_r, 0, chorus_mixer_r, 1); AudioConnection patchCord17(delay_mixer, volume_r);
AudioConnection patchCord15(modchorus_l, 0, chorus_mixer_l, 1); AudioConnection patchCord18(delay_mixer, volume_l);
#endif #endif
AudioConnection patchCord18(chorus_mixer_r, 0, delay_mixer_r, 1);
AudioConnection patchCord19(chorus_mixer_l, 0, delay_mixer_l, 1);
AudioConnection patchCord20(delay_fb_mixer_r, 0, delay_mixer_r, 1);
AudioConnection patchCord21(delay_fb_mixer_l, 0, delay_mixer_l, 1);
AudioConnection patchCord22(delay_mixer_r, 0, reverb_mixer_r, 1);
AudioConnection patchCord23(delay_mixer_l, 0, reverb_mixer_l, 1);
AudioConnection patchCord24(delay_r, 0, delay_mixer_r, 2);
AudioConnection patchCord25(delay_l, 0, delay_mixer_l, 2);
AudioConnection patchCord26(delay_fb_mixer_r, delay_r);
AudioConnection patchCord27(delay_fb_mixer_l, delay_l);
AudioConnection patchCord28(delay_mixer_r, 0, freeverbs1, 1);
AudioConnection patchCord29(delay_mixer_l, 0, freeverbs1, 1);
AudioConnection patchCord30(freeverbs1, 0, reverb_mixer_r, 1);
AudioConnection patchCord31(freeverbs1, 1, reverb_mixer_l, 1);
AudioConnection patchCord32(reverb_mixer_r, volume_r);
AudioConnection patchCord33(reverb_mixer_l, volume_l);
#if defined(AUDIO_DEVICE_USB) #if defined(AUDIO_DEVICE_USB)
AudioConnection patchCord34(volume_r, 0, usb1, 0); AudioConnection patchCord23(volume_r, 0, usb1, 0);
AudioConnection patchCord35(volume_l, 0, usb1, 1); AudioConnection patchCordcw2435(volume_l, 0, usb1, 1);
#endif #endif
#if defined(TEENSY_AUDIO_BOARD) || defined (I2S_AUDIO_ONLY) #if defined(TEENSY_AUDIO_BOARD) || defined (I2S_AUDIO_ONLY)
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord36(volume_r, 0, i2s1, 0); AudioConnection patchCord25(volume_r, 0, i2s1, 0);
AudioConnection patchCord37(volume_l, 0, i2s1, 1); AudioConnection patchCord26(volume_l, 0, i2s1, 1);
#endif #endif
#if defined(TEENSY_AUDIO_BOARD) #if defined(TEENSY_AUDIO_BOARD)
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#elif defined(TGA_AUDIO_BOARD) #elif defined(TGA_AUDIO_BOARD)
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord36(volume_r, 0, i2s1, 0); AudioConnection patchCord27(volume_r, 0, i2s1, 0);
AudioConnection patchCord37(volume_l, 0, i2s1, 1); AudioConnection patchCord28(volume_l, 0, i2s1, 1);
AudioControlWM8731master wm8731_1; AudioControlWM8731master wm8731_1;
#elif !defined(I2S_AUDIO_ONLY) #elif !defined(I2S_AUDIO_ONLY)
AudioOutputPT8211 pt8211_1; AudioOutputPT8211 pt8211_1;
AudioConnection patchCord36(volume_r, 0, pt8211_1, 0); AudioConnection patchCord29(volume_r, 0, pt8211_1, 0);
AudioConnection patchCord37(volume_l, 0, pt8211_1, 1); AudioConnection patchCord30(volume_l, 0, pt8211_1, 1);
#endif #endif
Dexed* dexed = new Dexed(SAMPLE_RATE); Dexed* MicroDexed[NUM_DEXED];
bool sd_card_available = false; bool sd_card_available = false;
uint32_t xrun = 0; uint32_t xrun = 0;
uint32_t overload = 0; uint32_t overload = 0;
@ -141,6 +132,9 @@ uint8_t midi_timing_counter = 0; // 24 per qarter
elapsedMillis midi_timing_timestep; elapsedMillis midi_timing_timestep;
uint16_t midi_timing_quarter = 0; uint16_t midi_timing_quarter = 0;
elapsedMillis long_button_pressed; elapsedMillis long_button_pressed;
//SoftenValue <uint8_t> effect_filter_volume[NUM_DEXED](SOFTEN_VALUE_CHANGE_STEPS);
//SoftenValue <uint8_t> soften_filter_res[NUM_DEXED](SOFTEN_VALUE_CHANGE_STEPS);
//SoftenValue <uint8_t> soften_filter_cut[NUM_DEXED](SOFTEN_VALUE_CHANGE_STEPS);
uint8_t effect_filter_cutoff = 0; uint8_t effect_filter_cutoff = 0;
uint8_t effect_filter_resonance = 0; uint8_t effect_filter_resonance = 0;
uint8_t effect_delay_time = 0; uint8_t effect_delay_time = 0;
@ -160,8 +154,7 @@ value_change_t soften_filter_res = {0.0, 0};
value_change_t soften_filter_cut = {0.0, 0}; value_change_t soften_filter_cut = {0.0, 0};
// Allocate the delay lines for left and right channels // Allocate the delay lines for left and right channels
short l_delayline[MOD_DELAY_SAMPLE_BUFFER]; short delayline[MOD_DELAY_SAMPLE_BUFFER];
short r_delayline[MOD_DELAY_SAMPLE_BUFFER];
#ifdef ENABLE_LCD_UI #ifdef ENABLE_LCD_UI
/*********************************************************************** /***********************************************************************
@ -190,6 +183,13 @@ void setup()
Serial.println(F("NO LCD DISPLAY ENABLED!")); Serial.println(F("NO LCD DISPLAY ENABLED!"));
#endif #endif
for (uint8_t i = 0; i < NUM_DEXED; i++)
{
Serial.print(F("Creating MicroDexed engine "));
Serial.println(i, DEC);
MicroDexed[i] = new Dexed(SAMPLE_RATE);
}
delay(220); delay(220);
Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed")); Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed"));
@ -292,14 +292,10 @@ void setup()
} }
change_disp_sd(true); change_disp_sd(true);
// Init effects // Init effects
if (!modchorus_r.begin(r_delayline, MOD_DELAY_SAMPLE_BUFFER)) { if (!modchorus.begin(delayline, MOD_DELAY_SAMPLE_BUFFER)) {
Serial.println(F("AudioEffectModulatedDelay - right channel begin failed")); Serial.println(F("AudioEffectModulatedDelay - right channel begin failed"));
while (1); while (1);
} }
if (!modchorus_l.begin(l_delayline, MOD_DELAY_SAMPLE_BUFFER)) {
Serial.println(F("AudioEffectModulatedDelay - left channel begin failed"));
while (1);
}
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("MOD_DELAY_SAMPLE_BUFFER=")); Serial.print(F("MOD_DELAY_SAMPLE_BUFFER="));
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC); Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC);
@ -311,47 +307,41 @@ void setup()
modulator.offset(0.0); modulator.offset(0.0);
#if MOD_FILTER_OUTPUT == MOD_BUTTERWORTH_FILTER_OUTPUT #if MOD_FILTER_OUTPUT == MOD_BUTTERWORTH_FILTER_OUTPUT
// Butterworth filter, 12 db/octave // Butterworth filter, 12 db/octave
modchorus_filter_r.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707); modchorus_filter.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707);
modchorus_filter_l.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707);
#elif MOD_FILTER_OUTPUT == MOD_LINKWITZ_RILEY_FILTER_OUTPUT #elif MOD_FILTER_OUTPUT == MOD_LINKWITZ_RILEY_FILTER_OUTPUT
// Linkwitz-Riley filter, 48 dB/octave // Linkwitz-Riley filter, 48 dB/octave
modchorus_filter_r.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54); modchorus_filter.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54);
modchorus_filter_r.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3); modchorus_filter.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3);
modchorus_filter_r.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54); modchorus_filter.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54);
modchorus_filter_r.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); modchorus_filter.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3);
modchorus_filter_l.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54); modchorus_filter.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54);
modchorus_filter_l.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3); modchorus_filter.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3);
modchorus_filter_l.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54); modchorus_filter.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54);
modchorus_filter_l.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); modchorus_filter.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3);
#endif #endif
chorus_mixer_r.gain(0, 1.0); chorus_mixer.gain(0, 1.0);
chorus_mixer_l.gain(0, 1.0); chorus_mixer.gain(1, 0.0);
chorus_mixer_r.gain(1, 0.0);
chorus_mixer_l.gain(1, 0.0); delay1.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME));
// delay_fb_mixer is the feedback-adding mixer, delay_mixer_r the whole delay (with/without feedback) mixer
delay_r.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); delay_fb_mixer.gain(0, 1.0); // original signal
delay_l.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); delay_fb_mixer.gain(1, mapfloat(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); // amount of feedback
// delay_fb_mixer_r is the feedback-adding mixer, delay_mixer_r the whole delay (with/without feedback) mixer delay_mixer.gain(0, 1.0 - mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // original signal
delay_fb_mixer_r.gain(0, 1.0); // original signal delay_mixer.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delayed signal (including feedback)
delay_fb_mixer_l.gain(0, 1.0); // original signal delay_mixer.gain(2, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // only delayed signal (without feedback)
delay_fb_mixer_r.gain(1, mapfloat(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); // amount of feedback
delay_fb_mixer_l.gain(1, mapfloat(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); // amount of feedback
delay_mixer_r.gain(0, 1.0 - mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // original signal
delay_mixer_l.gain(0, 1.0 - mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // original signal
delay_mixer_r.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delayed signal (including feedback)
delay_mixer_l.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delayed signal (including feedback)
delay_mixer_r.gain(2, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // only delayed signal (without feedback)
delay_mixer_l.gain(2, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // only delayed signal (without feedback)
reverb_mixer_r.gain(0, 1.0); reverb_mixer_r.gain(0, 1.0);
reverb_mixer_l.gain(0, 1.0); reverb_mixer_l.gain(0, 1.0);
reverb_mixer_r.gain(1, 0.0); reverb_mixer_r.gain(1, 0.0);
reverb_mixer_l.gain(1, 0.0); reverb_mixer_l.gain(1, 0.0);
dexed->fx.Gain = 1.0; for (uint8_t i = 0; i < NUM_DEXED; i++)
dexed->fx.Reso = 1.0 - float(effect_filter_resonance) / ENC_FILTER_RES_STEPS; {
dexed->fx.Cutoff = 1.0 - float(effect_filter_cutoff) / ENC_FILTER_CUT_STEPS; MicroDexed[i]->fx.Gain = 1.0;
MicroDexed[i]->fx.Reso = 1.0 - float(effect_filter_resonance) / ENC_FILTER_RES_STEPS;
MicroDexed[i]->fx.Cutoff = 1.0 - float(effect_filter_cutoff) / ENC_FILTER_CUT_STEPS;
}
// set initial volume and pan (read from EEPROM) // set initial volume and pan (read from EEPROM)
set_volume(configuration.vol, configuration.pan); set_volume(configuration.vol, configuration.pan);
@ -394,14 +384,17 @@ void loop()
while (42 == 42) while (42 == 42)
{ {
// Main sound calculation // Main sound calculation
if (dexed1.available() && fill_audio_buffer > audio_block_time_us - 10) if (queue1.available() && fill_audio_buffer > audio_block_time_us - 10)
{ {
fill_audio_buffer = 0; fill_audio_buffer = 0;
audio_buffer = dexed1.getBuffer(); audio_buffer = queue1.getBuffer();
elapsedMicros t1; elapsedMicros t1;
dexed->getSamples(AUDIO_BLOCK_SAMPLES, audio_buffer); for (uint8_t i = 0; i < NUM_DEXED; i++)
{
MicroDexed[i]->getSamples(AUDIO_BLOCK_SAMPLES, audio_buffer);
}
if (t1 > audio_block_time_us) // everything greater 2.9ms is a buffer underrun! if (t1 > audio_block_time_us) // everything greater 2.9ms is a buffer underrun!
xrun++; xrun++;
if (t1 > render_time_max) if (t1 > render_time_max)
@ -415,7 +408,7 @@ void loop()
for (uint8_t i = 0; i < AUDIO_BLOCK_SAMPLES; i++) for (uint8_t i = 0; i < AUDIO_BLOCK_SAMPLES; i++)
audio_buffer[i] *= configuration.vol; audio_buffer[i] *= configuration.vol;
#endif #endif
dexed1.playBuffer(); queue1.playBuffer();
} }
// EEPROM update handling // EEPROM update handling
@ -446,7 +439,10 @@ void loop()
control_rate = 0; control_rate = 0;
// Shutdown unused voices // Shutdown unused voices
active_voices = dexed->getNumNotesPlaying(); for (uint8_t i = 0; i < NUM_DEXED; i++)
{
active_voices = MicroDexed[i]->getNumNotesPlaying();
}
// check for value changes // check for value changes
if (soften_volume.steps > 0) if (soften_volume.steps > 0)
@ -467,24 +463,30 @@ void loop()
{ {
// soften filter resonance value // soften filter resonance value
soften_filter_res.steps--; soften_filter_res.steps--;
dexed->fx.Reso = dexed->fx.Reso + soften_filter_res.diff; for (uint8_t i = 0; i < NUM_DEXED; i++)
{
MicroDexed[i]->fx.Reso = MicroDexed[i]->fx.Reso + soften_filter_res.diff;
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Filter-Resonance: ")); Serial.print(F("Filter-Resonance: "));
Serial.print(dexed->fx.Reso, 5); Serial.print(MicroDexed[i]->fx.Reso, 5);
Serial.print(F(" Filter-Resonance step: ")); Serial.print(F(" Filter-Resonance step: "));
Serial.print(soften_filter_res.steps); Serial.print(soften_filter_res.steps);
Serial.print(F(" Filter-Resonance diff: ")); Serial.print(F(" Filter-Resonance diff: "));
Serial.println(soften_filter_res.diff, 5); Serial.println(soften_filter_res.diff, 5);
#endif #endif
} }
}
if (soften_filter_cut.steps > 0) if (soften_filter_cut.steps > 0)
{ {
// soften filter cutoff value // soften filter cutoff value
soften_filter_cut.steps--; soften_filter_cut.steps--;
dexed->fx.Cutoff = dexed->fx.Cutoff + soften_filter_cut.diff; for (uint8_t i = 0; i < NUM_DEXED; i++)
{
MicroDexed[i]->fx.Cutoff = MicroDexed[i]->fx.Cutoff + soften_filter_cut.diff;
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Filter-Cutoff: ")); Serial.print(F("Filter-Cutoff: "));
Serial.print(dexed->fx.Cutoff, 5); Serial.print(MicroDexed[i]->fx.Cutoff, 5);
Serial.print(F(" Filter-Cutoff step: ")); Serial.print(F(" Filter-Cutoff step: "));
Serial.print(soften_filter_cut.steps); Serial.print(soften_filter_cut.steps);
Serial.print(F(" Filter-Cutoff diff: ")); Serial.print(F(" Filter-Cutoff diff: "));
@ -492,6 +494,7 @@ void loop()
#endif #endif
} }
} }
}
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) #if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
if (cpu_mem_millis >= SHOW_CPU_LOAD_MSEC) if (cpu_mem_millis >= SHOW_CPU_LOAD_MSEC)
@ -510,7 +513,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
{ {
if (checkMidiChannel(inChannel)) if (checkMidiChannel(inChannel))
{ {
dexed->keydown(inNumber, inVelocity); MicroDexed[0]->keydown(inNumber, inVelocity);
} }
} }
@ -518,7 +521,7 @@ void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity)
{ {
if (checkMidiChannel(inChannel)) if (checkMidiChannel(inChannel))
{ {
dexed->keyup(inNumber); MicroDexed[0]->keyup(inNumber);
} }
} }
@ -541,16 +544,16 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
} }
break; break;
case 1: case 1:
dexed->controllers.modwheel_cc = inValue; MicroDexed[0]->controllers.modwheel_cc = inValue;
dexed->controllers.refresh(); MicroDexed[0]->controllers.refresh();
break; break;
case 2: case 2:
dexed->controllers.breath_cc = inValue; MicroDexed[0]->controllers.breath_cc = inValue;
dexed->controllers.refresh(); MicroDexed[0]->controllers.refresh();
break; break;
case 4: case 4:
dexed->controllers.foot_cc = inValue; MicroDexed[0]->controllers.foot_cc = inValue;
dexed->controllers.refresh(); MicroDexed[0]->controllers.refresh();
break; break;
case 7: // Volume case 7: // Volume
configuration.vol = float(inValue) / 0x7f; configuration.vol = float(inValue) / 0x7f;
@ -564,27 +567,27 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
configuration.bank = inValue; configuration.bank = inValue;
break; break;
case 64: case 64:
dexed->setSustain(inValue > 63); MicroDexed[0]->setSustain(inValue > 63);
if (!dexed->getSustain()) { if (!MicroDexed[0]->getSustain()) {
for (uint8_t note = 0; note < dexed->getMaxNotes(); note++) { for (uint8_t note = 0; note < MicroDexed[0]->getMaxNotes(); note++) {
if (dexed->voices[note].sustained && !dexed->voices[note].keydown) { if (MicroDexed[0]->voices[note].sustained && !MicroDexed[0]->voices[note].keydown) {
dexed->voices[note].dx7_note->keyup(); MicroDexed[0]->voices[note].dx7_note->keyup();
dexed->voices[note].sustained = false; MicroDexed[0]->voices[note].sustained = false;
} }
} }
} }
break; break;
case 103: // CC 103: filter resonance case 103: // CC 103: filter resonance
effect_filter_resonance = map(inValue, 0, 127, 0, ENC_FILTER_RES_STEPS); effect_filter_resonance = map(inValue, 0, 127, 0, ENC_FILTER_RES_STEPS);
dexed->fx.Reso = 1.0 - float(effect_filter_resonance) / ENC_FILTER_RES_STEPS; MicroDexed[0]->fx.Reso = 1.0 - float(effect_filter_resonance) / ENC_FILTER_RES_STEPS;
break; break;
case 104: // CC 104: filter cutoff case 104: // CC 104: filter cutoff
effect_filter_cutoff = map(inValue, 0, 127, 0, ENC_FILTER_CUT_STEPS); effect_filter_cutoff = map(inValue, 0, 127, 0, ENC_FILTER_CUT_STEPS);
dexed->fx.Cutoff = 1.0 - float(effect_filter_cutoff) / ENC_FILTER_CUT_STEPS; MicroDexed[0]->fx.Cutoff = 1.0 - float(effect_filter_cutoff) / ENC_FILTER_CUT_STEPS;
break; break;
case 105: // CC 105: delay time case 105: // CC 105: delay time
effect_delay_time = map(inValue, 0, 127, 0, ENC_DELAY_TIME_STEPS); effect_delay_time = map(inValue, 0, 127, 0, ENC_DELAY_TIME_STEPS);
////delay_r.delay(0, mapfloat(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); ////delay.delay(0, mapfloat(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME));
break; break;
case 106: // CC 106: delay feedback case 106: // CC 106: delay feedback
effect_delay_feedback = map(inValue, 0, 127, 0, ENC_DELAY_FB_STEPS); effect_delay_feedback = map(inValue, 0, 127, 0, ENC_DELAY_FB_STEPS);
@ -595,19 +598,19 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
////delay_mixer_l.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delay tap1 signal (with added feedback) ////delay_mixer_l.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delay tap1 signal (with added feedback)
break; break;
case 120: case 120:
dexed->panic(); MicroDexed[0]->panic();
break; break;
case 121: case 121:
dexed->resetControllers(); MicroDexed[0]->resetControllers();
break; break;
case 123: case 123:
dexed->notesOff(); MicroDexed[0]->notesOff();
break; break;
case 126: case 126:
dexed->setMonoMode(true); MicroDexed[0]->setMonoMode(true);
break; break;
case 127: case 127:
dexed->setMonoMode(false); MicroDexed[0]->setMonoMode(false);
break; break;
} }
} }
@ -615,13 +618,13 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
void handleAfterTouch(byte inChannel, byte inPressure) void handleAfterTouch(byte inChannel, byte inPressure)
{ {
dexed->controllers.aftertouch_cc = inPressure; MicroDexed[0]->controllers.aftertouch_cc = inPressure;
dexed->controllers.refresh(); MicroDexed[0]->controllers.refresh();
} }
void handlePitchBend(byte inChannel, int inPitch) void handlePitchBend(byte inChannel, int inPitch)
{ {
dexed->controllers.values_[kControllerPitch] = inPitch + 0x2000; // -8192 to +8191 --> 0 to 16383 MicroDexed[0]->controllers.values_[kControllerPitch] = inPitch + 0x2000; // -8192 to +8191 --> 0 to 16383
} }
void handleProgramChange(byte inChannel, byte inProgram) void handleProgramChange(byte inChannel, byte inProgram)
@ -713,26 +716,26 @@ void handleSystemExclusive(byte * sysex, uint len)
if (((sysex[3] & 0x7c) >> 2) == 0) if (((sysex[3] & 0x7c) >> 2) == 0)
{ {
dexed->notesOff(); MicroDexed[0]->notesOff();
dexed->data[sysex[4] + ((sysex[3] & 0x03) * 128)] = sysex[5]; // set parameter MicroDexed[0]->data[sysex[4] + ((sysex[3] & 0x03) * 128)] = sysex[5]; // set parameter
dexed->doRefreshVoice(); MicroDexed[0]->doRefreshVoice();
data_index = sysex[4] + ((sysex[3] & 0x03) * 128); data_index = sysex[4] + ((sysex[3] & 0x03) * 128);
} }
else else
{ {
dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET - 63 + sysex[4]] = sysex[5]; // set function parameter MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET - 63 + sysex[4]] = sysex[5]; // set function parameter
dexed->controllers.values_[kControllerPitchRange] = dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE]; MicroDexed[0]->controllers.values_[kControllerPitchRange] = MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE];
dexed->controllers.values_[kControllerPitchStep] = dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP]; MicroDexed[0]->controllers.values_[kControllerPitchStep] = MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP];
dexed->controllers.wheel.setRange(dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE]); MicroDexed[0]->controllers.wheel.setRange(MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE]);
dexed->controllers.wheel.setTarget(dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN]); MicroDexed[0]->controllers.wheel.setTarget(MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN]);
dexed->controllers.foot.setRange(dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE]); MicroDexed[0]->controllers.foot.setRange(MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE]);
dexed->controllers.foot.setTarget(dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN]); MicroDexed[0]->controllers.foot.setTarget(MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN]);
dexed->controllers.breath.setRange(dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE]); MicroDexed[0]->controllers.breath.setRange(MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE]);
dexed->controllers.breath.setTarget(dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN]); MicroDexed[0]->controllers.breath.setTarget(MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN]);
dexed->controllers.at.setRange(dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE]); MicroDexed[0]->controllers.at.setRange(MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE]);
dexed->controllers.at.setTarget(dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN]); MicroDexed[0]->controllers.at.setTarget(MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN]);
dexed->controllers.masterTune = (dexed->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] * 0x4000 << 11) * (1.0 / 12); MicroDexed[0]->controllers.masterTune = (MicroDexed[0]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] * 0x4000 << 11) * (1.0 / 12);
dexed->controllers.refresh(); MicroDexed[0]->controllers.refresh();
data_index = DEXED_GLOBAL_PARAMETER_OFFSET - 63 + sysex[4]; data_index = DEXED_GLOBAL_PARAMETER_OFFSET - 63 + sysex[4];
} }
#ifdef DEBUG #ifdef DEBUG
@ -801,8 +804,8 @@ void handleSystemExclusive(byte * sysex, uint len)
} }
// load sysex-data into voice memory // load sysex-data into voice memory
dexed->loadVoiceParameters(&sysex[6]); MicroDexed[0]->loadVoiceParameters(&sysex[6]);
//dexed->initGlobalParameters(); //MicroDexed[0]->initGlobalParameters();
// manipulate UI names and numbers // manipulate UI names and numbers
strncpy(voice_name, (char *)&sysex[151], sizeof(voice_name) - 1); strncpy(voice_name, (char *)&sysex[151], sizeof(voice_name) - 1);
@ -880,9 +883,9 @@ void handleSystemReset(void)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("MIDI SYSEX RESET")); Serial.println(F("MIDI SYSEX RESET"));
#endif #endif
dexed->notesOff(); MicroDexed[0]->notesOff();
dexed->panic(); MicroDexed[0]->panic();
dexed->resetControllers(); MicroDexed[0]->resetControllers();
} }
/****************************************************************************** /******************************************************************************
@ -919,7 +922,7 @@ void set_volume(float v, float p)
configuration.vol = v; configuration.vol = v;
configuration.pan = p; configuration.pan = p;
dexed->fx.Gain = v; MicroDexed[0]->fx.Gain = v;
uint16_t tmp = v * 1023.0 + 0.5; uint16_t tmp = v * 1023.0 + 0.5;
float tmp2 = configuration.pan; float tmp2 = configuration.pan;
@ -1079,81 +1082,81 @@ void show_patch(void)
Serial.print(6 - i, DEC); Serial.print(6 - i, DEC);
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("R1 | R2 | R3 | R4 | L1 | L2 | L3 | L4 LEV_SCL_BRK_PT | SCL_LEFT_DEPTH | SCL_RGHT_DEPTH"));
Serial.print(dexed->data[(i * 21) + DEXED_OP_EG_R1], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_EG_R1], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_EG_R2], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_EG_R2], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_EG_R3], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_EG_R3], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_EG_R4], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_EG_R4], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_EG_L1], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_EG_L1], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_EG_L2], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_EG_L2], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_EG_L3], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_EG_L3], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_EG_L4], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_EG_L4], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_LEV_SCL_BRK_PT], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_LEV_SCL_BRK_PT], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_SCL_LEFT_DEPTH], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_SCL_LEFT_DEPTH], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.println(dexed->data[(i * 21) + DEXED_OP_SCL_RGHT_DEPTH], DEC); Serial.println(MicroDexed[0]->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.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(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_SCL_LEFT_CURVE], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_SCL_LEFT_CURVE], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_SCL_RGHT_CURVE], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_SCL_RGHT_CURVE], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_OSC_RATE_SCALE], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_OSC_RATE_SCALE], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_AMP_MOD_SENS], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_AMP_MOD_SENS], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_KEY_VEL_SENS], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_KEY_VEL_SENS], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_OUTPUT_LEV], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_OUTPUT_LEV], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_OSC_MODE], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_OSC_MODE], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_FREQ_COARSE], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_FREQ_COARSE], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(dexed->data[(i * 21) + DEXED_OP_FREQ_FINE], DEC); Serial.print(MicroDexed[0]->data[(i * 21) + DEXED_OP_FREQ_FINE], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
Serial.println(dexed->data[(i * 21) + DEXED_OP_OSC_DETUNE], DEC); Serial.println(MicroDexed[0]->data[(i * 21) + DEXED_OP_OSC_DETUNE], DEC);
} }
Serial.println(F("PR1 | PR2 | PR3 | PR4 | PL1 | PL2 | PL3 | PL4")); Serial.println(F("PR1 | PR2 | PR3 | PR4 | PL1 | PL2 | PL3 | PL4"));
Serial.print(F(" ")); Serial.print(F(" "));
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
Serial.print(dexed->data[DEXED_VOICE_OFFSET + i], DEC); Serial.print(MicroDexed[0]->data[DEXED_VOICE_OFFSET + i], DEC);
Serial.print(F(" ")); Serial.print(F(" "));
} }
Serial.println(); Serial.println();
Serial.print(F("ALG: ")); Serial.print(F("ALG: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_ALGORITHM], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_ALGORITHM], DEC);
Serial.print(F("FB: ")); Serial.print(F("FB: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_FEEDBACK], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_FEEDBACK], DEC);
Serial.print(F("OKS: ")); Serial.print(F("OKS: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC], DEC);
Serial.print(F("LFO SPD: ")); Serial.print(F("LFO SPD: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED], DEC);
Serial.print(F("LFO_DLY: ")); Serial.print(F("LFO_DLY: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_LFO_DELAY], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_LFO_DELAY], DEC);
Serial.print(F("LFO PMD: ")); Serial.print(F("LFO PMD: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_DEP], DEC);
Serial.print(F("LFO_AMD: ")); Serial.print(F("LFO_AMD: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_LFO_AMP_MOD_DEP], DEC);
Serial.print(F("LFO_SYNC: ")); Serial.print(F("LFO_SYNC: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_LFO_SYNC], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_LFO_SYNC], DEC);
Serial.print(F("LFO_WAVEFRM: ")); Serial.print(F("LFO_WAVEFRM: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_LFO_WAVE], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_LFO_WAVE], DEC);
Serial.print(F("LFO_PMS: ")); Serial.print(F("LFO_PMS: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS], DEC);
Serial.print(F("TRNSPSE: ")); Serial.print(F("TRNSPSE: "));
Serial.println(dexed->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE], DEC); Serial.println(MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE], DEC);
Serial.print(F("NAME: ")); Serial.print(F("NAME: "));
strncpy(voicename, (char *)&dexed->data[DEXED_VOICE_OFFSET + DEXED_NAME], sizeof(voicename) - 1); strncpy(voicename, (char *)&MicroDexed[0]->data[DEXED_VOICE_OFFSET + DEXED_NAME], sizeof(voicename) - 1);
Serial.print(F("[")); Serial.print(F("["));
Serial.print(voicename); Serial.print(voicename);
Serial.println(F("]")); Serial.println(F("]"));
@ -1161,7 +1164,7 @@ void show_patch(void)
{ {
Serial.print(i, DEC); Serial.print(i, DEC);
Serial.print(F(": ")); Serial.print(F(": "));
Serial.println(dexed->data[i]); Serial.println(MicroDexed[0]->data[i]);
} }
Serial.println(); Serial.println();

@ -0,0 +1,106 @@
/*
MicroDexed
MicroDexed is a port of the Dexed sound engine
(https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6 with audio shield.
Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android
(c)2018 H. Wirtz <wirtz@parasitstudio.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SOFTEN_VALUE_H_INCLUDED
template <class T>
class SoftenValue
{
public:
SoftenValue(uint16_t steps = 10);
SoftenValue(T from, T to, uint16_t steps = 10)
{
_from = from;
_to = to;
_steps = steps;
_diff = (from - to) / _steps;
_calculate();
}
void update_to(T to)
{
_to = to;
_calculate();
}
void update_steps(uint16_t steps)
{
_steps = steps;
_calculate();
}
void tick(void)
{
if (_steps > 0)
{
_from -= _diff;
_steps--;
}
}
bool running(void)
{
if (_steps > 0)
return (true);
else
return (false);
}
uint16_t steps(void)
{
return (_steps);
}
T value(void)
{
if (_steps == 0)
return (_to);
if (std::is_same<T, float>::value)
return (_from);
else
return (round(_from));
}
protected:
float _from;
float _to;
uint16_t _steps;
float _diff;
void _calculate(void)
{
if (_from == _to || _steps <= 0)
{
_steps = 0;
_diff = 0.0;
}
else
_diff = (_from - _to) / _steps;
}
};
#endif

@ -78,6 +78,7 @@
#define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE #define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE
#define MOD_FILTER_OUTPUT MOD_LINKWITZ_RILEY_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT #define MOD_FILTER_OUTPUT MOD_LINKWITZ_RILEY_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT
#define MOD_FILTER_CUTOFF_HZ 3000 #define MOD_FILTER_CUTOFF_HZ 3000
//#define USE_REVERB 1
//************************************************************************************************* //*************************************************************************************************
//* AUDIO SETTINGS //* AUDIO SETTINGS
@ -184,6 +185,8 @@
//************************************************************************************************* //*************************************************************************************************
//* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!! //* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!!
//************************************************************************************************* //*************************************************************************************************
#define NUM_DEXED 1
// MIDI // MIDI
#ifdef MIDI_DEVICE_USB #ifdef MIDI_DEVICE_USB
#define USBCON 1 #define USBCON 1

@ -136,7 +136,7 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer)
int32_t lfovalue = lfo.getsample(); int32_t lfovalue = lfo.getsample();
int32_t lfodelay = lfo.getdelay(); int32_t lfodelay = lfo.getdelay();
for (uint8_t note = 0; note < max_notes; ++note) for (uint8_t note = 0; note < max_notes; note++)
{ {
if (voices[note].live) if (voices[note].live)
{ {
@ -182,7 +182,7 @@ void Dexed::keydown(uint8_t pitch, uint8_t velo) {
return; return;
} }
pitch += data[144] - 24; pitch += data[144] - TRANSPOSE_FIX;
uint8_t note = currentNote; uint8_t note = currentNote;
uint8_t keydown_counter = 0; uint8_t keydown_counter = 0;
@ -233,7 +233,7 @@ void Dexed::keyup(uint8_t pitch) {
pitch += data[144] - TRANSPOSE_FIX; pitch += data[144] - TRANSPOSE_FIX;
uint8_t note; uint8_t note;
for (note = 0; note < max_notes; ++note) { for (note = 0; note < max_notes; note++) {
if ( voices[note].midi_note == pitch && voices[note].keydown ) { if ( voices[note].midi_note == pitch && voices[note].keydown ) {
voices[note].keydown = false; voices[note].keydown = false;
break; break;
@ -492,7 +492,7 @@ bool Dexed::loadPackedVoiceParameters(uint8_t* new_data)
doRefreshVoice(); doRefreshVoice();
//activate(); //activate();
strncpy(voice_name, (char *)&new_data[145], sizeof(voice_name) - 1); strncpy(voice_name, (char *)&new_data[118], sizeof(voice_name) - 1);
voice_name[10] = '\0'; voice_name[10] = '\0';
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Voice [")); Serial.print(F("Voice ["));

@ -31,6 +31,8 @@
#include "dexed_sysex.h" #include "dexed_sysex.h"
#include "config.h" #include "config.h"
extern Dexed* MicroDexed[NUM_DEXED];
void create_sysex_filename(uint8_t b, char* sysex_file_name) void create_sysex_filename(uint8_t b, char* sysex_file_name)
{ {
// init and set name for actual bank // init and set name for actual bank
@ -255,7 +257,7 @@ bool load_sysex(uint8_t b, uint8_t v)
Serial.print(voice_names[v]); Serial.print(voice_names[v]);
Serial.println(F("]")); Serial.println(F("]"));
#endif #endif
return (dexed->loadPackedVoiceParameters(data)); return (MicroDexed[0]->loadPackedVoiceParameters(data));
} }
#ifdef DEBUG #ifdef DEBUG
else else

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save