Back to block processing, more efficient and does not introduce delay

This commit is contained in:
Geoffrey Merck 2020-04-04 16:16:46 +02:00
parent 1770dc188f
commit 042188770b
9 changed files with 85 additions and 57 deletions

View file

@ -38,7 +38,16 @@ CFixedGain::CFixedGain(float gaindB)
////////////////////////////////////////////////////////////////////////////////////////
// processing
inline float CFixedGain::ProcessSample(float input)
inline void CFixedGain::ProcessSampleBlock(uint8* voice, int length)
{
return input * m_gainLinear;
for(int i = 0; i < length; i++)
{
float input = (float)(short)MAKEWORD(voice[i+1], voice[i]);
//apply gain
float output = input * m_gainLinear;
//write processed sample back
voice[i] = HIBYTE((short)output);
voice[i+1] = LOBYTE((short)output);
}
}