mirror of https://github.com/AxioDL/boo.git
Don't bother processing silent voices
This commit is contained in:
parent
b23da43f05
commit
b995be262b
|
@ -5,6 +5,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
#if __SSE__
|
#if __SSE__
|
||||||
#include <xmmintrin.h>
|
#include <xmmintrin.h>
|
||||||
|
@ -74,6 +75,18 @@ public:
|
||||||
const int32_t* dataIn, int32_t* dataOut, size_t samples);
|
const int32_t* dataIn, int32_t* dataOut, size_t samples);
|
||||||
float* mixMonoSampleData(const AudioVoiceEngineMixInfo& info,
|
float* mixMonoSampleData(const AudioVoiceEngineMixInfo& info,
|
||||||
const float* dataIn, float* dataOut, size_t samples);
|
const float* dataIn, float* dataOut, size_t samples);
|
||||||
|
|
||||||
|
bool isSilent() const
|
||||||
|
{
|
||||||
|
if (m_curSlewFrame < m_slewFrames)
|
||||||
|
for (int i=0 ; i<8 ; ++i)
|
||||||
|
if (m_oldCoefs.v[i] > FLT_EPSILON)
|
||||||
|
return false;
|
||||||
|
for (int i=0 ; i<8 ; ++i)
|
||||||
|
if (m_coefs.v[i] > FLT_EPSILON)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AudioMatrixStereo
|
class AudioMatrixStereo
|
||||||
|
@ -124,6 +137,18 @@ public:
|
||||||
const int32_t* dataIn, int32_t* dataOut, size_t frames);
|
const int32_t* dataIn, int32_t* dataOut, size_t frames);
|
||||||
float* mixStereoSampleData(const AudioVoiceEngineMixInfo& info,
|
float* mixStereoSampleData(const AudioVoiceEngineMixInfo& info,
|
||||||
const float* dataIn, float* dataOut, size_t frames);
|
const float* dataIn, float* dataOut, size_t frames);
|
||||||
|
|
||||||
|
bool isSilent() const
|
||||||
|
{
|
||||||
|
if (m_curSlewFrame < m_slewFrames)
|
||||||
|
for (int i=0 ; i<8 ; ++i)
|
||||||
|
if (m_oldCoefs.v[i][0] > FLT_EPSILON || m_oldCoefs.v[i][1] > FLT_EPSILON)
|
||||||
|
return false;
|
||||||
|
for (int i=0 ; i<8 ; ++i)
|
||||||
|
if (m_coefs.v[i][0] > FLT_EPSILON || m_coefs.v[i][1] > FLT_EPSILON)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,18 @@ size_t AudioVoiceMono::SRCCallback(AudioVoiceMono* ctx, int16_t** data, size_t f
|
||||||
|
|
||||||
size_t AudioVoiceMono::pumpAndMix16(size_t frames)
|
size_t AudioVoiceMono::pumpAndMix16(size_t frames)
|
||||||
{
|
{
|
||||||
|
if (m_sendMatrices.size())
|
||||||
|
{
|
||||||
|
for (auto& mtx : m_sendMatrices)
|
||||||
|
if (mtx.second.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DefaultMonoMtx.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int16_t>& scratch16Pre = m_root.m_scratch16Pre;
|
std::vector<int16_t>& scratch16Pre = m_root.m_scratch16Pre;
|
||||||
if (scratch16Pre.size() < frames)
|
if (scratch16Pre.size() < frames)
|
||||||
scratch16Pre.resize(frames);
|
scratch16Pre.resize(frames);
|
||||||
|
@ -162,6 +174,18 @@ size_t AudioVoiceMono::pumpAndMix16(size_t frames)
|
||||||
|
|
||||||
size_t AudioVoiceMono::pumpAndMix32(size_t frames)
|
size_t AudioVoiceMono::pumpAndMix32(size_t frames)
|
||||||
{
|
{
|
||||||
|
if (m_sendMatrices.size())
|
||||||
|
{
|
||||||
|
for (auto& mtx : m_sendMatrices)
|
||||||
|
if (mtx.second.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DefaultMonoMtx.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int32_t>& scratch32Pre = m_root.m_scratch32Pre;
|
std::vector<int32_t>& scratch32Pre = m_root.m_scratch32Pre;
|
||||||
if (scratch32Pre.size() < frames)
|
if (scratch32Pre.size() < frames)
|
||||||
scratch32Pre.resize(frames);
|
scratch32Pre.resize(frames);
|
||||||
|
@ -199,6 +223,18 @@ size_t AudioVoiceMono::pumpAndMix32(size_t frames)
|
||||||
|
|
||||||
size_t AudioVoiceMono::pumpAndMixFlt(size_t frames)
|
size_t AudioVoiceMono::pumpAndMixFlt(size_t frames)
|
||||||
{
|
{
|
||||||
|
if (m_sendMatrices.size())
|
||||||
|
{
|
||||||
|
for (auto& mtx : m_sendMatrices)
|
||||||
|
if (mtx.second.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DefaultMonoMtx.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<float>& scratchFltPre = m_root.m_scratchFltPre;
|
std::vector<float>& scratchFltPre = m_root.m_scratchFltPre;
|
||||||
if (scratchFltPre.size() < frames)
|
if (scratchFltPre.size() < frames)
|
||||||
scratchFltPre.resize(frames + 2);
|
scratchFltPre.resize(frames + 2);
|
||||||
|
@ -326,6 +362,18 @@ size_t AudioVoiceStereo::SRCCallback(AudioVoiceStereo* ctx, int16_t** data, size
|
||||||
|
|
||||||
size_t AudioVoiceStereo::pumpAndMix16(size_t frames)
|
size_t AudioVoiceStereo::pumpAndMix16(size_t frames)
|
||||||
{
|
{
|
||||||
|
if (m_sendMatrices.size())
|
||||||
|
{
|
||||||
|
for (auto& mtx : m_sendMatrices)
|
||||||
|
if (mtx.second.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DefaultMonoMtx.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
size_t samples = frames * 2;
|
size_t samples = frames * 2;
|
||||||
|
|
||||||
std::vector<int16_t>& scratch16Pre = m_root.m_scratch16Pre;
|
std::vector<int16_t>& scratch16Pre = m_root.m_scratch16Pre;
|
||||||
|
@ -365,6 +413,18 @@ size_t AudioVoiceStereo::pumpAndMix16(size_t frames)
|
||||||
|
|
||||||
size_t AudioVoiceStereo::pumpAndMix32(size_t frames)
|
size_t AudioVoiceStereo::pumpAndMix32(size_t frames)
|
||||||
{
|
{
|
||||||
|
if (m_sendMatrices.size())
|
||||||
|
{
|
||||||
|
for (auto& mtx : m_sendMatrices)
|
||||||
|
if (mtx.second.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DefaultMonoMtx.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
size_t samples = frames * 2;
|
size_t samples = frames * 2;
|
||||||
|
|
||||||
std::vector<int32_t>& scratch32Pre = m_root.m_scratch32Pre;
|
std::vector<int32_t>& scratch32Pre = m_root.m_scratch32Pre;
|
||||||
|
@ -404,6 +464,18 @@ size_t AudioVoiceStereo::pumpAndMix32(size_t frames)
|
||||||
|
|
||||||
size_t AudioVoiceStereo::pumpAndMixFlt(size_t frames)
|
size_t AudioVoiceStereo::pumpAndMixFlt(size_t frames)
|
||||||
{
|
{
|
||||||
|
if (m_sendMatrices.size())
|
||||||
|
{
|
||||||
|
for (auto& mtx : m_sendMatrices)
|
||||||
|
if (mtx.second.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DefaultMonoMtx.isSilent())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
size_t samples = frames * 2;
|
size_t samples = frames * 2;
|
||||||
|
|
||||||
std::vector<float>& scratchFltPre = m_root.m_scratchFltPre;
|
std::vector<float>& scratchFltPre = m_root.m_scratchFltPre;
|
||||||
|
|
Loading…
Reference in New Issue