|
|
@ -39,9 +39,13 @@ |
|
|
|
#include "PluginFx.h" |
|
|
|
#include "PluginFx.h" |
|
|
|
#include "SoftenValue.hpp" |
|
|
|
#include "SoftenValue.hpp" |
|
|
|
#include "UI.hpp" |
|
|
|
#include "UI.hpp" |
|
|
|
|
|
|
|
#include "source_microdexed.h" |
|
|
|
|
|
|
|
|
|
|
|
AudioPlayQueue queue1; |
|
|
|
|
|
|
|
AudioAnalyzePeak peak1; |
|
|
|
AudioAnalyzePeak peak1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AudioSourceMicroDexed microdexed1; |
|
|
|
|
|
|
|
//AudioPlayQueue queue1;
|
|
|
|
|
|
|
|
|
|
|
|
AudioEffectDelay delay1; |
|
|
|
AudioEffectDelay delay1; |
|
|
|
AudioEffectModulatedDelay modchorus; |
|
|
|
AudioEffectModulatedDelay modchorus; |
|
|
|
AudioSynthWaveform modulator; |
|
|
|
AudioSynthWaveform modulator; |
|
|
@ -54,11 +58,11 @@ AudioAmplifier volume_l; |
|
|
|
AudioOutputUSB usb1; |
|
|
|
AudioOutputUSB usb1; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
AudioEffectStereoMono stereomono1; |
|
|
|
AudioEffectStereoMono stereomono1; |
|
|
|
AudioConnection patchCord0(queue1, peak1); |
|
|
|
AudioConnection patchCord0(microdexed1, peak1); |
|
|
|
AudioConnection patchCord1(queue1, 0, delay_fb_mixer, 0); |
|
|
|
AudioConnection patchCord1(microdexed1, 0, delay_fb_mixer, 0); |
|
|
|
AudioConnection patchCord2(queue1, 0, modchorus, 0); |
|
|
|
AudioConnection patchCord2(microdexed1, 0, modchorus, 0); |
|
|
|
AudioConnection patchCord3(queue1, 0 , master_mixer_r, 0); |
|
|
|
AudioConnection patchCord3(microdexed1, 0 , master_mixer_r, 0); |
|
|
|
AudioConnection patchCord4(queue1, 0 , master_mixer_l, 0); |
|
|
|
AudioConnection patchCord4(microdexed1, 0 , master_mixer_l, 0); |
|
|
|
AudioConnection patchCord5(modulator, 0, modchorus, 1); |
|
|
|
AudioConnection patchCord5(modulator, 0, modchorus, 1); |
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
AudioFilterBiquad modchorus_filter; |
|
|
|
AudioFilterBiquad modchorus_filter; |
|
|
@ -71,8 +75,8 @@ AudioConnection patchCord10(modchorus, 0, master_mixer_l, 3); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#if defined(USE_REVERB) |
|
|
|
#if defined(USE_REVERB) |
|
|
|
AudioEffectFreeverbStereo freeverbs1; |
|
|
|
AudioEffectFreeverbStereo freeverbs1; |
|
|
|
AudioConnection patchCord11(queue1, 0, freeverbs1, 0); |
|
|
|
AudioConnection patchCord11(microdexed1, 0, freeverbs1, 0); |
|
|
|
AudioConnection patchCord12(queue1, 0, freeverbs1, 1); |
|
|
|
AudioConnection patchCord12(microdexed1, 0, freeverbs1, 1); |
|
|
|
AudioConnection patchCord13(freeverbs1, 0, master_mixer_r, 1); |
|
|
|
AudioConnection patchCord13(freeverbs1, 0, master_mixer_r, 1); |
|
|
|
AudioConnection patchCord14(freeverbs1, 1, master_mixer_l, 1); |
|
|
|
AudioConnection patchCord14(freeverbs1, 1, master_mixer_l, 1); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -122,10 +126,7 @@ AudioConnection patchCord37(stereomono1, 1, dacOut, 1); |
|
|
|
Dexed* MicroDexed[NUM_DEXED]; |
|
|
|
Dexed* MicroDexed[NUM_DEXED]; |
|
|
|
|
|
|
|
|
|
|
|
bool sd_card_available = false; |
|
|
|
bool sd_card_available = false; |
|
|
|
uint32_t xrun = 0; |
|
|
|
|
|
|
|
uint32_t overload = 0; |
|
|
|
|
|
|
|
uint32_t peak = 0; |
|
|
|
|
|
|
|
uint16_t render_time_max = 0; |
|
|
|
|
|
|
|
uint8_t max_loaded_banks = 0; |
|
|
|
uint8_t max_loaded_banks = 0; |
|
|
|
char bank_name[BANK_NAME_LEN]; |
|
|
|
char bank_name[BANK_NAME_LEN]; |
|
|
|
char voice_name[VOICE_NAME_LEN]; |
|
|
|
char voice_name[VOICE_NAME_LEN]; |
|
|
@ -139,12 +140,15 @@ elapsedMillis long_button_pressed; |
|
|
|
SoftenValue <uint8_t> soften_volume; |
|
|
|
SoftenValue <uint8_t> soften_volume; |
|
|
|
SoftenValue <uint8_t> soften_filter_res[NUM_DEXED]; |
|
|
|
SoftenValue <uint8_t> soften_filter_res[NUM_DEXED]; |
|
|
|
SoftenValue <uint8_t> soften_filter_cut[NUM_DEXED]; |
|
|
|
SoftenValue <uint8_t> soften_filter_cut[NUM_DEXED]; |
|
|
|
elapsedMicros fill_audio_buffer; |
|
|
|
//elapsedMicros fill_audio_buffer;
|
|
|
|
elapsedMillis control_rate; |
|
|
|
elapsedMillis control_rate; |
|
|
|
uint8_t active_voices = 0; |
|
|
|
uint8_t active_voices = 0; |
|
|
|
#ifdef SHOW_CPU_LOAD_MSEC |
|
|
|
#ifdef SHOW_CPU_LOAD_MSEC |
|
|
|
elapsedMillis cpu_mem_millis; |
|
|
|
elapsedMillis cpu_mem_millis; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
uint32_t overload = 0; |
|
|
|
|
|
|
|
uint32_t peak = 0; |
|
|
|
|
|
|
|
|
|
|
|
config_t configuration; |
|
|
|
config_t configuration; |
|
|
|
|
|
|
|
|
|
|
|
bool eeprom_update_flag = false; |
|
|
|
bool eeprom_update_flag = false; |
|
|
@ -152,6 +156,7 @@ bool eeprom_update_flag = false; |
|
|
|
// Allocate the delay lines for left and right channels
|
|
|
|
// Allocate the delay lines for left and right channels
|
|
|
|
short delayline[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
short delayline[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_LCD_UI |
|
|
|
#ifdef ENABLE_LCD_UI |
|
|
|
/***********************************************************************
|
|
|
|
/***********************************************************************
|
|
|
|
LCDMenuLib2 |
|
|
|
LCDMenuLib2 |
|
|
@ -188,8 +193,9 @@ void setup() |
|
|
|
Serial.print(F("Creating MicroDexed engine ")); |
|
|
|
Serial.print(F("Creating MicroDexed engine ")); |
|
|
|
Serial.println(i, DEC); |
|
|
|
Serial.println(i, DEC); |
|
|
|
MicroDexed[i] = new Dexed(SAMPLE_RATE); |
|
|
|
MicroDexed[i] = new Dexed(SAMPLE_RATE); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
microdexed1.setDexeds(NUM_DEXED, MicroDexed); |
|
|
|
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")); |
|
|
@ -394,11 +400,14 @@ void setup() |
|
|
|
|
|
|
|
|
|
|
|
void loop() |
|
|
|
void loop() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef OLD |
|
|
|
int16_t* audio_buffer; // pointer to AUDIO_BLOCK_SAMPLES * int16_t
|
|
|
|
int16_t* audio_buffer; // pointer to AUDIO_BLOCK_SAMPLES * int16_t
|
|
|
|
const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES); |
|
|
|
const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
while (42 == 42) |
|
|
|
//while (42 == 42)
|
|
|
|
{ |
|
|
|
//{
|
|
|
|
|
|
|
|
#ifdef OLD |
|
|
|
// Main sound calculation
|
|
|
|
// Main sound calculation
|
|
|
|
if (queue1.available() && fill_audio_buffer > audio_block_time_us - 10) |
|
|
|
if (queue1.available() && fill_audio_buffer > audio_block_time_us - 10) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -422,6 +431,7 @@ void loop() |
|
|
|
} |
|
|
|
} |
|
|
|
queue1.playBuffer(); |
|
|
|
queue1.playBuffer(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// EEPROM update handling
|
|
|
|
// EEPROM update handling
|
|
|
|
if (autostore >= AUTOSTORE_MS && active_voices == 0 && eeprom_update_flag == true) |
|
|
|
if (autostore >= AUTOSTORE_MS && active_voices == 0 && eeprom_update_flag == true) |
|
|
@ -504,11 +514,16 @@ void loop() |
|
|
|
#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) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (peak1.available()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (peak1.read() > 0.99) |
|
|
|
|
|
|
|
peak++; |
|
|
|
|
|
|
|
} |
|
|
|
cpu_mem_millis -= SHOW_CPU_LOAD_MSEC; |
|
|
|
cpu_mem_millis -= SHOW_CPU_LOAD_MSEC; |
|
|
|
show_cpu_and_mem_usage(); |
|
|
|
show_cpu_and_mem_usage(); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
//}
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
/******************************************************************************
|
|
|
@ -526,7 +541,7 @@ void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (checkMidiChannel(inChannel)) |
|
|
|
if (checkMidiChannel(inChannel)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
MicroDexed[0]->keyup(inNumber); |
|
|
|
MicroDexed[0]->keyup(inNumber); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1139,9 +1154,9 @@ void show_cpu_and_mem_usage(void) |
|
|
|
Serial.print(F(" MEM MAX: ")); |
|
|
|
Serial.print(F(" MEM MAX: ")); |
|
|
|
Serial.print(AudioMemoryUsageMax(), DEC); |
|
|
|
Serial.print(AudioMemoryUsageMax(), DEC); |
|
|
|
Serial.print(F(" RENDER_TIME_MAX: ")); |
|
|
|
Serial.print(F(" RENDER_TIME_MAX: ")); |
|
|
|
Serial.print(render_time_max, DEC); |
|
|
|
Serial.print(microdexed1.render_time_max, DEC); |
|
|
|
Serial.print(F(" XRUN: ")); |
|
|
|
Serial.print(F(" XRUN: ")); |
|
|
|
Serial.print(xrun, DEC); |
|
|
|
Serial.print(microdexed1.xrun, DEC); |
|
|
|
Serial.print(F(" OVERLOAD: ")); |
|
|
|
Serial.print(F(" OVERLOAD: ")); |
|
|
|
Serial.print(overload, DEC); |
|
|
|
Serial.print(overload, DEC); |
|
|
|
Serial.print(F(" PEAK: ")); |
|
|
|
Serial.print(F(" PEAK: ")); |
|
|
@ -1153,7 +1168,7 @@ void show_cpu_and_mem_usage(void) |
|
|
|
Serial.println(); |
|
|
|
Serial.println(); |
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
AudioMemoryUsageMaxReset(); |
|
|
|
AudioMemoryUsageMaxReset(); |
|
|
|
render_time_max = 0; |
|
|
|
microdexed1.render_time_max = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|