|
|
|
@ -29,6 +29,7 @@ |
|
|
|
|
#include <EEPROM.h> |
|
|
|
|
#include <SD.h> |
|
|
|
|
#include <SPI.h> |
|
|
|
|
#include "OpenAudio_ArduinoLibrary.h" |
|
|
|
|
#include "midi_devices.hpp" |
|
|
|
|
#include "synth_dexed.h" |
|
|
|
|
#include "dexed_sd.h" |
|
|
|
@ -43,7 +44,8 @@ |
|
|
|
|
#include "UI.hpp" |
|
|
|
|
|
|
|
|
|
// Audio engines
|
|
|
|
|
AudioSynthDexed* MicroDexed[NUM_DEXED]; |
|
|
|
|
AudioSynthDexed_F32* MicroDexed[NUM_DEXED]; |
|
|
|
|
AudioConvert_F32toI16* convertf32toi16[NUM_DEXED]; |
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
AudioSynthWaveform* chorus_modulator[NUM_DEXED]; |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
@ -165,15 +167,19 @@ AudioConnection patchCord24(audio_thru_mixer_l, 0, i2s1, 1); |
|
|
|
|
//
|
|
|
|
|
uint16_t nDynamic = 0; |
|
|
|
|
#if defined(USE_FX) && MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 16]; |
|
|
|
|
//AudioConnection * dynamicConnections[NUM_DEXED * 16];
|
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 17]; |
|
|
|
|
#elif defined(USE_FX) && MOD_FILTER_OUTPUT == MOD_NO_FILTER_OUTPUT |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 15]; |
|
|
|
|
//AudioConnection * dynamicConnections[NUM_DEXED * 15];
|
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 16]; |
|
|
|
|
#else |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 4]; |
|
|
|
|
//AudioConnection * dynamicConnections[NUM_DEXED * 4];
|
|
|
|
|
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_F32(SAMPLE_RATE); |
|
|
|
|
convertf32toi16[instance_id] = new AudioConvert_F32toI16(); |
|
|
|
|
mono2stereo[instance_id] = new AudioEffectMonoStereo(); |
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
chorus_modulator[instance_id] = new AudioSynthWaveform(); |
|
|
|
@ -187,10 +193,15 @@ void create_audio_engine_chain(uint8_t instance_id) |
|
|
|
|
delay_mixer[instance_id] = new AudioMixer4(); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, microdexed_peak_mixer, instance_id); |
|
|
|
|
//dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, microdexed_peak_mixer, instance_id);
|
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *convertf32toi16[instance_id], 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*convertf32toi16[instance_id], 0, microdexed_peak_mixer, instance_id); |
|
|
|
|
|
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *chorus_mixer[instance_id], 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *modchorus[instance_id], 0); |
|
|
|
|
//dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *chorus_mixer[instance_id], 0);
|
|
|
|
|
//dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *modchorus[instance_id], 0);
|
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*convertf32toi16[instance_id], 0, *chorus_mixer[instance_id], 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*convertf32toi16[instance_id], 0, *modchorus[instance_id], 0); |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*chorus_modulator[instance_id], 0, *modchorus_filter[instance_id], 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*modchorus_filter[instance_id], 0, *modchorus[instance_id], 1); |
|
|
|
@ -207,7 +218,8 @@ void create_audio_engine_chain(uint8_t instance_id) |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 0, reverb_mixer_r, instance_id); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 1, reverb_mixer_l, instance_id); |
|
|
|
|
#else |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *mono2stereo[instance_id], 0); |
|
|
|
|
//dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *mono2stereo[instance_id], 0);
|
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*convertf32toi16[instance_id], 0, *mono2stereo[instance_id], 0); |
|
|
|
|
#endif |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 0, master_mixer_r, instance_id); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 1, master_mixer_l, instance_id); |
|
|
|
@ -274,6 +286,7 @@ void setup() |
|
|
|
|
// Start audio system
|
|
|
|
|
//AudioNoInterrupts();
|
|
|
|
|
AudioMemory(AUDIO_MEM); |
|
|
|
|
AudioMemory_F32(AUDIO_MEM_F32); |
|
|
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
pinMode(SDCARD_CS_PIN, OUTPUT); |
|
|
|
@ -454,6 +467,7 @@ void setup() |
|
|
|
|
// Initialize processor and memory measurements
|
|
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
|
AudioMemoryUsageMaxReset(); |
|
|
|
|
AudioMemoryUsageMaxReset_F32(); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
@ -2227,6 +2241,12 @@ void show_cpu_and_mem_usage(void) |
|
|
|
|
Serial.print(AudioProcessorUsageMax(), 2); |
|
|
|
|
Serial.print(F("%|CPUMAXCNT:")); |
|
|
|
|
Serial.print(cpumax, DEC); |
|
|
|
|
Serial.print(F("|MEM_F32:")); |
|
|
|
|
Serial.print(AudioMemoryUsage_F32(), DEC); |
|
|
|
|
Serial.print(F("|MEMMAX_F32:")); |
|
|
|
|
Serial.print(AudioMemoryUsageMax_F32(), DEC); |
|
|
|
|
Serial.print(F("|AUDIO_MEM_MAX_F32:")); |
|
|
|
|
Serial.print(AUDIO_MEM_F32, DEC); |
|
|
|
|
Serial.print(F("|MEM:")); |
|
|
|
|
Serial.print(AudioMemoryUsage(), DEC); |
|
|
|
|
Serial.print(F("|MEMMAX:")); |
|
|
|
@ -2263,6 +2283,7 @@ void show_cpu_and_mem_usage(void) |
|
|
|
|
#endif |
|
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
|
AudioMemoryUsageMaxReset(); |
|
|
|
|
AudioMemoryUsageMaxReset_F32(); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|