Esempio n. 1
0
MLDSPContext::MLDSPContext() :
    mEnabled(false),
    mpRootContext(nullptr)
{
    mVectorSize = 0;
    mSampleRate = kToBeCalculated;
    mInvSampleRate = 1.f;
    mNullInput.setToConstant(0.f);
    mResampleRatio = MLRatio(1, 1);
    mResampleUpOrder = 0;
    mResampleDownOrder = 0;
}
Esempio n. 2
0
// if the floating-point input is near a low whole-number ratio, return the ratio, else return the null MLRatio.
inline MLRatio correctRatio(float rIn)
{
	const int kMaxRatio = 8;
	MLRatio r(0, 0);
	for(int a=1; a<=kMaxRatio; ++a)
	{
		for(int b=1; b<=4; ++b)
		{
			if (fabs(rIn - ((float)a/(float)b)) < 0.001f)
			{
				return MLRatio(a, b);	
			}
		}
	}
	return r;
}