diff --git a/MicroDexed.ino b/MicroDexed.ino index faf8ab3..6e0b7e0 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -514,16 +514,18 @@ void setup() { // Setup EPiano // EP_CHORUS - ep_delayline_r = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); - if (ep_delayline_r == NULL) { + //ep_delayline_r = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); + ep_delayline_r = new int16_t[MOD_DELAY_SAMPLE_BUFFER]; + if (!ep_delayline_r) { #ifdef DEBUG Serial.println(F("AudioEffectModulatedDelay R - memory allocation failed EP")); #endif while (1) ; } - ep_delayline_l = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); - if (ep_delayline_l == NULL) { + //ep_delayline_l = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); + ep_delayline_l = new int16_t[MOD_DELAY_SAMPLE_BUFFER]; + if (!ep_delayline_l) { #ifdef DEBUG Serial.println(F("AudioEffectModulatedDelay L - memory allocation failed EP")); #endif @@ -557,8 +559,9 @@ void setup() { // Setup effects for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { - delayline[instance_id] = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); - if (delayline[instance_id] != NULL) { + //delayline[instance_id] = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); + delayline[instance_id] = new int16_t[MOD_DELAY_SAMPLE_BUFFER]; + if (delayline[instance_id]) { memset(delayline[instance_id], 0, MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); if (!modchorus[instance_id]->begin(delayline[instance_id], MOD_DELAY_SAMPLE_BUFFER)) { #ifdef DEBUG diff --git a/config.h b/config.h index eabbe24..39449e0 100644 --- a/config.h +++ b/config.h @@ -132,8 +132,8 @@ // CHORUS parameters #define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(15.0)) // 15.0 ms delay buffer. #define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE -//#define MOD_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT -#define MOD_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT +#define MOD_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT +//#define MOD_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT #define MOD_FILTER_CUTOFF_HZ 2000 // SGTL5000 @@ -158,7 +158,7 @@ #define SAMPLE_RATE 44100 #ifdef USE_DELAY_8M -#define AUDIO_MEM 36 + 14 // Delay in EXTMEM +#define AUDIO_MEM 36 + 14 // Delay in EXTMEM #else #define AUDIO_MEM 36 + 14 + SAMPLE_RATE * NUM_DEXED * DELAY_MAX_TIME / 128000 // Delay in AUDIO_MEM #endif diff --git a/midi_devices.hpp b/midi_devices.hpp index d7f0454..5da0f76 100644 --- a/midi_devices.hpp +++ b/midi_devices.hpp @@ -1,10 +1,12 @@ /* MicroDexed + + MicroDexed is a port of the Dexed sound engine + (https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6/4.x with audio shield. + Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android - MicroMDAEPiano is a port of the MDA-EPiano sound engine - (https://sourceforge.net/projects/mda-vst/) for the Teensy-3.5/3.6/4.x with audio shield. - - (c)2019-2023 H. Wirtz + (c)2018-2023 H. Wirtz + (c)2021-2022 H. Wirtz , M. Koslowski 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 diff --git a/third-party/effect_modulated_delay/src/effect_modulated_delay.h b/third-party/effect_modulated_delay/src/effect_modulated_delay.h index bb96e03..767f204 100644 --- a/third-party/effect_modulated_delay/src/effect_modulated_delay.h +++ b/third-party/effect_modulated_delay/src/effect_modulated_delay.h @@ -33,8 +33,7 @@ // 140219 - correct storage class (not static) // 190527 - added modulation input handling (Aug 2019 by Holger Wirtz) -class AudioEffectModulatedDelay : - public AudioStream +class AudioEffectModulatedDelay : public AudioStream { public: AudioEffectModulatedDelay(void): @@ -42,10 +41,10 @@ class AudioEffectModulatedDelay : { } boolean begin(short *delayline, uint16_t delay_length); - virtual void update(void); - virtual uint16_t get_delay_length(void); - virtual void set_bypass(bool b); - virtual bool get_bypass(void); + void update(void); + uint16_t get_delay_length(void); + void set_bypass(bool b); + bool get_bypass(void); private: audio_block_t *inputQueueArray[2]; @@ -54,11 +53,10 @@ class AudioEffectModulatedDelay : uint16_t _delay_length; // calculated number of samples of the delay int16_t cb_mod_index; // current read pointer with modulation for the circular buffer uint16_t _delay_offset; - bool bypass; + bool bypass = false; }; -class AudioEffectModulatedDelayStereo : - public AudioStream +class AudioEffectModulatedDelayStereo : public AudioStream { public: AudioEffectModulatedDelayStereo(void): @@ -66,12 +64,12 @@ class AudioEffectModulatedDelayStereo : { } boolean begin(short *delayline_l, short *delayline_r, uint16_t delay_length); - virtual void update(void); - virtual uint16_t get_delay_length(void); - virtual void set_stereo(bool s); - virtual bool get_stereo(void); - virtual void set_bypass(bool b); - virtual bool get_bypass(void); + void update(void); + uint16_t get_delay_length(void); + void set_stereo(bool s); + bool get_stereo(void); + void set_bypass(bool b); + bool get_bypass(void); private: audio_block_t *inputQueueArray[3]; @@ -80,7 +78,7 @@ class AudioEffectModulatedDelayStereo : uint16_t _delay_length; // calculated number of samples of the delay int16_t cb_mod_index[2]; // current read pointer with modulation for the circular buffer uint16_t _delay_offset; - bool stereo; - bool bypass; + bool stereo = true; + bool bypass = false; }; #endif