mirror of https://github.com/AxioDL/amuse.git
Audio buffering bug fix
This commit is contained in:
parent
3521d94d1c
commit
f69af0e9af
|
@ -114,28 +114,22 @@ struct VSTVoiceEngine : boo::BaseAudioVoiceEngine
|
|||
{
|
||||
for (size_t f=0 ; f<m_renderFrames ;)
|
||||
{
|
||||
size_t remRenderFrames = std::min(m_renderFrames - f, m_5msFrames - m_curBufFrame);
|
||||
for (size_t i=0 ; i<2 ; ++i)
|
||||
{
|
||||
float* bufOut = m_outputData[i];
|
||||
for (size_t lf=0 ; lf<remRenderFrames ; ++lf)
|
||||
bufOut[f+lf] = m_interleavedBuf[(m_curBufFrame+lf)*2+i];
|
||||
}
|
||||
m_curBufFrame += remRenderFrames;
|
||||
f += remRenderFrames;
|
||||
|
||||
if (m_curBufFrame == m_5msFrames)
|
||||
{
|
||||
_pumpAndMixVoices(m_5msFrames, m_interleavedBuf.data());
|
||||
m_curBufFrame = 0;
|
||||
}
|
||||
|
||||
remRenderFrames = std::min(m_renderFrames - f, m_5msFrames);
|
||||
size_t remRenderFrames = std::min(m_renderFrames - f, m_5msFrames - m_curBufFrame);
|
||||
if (remRenderFrames)
|
||||
{
|
||||
for (size_t i=0 ; i<2 ; ++i)
|
||||
{
|
||||
float* bufOut = m_outputData[i];
|
||||
for (size_t lf=0 ; lf<remRenderFrames ; ++lf)
|
||||
bufOut[f+lf] = m_interleavedBuf[lf*2+i];
|
||||
bufOut[f+lf] = m_interleavedBuf[(m_curBufFrame+lf)*2+i];
|
||||
}
|
||||
m_curBufFrame += remRenderFrames;
|
||||
f += remRenderFrames;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,10 +84,6 @@ inline int32_t ClampFull<int32_t>(float in)
|
|||
template <>
|
||||
inline float ClampFull<float>(float in)
|
||||
{
|
||||
if (in < -1.f)
|
||||
return -1.f;
|
||||
else if (in > 1.f)
|
||||
return 1.f;
|
||||
return in;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue