Skip to content

Commit

Permalink
Fix for MVerb
Browse files Browse the repository at this point in the history
  • Loading branch information
jnonis committed Jul 23, 2024
1 parent 2d19311 commit f0e2593
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 31 deletions.
62 changes: 32 additions & 30 deletions src/effect_audio/effect_mverb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@

AudioEffectMVerb::AudioEffectMVerb(float32_t samplerate) : AudioEffect(samplerate)
{
fVerb.setSampleRate(samplerate);
fVerb = new MVerb<float>();
fVerb->setSampleRate(samplerate);

fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 0.5f);
fVerb.setParameter(MVerb<float>::DENSITY, 0.5f);
fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 0.5f);
fVerb.setParameter(MVerb<float>::DECAY, 0.5f);
fVerb.setParameter(MVerb<float>::PREDELAY, 0.5f);
fVerb.setParameter(MVerb<float>::SIZE, 0.75f);
fVerb.setParameter(MVerb<float>::GAIN, 1.0f);
fVerb.setParameter(MVerb<float>::MIX, 0.5f);
fVerb.setParameter(MVerb<float>::EARLYMIX, 0.5f);
fVerb.reset();
fVerb->setParameter(MVerb<float>::DAMPINGFREQ, 0.5f);
fVerb->setParameter(MVerb<float>::DENSITY, 0.5f);
fVerb->setParameter(MVerb<float>::BANDWIDTHFREQ, 0.5f);
fVerb->setParameter(MVerb<float>::DECAY, 0.5f);
fVerb->setParameter(MVerb<float>::PREDELAY, 0.5f);
fVerb->setParameter(MVerb<float>::SIZE, 0.75f);
fVerb->setParameter(MVerb<float>::GAIN, 1.0f);
fVerb->setParameter(MVerb<float>::MIX, 0.5f);
fVerb->setParameter(MVerb<float>::EARLYMIX, 0.5f);
fVerb->reset();
}

AudioEffectMVerb::~AudioEffectMVerb()
{
delete fVerb;
}

void AudioEffectMVerb::initializeSendFX()
Expand All @@ -40,31 +42,31 @@ void AudioEffectMVerb::setParameter(unsigned param, unsigned value)
this->setBypass(value == 1);
break;
case AudioEffectMVerb::Param::DAMPINGFREQ:
fVerb.setParameter(MVerb<float>::DAMPINGFREQ, (float) value / 100.0f);
fVerb->setParameter(MVerb<float>::DAMPINGFREQ, (float) value / 100.0f);
break;
case AudioEffectMVerb::Param::DENSITY:
fVerb.setParameter(MVerb<float>::DENSITY, (float) value / 100.0f);
fVerb->setParameter(MVerb<float>::DENSITY, (float) value / 100.0f);
break;
case AudioEffectMVerb::Param::BANDWIDTHFREQ:
fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, (float) value / 100.0f);
fVerb->setParameter(MVerb<float>::BANDWIDTHFREQ, (float) value / 100.0f);
break;
case AudioEffectMVerb::Param::DECAY:
fVerb.setParameter(MVerb<float>::DECAY, (float) value / 100.0f);
fVerb->setParameter(MVerb<float>::DECAY, (float) value / 100.0f);
break;
case AudioEffectMVerb::Param::PREDELAY:
fVerb.setParameter(MVerb<float>::PREDELAY, (float) value / 100.0f);
fVerb->setParameter(MVerb<float>::PREDELAY, (float) value / 100.0f);
break;
case AudioEffectMVerb::Param::SIZE:
fVerb.setParameter(MVerb<float>::SIZE, (float) value / 100.0f);
fVerb->setParameter(MVerb<float>::SIZE, (float) value / 100.0f);
break;
case AudioEffectMVerb::Param::GAIN:
fVerb.setParameter(MVerb<float>::GAIN, (float) value / 100.0f);
fVerb->setParameter(MVerb<float>::GAIN, (float) value / 100.0f);
break;
case AudioEffectMVerb::Param::MIX:
fVerb.setParameter(MVerb<float>::MIX, (float) value / 100.0f);
fVerb->setParameter(MVerb<float>::MIX, (float) value / 100.0f);
break;
case AudioEffectMVerb::Param::EARLYMIX:
fVerb.setParameter(MVerb<float>::EARLYMIX, (float) value / 100.0f);
fVerb->setParameter(MVerb<float>::EARLYMIX, (float) value / 100.0f);
break;
default:
break;
Expand All @@ -78,23 +80,23 @@ unsigned AudioEffectMVerb::getParameter(unsigned param)
case AudioEffectMVerb::Param::BYPASS:
return this->getBypass() ? 1 : 0;
case AudioEffectMVerb::Param::DAMPINGFREQ:
return roundf(fVerb.getParameter(MVerb<float>::DAMPINGFREQ) * 100);
return roundf(fVerb->getParameter(MVerb<float>::DAMPINGFREQ) * 100);
case AudioEffectMVerb::Param::DENSITY:
return roundf(fVerb.getParameter(MVerb<float>::DENSITY) * 100);
return roundf(fVerb->getParameter(MVerb<float>::DENSITY) * 100);
case AudioEffectMVerb::Param::BANDWIDTHFREQ:
return roundf(fVerb.getParameter(MVerb<float>::BANDWIDTHFREQ) * 100);
return roundf(fVerb->getParameter(MVerb<float>::BANDWIDTHFREQ) * 100);
case AudioEffectMVerb::Param::DECAY:
return roundf(fVerb.getParameter(MVerb<float>::DECAY) * 100);
return roundf(fVerb->getParameter(MVerb<float>::DECAY) * 100);
case AudioEffectMVerb::Param::PREDELAY:
return roundf(fVerb.getParameter(MVerb<float>::PREDELAY) * 100);
return roundf(fVerb->getParameter(MVerb<float>::PREDELAY) * 100);
case AudioEffectMVerb::Param::SIZE:
return roundf(fVerb.getParameter(MVerb<float>::SIZE) * 100);
return roundf(fVerb->getParameter(MVerb<float>::SIZE) * 100);
case AudioEffectMVerb::Param::GAIN:
return roundf(fVerb.getParameter(MVerb<float>::GAIN) * 100);
return roundf(fVerb->getParameter(MVerb<float>::GAIN) * 100);
case AudioEffectMVerb::Param::MIX:
return roundf(fVerb.getParameter(MVerb<float>::MIX) * 100);
return roundf(fVerb->getParameter(MVerb<float>::MIX) * 100);
case AudioEffectMVerb::Param::EARLYMIX:
return roundf(fVerb.getParameter(MVerb<float>::EARLYMIX) * 100);
return roundf(fVerb->getParameter(MVerb<float>::EARLYMIX) * 100);
default:
return 0;
}
Expand All @@ -111,6 +113,6 @@ void AudioEffectMVerb::doProcess(const float32_t* inblockL, const float32_t* inb
outputs[0] = outblockL;
outputs[1] = outblockR;

fVerb.process(inputs, outputs, static_cast<int>(len));
fVerb->process(inputs, outputs, static_cast<int>(len));
}

2 changes: 1 addition & 1 deletion src/effect_audio/effect_mverb.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AudioEffectMVerb : public AudioEffect
virtual void doProcess(const float32_t* inblockL, const float32_t* inblockR, float32_t* outblockL, float32_t* outblockR, uint16_t len);

private:
MVerb<float> fVerb;
MVerb<float>* fVerb;
};

#endif // _EFFECT_MVERB_H

0 comments on commit f0e2593

Please sign in to comment.