bug fixes, basics, SC reverb

main
pio 4 weeks ago
parent 766f1aa343
commit 0000b9879b
  1. 7
      src/basic_allpass.h
  2. 2
      src/basic_bypassStereo_F32.cpp
  3. 5
      src/basic_delay.h
  4. 3
      src/basic_pitch.h
  5. 4
      src/basic_tempBuffer.h
  6. 8
      src/effect_reverbsc_F32.cpp
  7. 2
      src/effect_reverbsc_F32.h

@ -16,10 +16,8 @@ template <int N>
class AudioFilterAllpass
{
public:
~AudioFilterAllpass()
{
if (bf) free(bf);
}
AudioFilterAllpass() { bf = NULL; }
~AudioFilterAllpass() { free(bf); }
/**
* @brief Allocate the filter buffer in RAM
* set the pointer to the allpass coeff
@ -28,6 +26,7 @@ public:
*/
bool init(float* coeffPtr)
{
free(bf);
bf = (float *)malloc(N*sizeof(float)); // allocate buffer
if (!bf) return false;
kPtr = coeffPtr;

@ -56,7 +56,7 @@ bool bypass_process(audio_block_f32_t** p_blockL, audio_block_f32_t** p_blockR,
{
if (*p_blockL) AudioStream_F32::release(*p_blockL); // blockL is available and contains audio. Discard it
result = false;
break; // and sigbnal failed operation
break; // and signal failed operation
}
memset(&(*p_blockR)->data[0], 0, (*p_blockR)->length*sizeof(float32_t));
}

@ -23,13 +23,14 @@
class AudioBasicDelay
{
public:
AudioBasicDelay() { bf = NULL; }
~AudioBasicDelay()
{
if(bf) free(bf);
free(bf);
}
bool init(uint32_t size_samples, bool psram=false)
{
if(bf) free(bf);
free(bf);
use_psram = psram;
size = size_samples;
if (use_psram) bf = (float *)extmem_malloc(size * sizeof(float)); // allocate buffer in PSRAM

@ -23,8 +23,11 @@ extern const float music_intevals[]; // semitone intervals -1oct to +2oct
class AudioBasicPitch
{
public:
AudioBasicPitch() { bf = NULL; }
~AudioBasicPitch() { free(bf); }
bool init()
{
free(bf);
outFilter.init(hp_f, (float *)&hp_gain, lp_f, &lp_gain);
bf = (float *)malloc(BASIC_PITCH_BUF_SIZE*sizeof(float)); // allocate buffer
if (!bf) return false;

@ -16,7 +16,7 @@ public:
AudioBasicTempBuffer_F32(const AudioSettings_F32 &settings) : AudioStream_F32(1, inputQueueArray_f32)
{
blockSize = settings.audio_block_samples;
memset(&data[0], 0, AUDIO_BLOCK_SAMPLES * sizeof(float32_t));
memset(&data[0], 0, blockSize * sizeof(float32_t));
dataPtr = &data[0];
};
~AudioBasicTempBuffer_F32(){};
@ -30,7 +30,7 @@ public:
float32_t* dataPtr;
private:
audio_block_f32_t *inputQueueArray_f32[1];
uint16_t blockSize = AUDIO_BLOCK_SAMPLES;
uint16_t blockSize;
float32_t data[AUDIO_BLOCK_SAMPLES];
};

@ -60,6 +60,7 @@ AudioEffectReverbSc_F32::AudioEffectReverbSc_F32(bool use_psram) : AudioStream_F
aux_ = (float32_t *) extmem_malloc(aux_size_bytes);
#else
flags.mem_fail = 1;
flags.memsetup_done = 1; // nothing to setup, make it ready
initialised = true;
return;
#endif
@ -67,7 +68,6 @@ AudioEffectReverbSc_F32::AudioEffectReverbSc_F32(bool use_psram) : AudioStream_F
else
{
aux_ = (float32_t *) malloc(aux_size_bytes);
//flags.memsetup_done = 1;
}
if (!aux_)
{
@ -173,7 +173,11 @@ void AudioEffectReverbSc_F32::update()
if (!initialised) return;
// special case if memory allocation failed, pass the input signal directly to the output
if (flags.mem_fail) bp_mode = BYPASS_MODE_PASS;
if (flags.mem_fail)
{
bp_mode = BYPASS_MODE_PASS;
flags.bypass = 1;
}
blockL = AudioStream_F32::receiveWritable_f32(0);
blockR = AudioStream_F32::receiveWritable_f32(1);

@ -156,7 +156,7 @@ private:
float32_t damp_fact_, damp_fact_tmp;
bool initialised = false;
ReverbScDl_t delay_lines_[8];
float32_t *aux_; // main delay line storage buffer, placed either in RAM2 or PSRAM
float32_t *aux_ = NULL; // main delay line storage buffer, placed either in RAM2 or PSRAM
const uint32_t aux_size_bytes = REVERBSC_DLYBUF_SIZE*sizeof(float32_t);
float32_t dry_gain = 0.5f;
float32_t wet_gain = 0.5f;

Loading…
Cancel
Save