master
Holger Wirtz 6 years ago
parent 5b0a478dcc
commit bb1ef0f5ba
  1. 14
      src/effects/AudioEffectSimpleChorus.cpp

@ -35,7 +35,7 @@ void AudioEffectSimpleChorus::update(void)
audio_block_t *inputAudioBlock = receiveReadOnly(); // get the next block of input samples audio_block_t *inputAudioBlock = receiveReadOnly(); // get the next block of input samples
/* /*
// Check is block is disabled // Check is block is disablee
if (m_enable == false) { if (m_enable == false) {
// do not transmit or process any audio, return as quickly as possible. // do not transmit or process any audio, return as quickly as possible.
if (inputAudioBlock) release(inputAudioBlock); if (inputAudioBlock) release(inputAudioBlock);
@ -76,6 +76,7 @@ void AudioEffectSimpleChorus::update(void)
audio_block_t *blockToRelease = m_memory->addBlock(inputAudioBlock); audio_block_t *blockToRelease = m_memory->addBlock(inputAudioBlock);
// Chorus // Chorus
size_t half_delay_samples=size_t(float(m_delaySamples)/2+0.5);
float *mod = lfo.getNextVector(); float *mod = lfo.getNextVector();
audio_block_t *lfoData = nullptr; audio_block_t *lfoData = nullptr;
lfoData = allocate(); lfoData = allocate();
@ -83,19 +84,16 @@ void AudioEffectSimpleChorus::update(void)
for(uint8_t i=0;i<AUDIO_BLOCK_SAMPLES;i++) for(uint8_t i=0;i<AUDIO_BLOCK_SAMPLES;i++)
{ {
//m_memory->getSamples(blockToOutput,m_delaySamples); //m_memory->getSamples(blockToOutput,m_delaySamples);
m_memory->getSamples(lfoData,float(m_delaySamples)/2+(m_intensity*mod[i]*float(m_delaySamples)/2),3); //blockToOutput->data[i]=inputAudioBlock->data[i];
if(mod[i]==0.0) m_memory->getSamples(lfoData,half_delay_samples+size_t((float(half_delay_samples)*mod[i]+0.5)),1);
blockToOutput->data[i]=lfoData->data[1]; blockToOutput->data[i]=lfoData[0];
else if(mod[i]<0.0)
blockToOutput->data[i]=int16_t(((float(lfoData->data[0])-lfoData->data[1])*(1+mod[i]))+lfoData->data[0]+0.5);
else
blockToOutput->data[i]=int16_t(((float(lfoData->data[2])-lfoData->data[1])*mod[i])+lfoData->data[2]+0.5);
} }
// perform the wet/dry mix mix // perform the wet/dry mix mix
//m_postProcessing(blockToOutput, inputAudioBlock, blockToOutput); //m_postProcessing(blockToOutput, inputAudioBlock, blockToOutput);
transmit(blockToOutput); transmit(blockToOutput);
release(inputAudioBlock);
release(lfoData); release(lfoData);
if(m_previousBlock) if(m_previousBlock)
release(m_previousBlock); release(m_previousBlock);

Loading…
Cancel
Save