Quote:
Originally Posted by Tale
More something like this i.e. include both IRs during compile time:
Code:
static const int len = 1024;
static const float ir1[ir_len] =
{
#include "ir1.h"
};
static const float ir2[ir_len] =
{
#include "ir2.h"
};
And then select ir1/ir2 on runtime.
EDIT: Assuming same length here for simplicity's sake, but they don't have to be.
No comment...
|
Thanks for reply.
I added both IRs but i can't switch. mIR and mIR1
Now playing with this.I believe i can switch IRs in here.What do you thing?
I need to add if/else function to switch IRs between mIR and mIR1.
Code:
void IPlugConvoEngine::Reset()
{
TRACE; IMutexLock lock(this);
// Detect a change in sample rate.
if (GetSampleRate() != mSampleRate)
{
mSampleRate = GetSampleRate();
const int irLength = sizeof(mIR) / sizeof(mIR[0]);
const double irSampleRate = 44100.;
mImpulse.SetNumChannels(1);
#if defined(_USE_WDL_RESAMPLER)
mResampler.SetMode(false, 0, true); // Sinc, default size
mResampler.SetFeedMode(true); // Input driven
#elif defined(_USE_R8BRAIN)
if (mResampler) delete mResampler;
mResampler = new CDSPResampler16IR(irSampleRate, mSampleRate, mBlockLength);
#endif
// Resample the impulse response.
int len = mImpulse.SetLength(ResampleLength(irLength, irSampleRate, mSampleRate));
if (len) Resample(mIR, irLength, irSampleRate, mImpulse.impulses[0].Get(), len, mSampleRate);
// Tie the impulse response to the convolution engine.
mEngine.SetImpulse(&mImpulse);
}
}