Several fixes for float signal path.

pull/73/head
Holger Wirtz 3 years ago
parent a5fb30c0c2
commit 58f95623d7
  1. BIN
      src/.minidexed.cpp.swp
  2. 10
      src/effect_platervbstereo.cpp
  3. 2
      src/effect_platervbstereo.h
  4. 39
      src/minidexed.cpp
  5. 2
      src/minidexed.h

Binary file not shown.

@ -158,7 +158,7 @@ AudioEffectPlateReverb::AudioEffectPlateReverb(float32_t samplerate)
// #define sat16(n, rshift) signed_saturate_rshift((n), 16, (rshift))
void AudioEffectPlateReverb::doReverb(float32_t* blockL, float32_t* blockR, uint16_t len)
void AudioEffectPlateReverb::doReverb(const float32_t* inblockL, const float32_t* inblockR, float32_t* rvbblockL, float32_t* rvbblockR, uint16_t len)
{
float32_t input, acc, temp1, temp2;
uint16_t temp16;
@ -235,7 +235,7 @@ void AudioEffectPlateReverb::doReverb(float32_t* blockL, float32_t* blockR, uint
y += (int64_t)y1 * idx;
lfo2_out_cos = (int32_t) (y >> (32-8)); // 16bit output
input = blockL[i] * input_attn;
input = inblockL[i] * input_attn;
// chained input allpasses, channel L
acc = in_allp1_bufL[in_allp1_idxL] + input * in_allp_k;
@ -258,7 +258,7 @@ void AudioEffectPlateReverb::doReverb(float32_t* blockL, float32_t* blockR, uint
in_allp_out_L = acc;
if (++in_allp4_idxL >= sizeof(in_allp4_bufL)/sizeof(float32_t)) in_allp4_idxL = 0;
input = blockR[i] * input_attn;
input = inblockR[i] * input_attn;
// chained input allpasses, channel R
acc = in_allp1_bufR[in_allp1_idxR] + input * in_allp_k;
@ -405,7 +405,7 @@ void AudioEffectPlateReverb::doReverb(float32_t* blockL, float32_t* blockR, uint
temp1 = acc - master_lowpass_l;
master_lowpass_l += temp1 * master_lowpass_f;
blockL[i] = blockL[i] + (master_lowpass_l * reverb_level);
rvbblockL[i] = master_lowpass_l;
// Channel R
#ifdef TAP1_MODULATED
@ -449,6 +449,6 @@ void AudioEffectPlateReverb::doReverb(float32_t* blockL, float32_t* blockR, uint
temp1 = acc - master_lowpass_r;
master_lowpass_r += temp1 * master_lowpass_f;
blockR[i] = blockR[i] + (master_lowpass_r * reverb_level);
rvbblockR[i] = master_lowpass_r;
}
}

@ -61,7 +61,7 @@ class AudioEffectPlateReverb
{
public:
AudioEffectPlateReverb(float32_t samplerate);
void doReverb(float32_t* blockL, float32_t* blockR, uint16_t len);
void doReverb(const float32_t* inblockL, const float32_t* inblockR, float32_t* rvbblockL, float32_t* rvbblockR,uint16_t len);
void size(float n)
{

@ -689,36 +689,57 @@ void CMiniDexed::ProcessSound (void)
float32_t SampleBuffer[2][nFrames];
uint8_t indexL=0, indexR=1;
assert (SampleBuffer[0]!=NULL);
arm_fill_f32(0.0, SampleBuffer[0], nFrames);
assert (SampleBuffer[1]!=NULL);
arm_fill_f32(0.0, SampleBuffer[1], nFrames);
if (m_bChannelsSwapped)
{
indexL=1;
indexR=0;
}
// init left sum output
assert (SampleBuffer[0]!=NULL);
arm_fill_f32(0.0, SampleBuffer[0], nFrames);
// init right sum output
assert (SampleBuffer[1]!=NULL);
arm_fill_f32(0.0, SampleBuffer[1], nFrames);
assert (CConfig::ToneGenerators == 8);
// BEGIN stereo panorama
for (uint8_t i = 0; i < CConfig::ToneGenerators; i++)
{
float32_t tmpBuffer[nFrames];
m_PanoramaSpinLock.Acquire ();
arm_scale_f32(m_OutputLevel[0], 1.0f-pan_float[i], SampleBuffer[indexL], nFrames);
arm_scale_f32(m_OutputLevel[1], pan_float[i], SampleBuffer[indexR], nFrames);
// calculate left panorama of this TG
arm_scale_f32(m_OutputLevel[i], 1.0f-pan_float[i], tmpBuffer, nFrames);
// add left panorama output of this TG to sum output
arm_add_f32(SampleBuffer[indexL], tmpBuffer, SampleBuffer[indexL], nFrames);
// calculate right panorama of this TG
arm_scale_f32(m_OutputLevel[i], pan_float[i], tmpBuffer, nFrames);
// add right panaorama output of this TG to sum output
arm_add_f32(SampleBuffer[indexR], tmpBuffer, SampleBuffer[indexR], nFrames);
m_PanoramaSpinLock.Release ();
}
// END stereo panorama
// BEGIN adding reverb
float32_t ReverbBuffer[2][nFrames];
m_ReverbSpinLock.Acquire ();
reverb->doReverb(SampleBuffer[indexL],SampleBuffer[indexR],nFrames);
reverb->doReverb(SampleBuffer[indexL],SampleBuffer[indexR],ReverbBuffer[0], ReverbBuffer[1],nFrames);
m_ReverbSpinLock.Release ();
// scale down and add left reverb buffer by reverb level
arm_scale_f32(ReverbBuffer[0], reverb->get_level(), ReverbBuffer[0], nFrames);
arm_add_f32(SampleBuffer[indexL], ReverbBuffer[0], SampleBuffer[indexL], nFrames);
// scale down and add right reverb buffer by reverb level
arm_scale_f32(ReverbBuffer[1], reverb->get_level(), ReverbBuffer[1], nFrames);
arm_add_f32(SampleBuffer[indexR], ReverbBuffer[1], SampleBuffer[indexR], nFrames);
// END adding reverb
// Convert float to int16 array
// Convert dual float array (left, right) to single int16 array (left/right)
float32_t tmp_float[nFrames*2];
int16_t tmp_int[nFrames*2];
for(uint16_t i=0; i<nFrames;i++)

@ -139,7 +139,7 @@ private:
unsigned m_nProgram[CConfig::ToneGenerators];
unsigned m_nVolume[CConfig::ToneGenerators];
unsigned m_nPan[CConfig::ToneGenerators];
unsigned pan_float[CConfig::ToneGenerators];
float32_t pan_float[CConfig::ToneGenerators];
int m_nMasterTune[CConfig::ToneGenerators];
unsigned m_nMIDIChannel[CConfig::ToneGenerators];

Loading…
Cancel
Save