frame and channel counts are now consistently uint32_t / float32_t replaces float

This commit is contained in:
Craig Hansen-Sturm 2014-09-20 04:50:11 -07:00
parent 47c6ba708f
commit 90379ee7eb
8 changed files with 141 additions and 138 deletions

View file

@ -509,7 +509,7 @@ void Audio::handleAudioInput() {
if (!_muted && (_audioSourceInjectEnabled || _peqEnabled)) {
int16_t* inputFrameData = (int16_t*)inputByteArray.data();
const int inputFrameCount = inputByteArray.size() / sizeof(int16_t);
const uint32_t inputFrameCount = inputByteArray.size() / sizeof(int16_t);
_inputFrameBuffer.copyFrames(1, inputFrameCount, inputFrameData, false /*copy in*/);

View file

@ -17,17 +17,19 @@
template< typename T >
class AudioFrameBuffer {
uint16_t _channelCount;
uint16_t _channelCountMax;
uint16_t _frameCount;
uint16_t _frameCountMax;
protected:
uint32_t _channelCount;
uint32_t _channelCountMax;
uint32_t _frameCount;
uint32_t _frameCountMax;
T** _frameBuffer;
void allocateFrames() {
_frameBuffer = new T*[_channelCountMax];
if (_frameBuffer) {
for (uint16_t i = 0; i < _channelCountMax; ++i) {
for (uint32_t i = 0; i < _channelCountMax; ++i) {
_frameBuffer[i] = new T[_frameCountMax];
}
}
@ -35,7 +37,7 @@ class AudioFrameBuffer {
void deallocateFrames() {
if (_frameBuffer) {
for (uint16_t i = 0; i < _channelCountMax; ++i) {
for (uint32_t i = 0; i < _channelCountMax; ++i) {
delete _frameBuffer[i];
}
delete _frameBuffer;
@ -52,7 +54,7 @@ public:
_frameBuffer(NULL) {
}
AudioFrameBuffer(const uint16_t channelCount, const uint16_t frameCount) :
AudioFrameBuffer(const uint32_t channelCount, const uint32_t frameCount) :
_channelCount(channelCount),
_channelCountMax(channelCount),
_frameCount(frameCount),
@ -61,11 +63,11 @@ public:
allocateFrames();
}
~AudioFrameBuffer() {
virtual ~AudioFrameBuffer() {
finalize();
}
void initialize(const uint16_t channelCount, const uint16_t frameCount) {
void initialize(const uint32_t channelCount, const uint32_t frameCount) {
if (_frameBuffer) {
finalize();
}
@ -88,25 +90,25 @@ public:
return _frameBuffer;
}
uint16_t getChannelCount() {
uint32_t getChannelCount() {
return _channelCount;
}
uint16_t getFrameCount() {
uint32_t getFrameCount() {
return _frameCount;
}
void zeroFrames() {
if (!_frameBuffer) {
return;
}
for (uint16_t i = 0; i < _channelCountMax; ++i) {
for (uint32_t i = 0; i < _channelCountMax; ++i) {
memset(_frameBuffer[i], 0, sizeof(T)*_frameCountMax);
}
}
template< typename S >
void copyFrames(uint16_t channelCount, const uint16_t frameCount, S* frames, const bool copyOut = false) {
void copyFrames(uint32_t channelCount, const uint32_t frameCount, S* frames, const bool copyOut = false) {
if ( !_frameBuffer || !frames) {
return;
}
@ -152,8 +154,8 @@ public:
S* dst = frames;
if(typeid(T) == typeid(S)) { // source and destination types are the same
for (int i = 0; i < _frameCount; ++i) {
for (int j = 0; j < _channelCount; ++j) {
for (uint32_t i = 0; i < _frameCount; ++i) {
for (uint32_t j = 0; j < _channelCount; ++j) {
*dst++ = _frameBuffer[j][i];
}
}
@ -164,8 +166,8 @@ public:
const int scale = (2 << ((8 * sizeof(S)) - 1));
for (int i = 0; i < _frameCount; ++i) {
for (int j = 0; j < _channelCount; ++j) {
for (uint32_t i = 0; i < _frameCount; ++i) {
for (uint32_t j = 0; j < _channelCount; ++j) {
*dst++ = (S)(_frameBuffer[j][i] * scale);
}
}
@ -179,8 +181,8 @@ public:
S* src = frames;
if(typeid(T) == typeid(S)) { // source and destination types are the same
for (int i = 0; i < _frameCount; ++i) {
for (int j = 0; j < _channelCount; ++j) {
for (uint32_t i = 0; i < _frameCount; ++i) {
for (uint32_t j = 0; j < _channelCount; ++j) {
_frameBuffer[j][i] = *src++;
}
}
@ -191,8 +193,8 @@ public:
const int scale = (2 << ((8 * sizeof(S)) - 1));
for (int i = 0; i < _frameCount; ++i) {
for (int j = 0; j < _channelCount; ++j) {
for (uint32_t i = 0; i < _frameCount; ++i) {
for (uint32_t j = 0; j < _channelCount; ++j) {
_frameBuffer[j][i] = ((T)(*src++)) / scale;
}
}

View file

@ -21,16 +21,16 @@ class AudioBiquad {
//
// private data
//
float _a0; // gain
float _a1; // feedforward 1
float _a2; // feedforward 2
float _b1; // feedback 1
float _b2; // feedback 2
float32_t _a0; // gain
float32_t _a1; // feedforward 1
float32_t _a2; // feedforward 2
float32_t _b1; // feedback 1
float32_t _b2; // feedback 2
float _xm1;
float _xm2;
float _ym1;
float _ym2;
float32_t _xm1;
float32_t _xm2;
float32_t _ym1;
float32_t _ym2;
public:
@ -51,20 +51,20 @@ public:
//
// public interface
//
void setParameters(const float a0, const float a1, const float a2, const float b1, const float b2) {
void setParameters(const float32_t a0, const float32_t a1, const float32_t a2, const float32_t b1, const float32_t b2) {
_a0 = a0; _a1 = a1; _a2 = a2; _b1 = b1; _b2 = b2;
}
void getParameters(float& a0, float& a1, float& a2, float& b1, float& b2) {
void getParameters(float32_t& a0, float32_t& a1, float32_t& a2, float32_t& b1, float32_t& b2) {
a0 = _a0; a1 = _a1; a2 = _a2; b1 = _b1; b2 = _b2;
}
void render(const float* in, float* out, const int frames) {
void render(const float32_t* in, float32_t* out, const uint32_t frames) {
float x;
float y;
float32_t x;
float32_t y;
for (int i = 0; i < frames; ++i) {
for (uint32_t i = 0; i < frames; ++i) {
x = *in++;
@ -105,10 +105,10 @@ protected:
// data
//
AudioBiquad _kernel;
float _sampleRate;
float _frequency;
float _gain;
float _slope;
float32_t _sampleRate;
float32_t _frequency;
float32_t _gain;
float32_t _slope;
//
// helpers
@ -131,7 +131,7 @@ public:
//
// public interface
//
void setParameters(const float sampleRate, const float frequency, const float gain, const float slope) {
void setParameters(const float32_t sampleRate, const float32_t frequency, const float32_t gain, const float32_t slope) {
_sampleRate = std::max(sampleRate, 1.0f);
_frequency = std::max(frequency, 2.0f);
@ -141,11 +141,11 @@ public:
updateKernel();
}
void getParameters(float& sampleRate, float& frequency, float& gain, float& slope) {
void getParameters(float32_t& sampleRate, float32_t& frequency, float32_t& gain, float32_t& slope) {
sampleRate = _sampleRate; frequency = _frequency; gain = _gain; slope = _slope;
}
void render(const float* in, float* out, const int frames) {
void render(const float32_t* in, float32_t* out, const uint32_t frames) {
_kernel.render(in,out,frames);
}
@ -166,14 +166,14 @@ public:
//
void updateKernel() {
const float a = _gain;
const float aAdd1 = a + 1.0f;
const float aSub1 = a - 1.0f;
const float omega = TWO_PI * _frequency / _sampleRate;
const float aAdd1TimesCosOmega = aAdd1 * cosf(omega);
const float aSub1TimesCosOmega = aSub1 * cosf(omega);
const float alpha = 0.5f * sinf(omega) / _slope;
const float zeta = 2.0f * sqrtf(a) * alpha;
const float32_t a = _gain;
const float32_t aAdd1 = a + 1.0f;
const float32_t aSub1 = a - 1.0f;
const float32_t omega = TWO_PI * _frequency / _sampleRate;
const float32_t aAdd1TimesCosOmega = aAdd1 * cosf(omega);
const float32_t aSub1TimesCosOmega = aSub1 * cosf(omega);
const float32_t alpha = 0.5f * sinf(omega) / _slope;
const float32_t zeta = 2.0f * sqrtf(a) * alpha;
/*
b0 = A*( (A+1) - (A-1)*cos(w0) + 2*sqrt(A)*alpha )
b1 = 2*A*( (A-1) - (A+1)*cos(w0) )
@ -182,14 +182,14 @@ public:
a1 = -2*( (A-1) + (A+1)*cos(w0) )
a2 = (A+1) + (A-1)*cos(w0) - 2*sqrt(A)*alpha
*/
const float b0 = +1.0f * (aAdd1 - aSub1TimesCosOmega + zeta) * a;
const float b1 = +2.0f * (aSub1 - aAdd1TimesCosOmega + ZERO) * a;
const float b2 = +1.0f * (aAdd1 - aSub1TimesCosOmega - zeta) * a;
const float a0 = +1.0f * (aAdd1 + aSub1TimesCosOmega + zeta);
const float a1 = -2.0f * (aSub1 + aAdd1TimesCosOmega + ZERO);
const float a2 = +1.0f * (aAdd1 + aSub1TimesCosOmega - zeta);
const float32_t b0 = +1.0f * (aAdd1 - aSub1TimesCosOmega + zeta) * a;
const float32_t b1 = +2.0f * (aSub1 - aAdd1TimesCosOmega + ZERO) * a;
const float32_t b2 = +1.0f * (aAdd1 - aSub1TimesCosOmega - zeta) * a;
const float32_t a0 = +1.0f * (aAdd1 + aSub1TimesCosOmega + zeta);
const float32_t a1 = -2.0f * (aSub1 + aAdd1TimesCosOmega + ZERO);
const float32_t a2 = +1.0f * (aAdd1 + aSub1TimesCosOmega - zeta);
const float normA0 = 1.0f / a0;
const float32_t normA0 = 1.0f / a0;
_kernel.setParameters(b0 * normA0, b1 * normA0 , b2 * normA0, a1 * normA0, a2 * normA0);
}
@ -207,14 +207,14 @@ public:
//
void updateKernel() {
const float a = _gain;
const float aAdd1 = a + 1.0f;
const float aSub1 = a - 1.0f;
const float omega = TWO_PI * _frequency / _sampleRate;
const float aAdd1TimesCosOmega = aAdd1 * cosf(omega);
const float aSub1TimesCosOmega = aSub1 * cosf(omega);
const float alpha = 0.5f * sinf(omega) / _slope;
const float zeta = 2.0f * sqrtf(a) * alpha;
const float32_t a = _gain;
const float32_t aAdd1 = a + 1.0f;
const float32_t aSub1 = a - 1.0f;
const float32_t omega = TWO_PI * _frequency / _sampleRate;
const float32_t aAdd1TimesCosOmega = aAdd1 * cosf(omega);
const float32_t aSub1TimesCosOmega = aSub1 * cosf(omega);
const float32_t alpha = 0.5f * sinf(omega) / _slope;
const float32_t zeta = 2.0f * sqrtf(a) * alpha;
/*
b0 = A*( (A+1) + (A-1)*cos(w0) + 2*sqrt(A)*alpha )
b1 = -2*A*( (A-1) + (A+1)*cos(w0) )
@ -223,14 +223,14 @@ public:
a1 = 2*( (A-1) - (A+1)*cos(w0) )
a2 = (A+1) - (A-1)*cos(w0) - 2*sqrt(A)*alpha
*/
const float b0 = +1.0f * (aAdd1 + aSub1TimesCosOmega + zeta) * a;
const float b1 = -2.0f * (aSub1 + aAdd1TimesCosOmega + ZERO) * a;
const float b2 = +1.0f * (aAdd1 + aSub1TimesCosOmega - zeta) * a;
const float a0 = +1.0f * (aAdd1 - aSub1TimesCosOmega + zeta);
const float a1 = +2.0f * (aSub1 - aAdd1TimesCosOmega + ZERO);
const float a2 = +1.0f * (aAdd1 - aSub1TimesCosOmega - zeta);
const float32_t b0 = +1.0f * (aAdd1 + aSub1TimesCosOmega + zeta) * a;
const float32_t b1 = -2.0f * (aSub1 + aAdd1TimesCosOmega + ZERO) * a;
const float32_t b2 = +1.0f * (aAdd1 + aSub1TimesCosOmega - zeta) * a;
const float32_t a0 = +1.0f * (aAdd1 - aSub1TimesCosOmega + zeta);
const float32_t a1 = +2.0f * (aSub1 - aAdd1TimesCosOmega + ZERO);
const float32_t a2 = +1.0f * (aAdd1 - aSub1TimesCosOmega - zeta);
const float normA0 = 1.0f / a0;
const float32_t normA0 = 1.0f / a0;
_kernel.setParameters(b0 * normA0, b1 * normA0 , b2 * normA0, a1 * normA0, a2 * normA0);
}
@ -248,9 +248,9 @@ public:
//
void updateKernel() {
const float omega = TWO_PI * _frequency / _sampleRate;
const float cosOmega = cosf(omega);
const float alpha = 0.5f * sinf(omega) / _slope;
const float32_t omega = TWO_PI * _frequency / _sampleRate;
const float32_t cosOmega = cosf(omega);
const float32_t alpha = 0.5f * sinf(omega) / _slope;
/*
b0 = 1 - alpha
b1 = -2*cos(w0)
@ -259,14 +259,14 @@ public:
a1 = -2*cos(w0)
a2 = 1 - alpha
*/
const float b0 = +1.0f - alpha;
const float b1 = -2.0f * cosOmega;
const float b2 = +1.0f + alpha;
const float a0 = +1.0f + alpha;
const float a1 = -2.0f * cosOmega;
const float a2 = +1.0f - alpha;
const float32_t b0 = +1.0f - alpha;
const float32_t b1 = -2.0f * cosOmega;
const float32_t b2 = +1.0f + alpha;
const float32_t a0 = +1.0f + alpha;
const float32_t a1 = -2.0f * cosOmega;
const float32_t a2 = +1.0f - alpha;
const float normA0 = 1.0f / a0;
const float32_t normA0 = 1.0f / a0;
_kernel.setParameters(b0 * normA0, b1 * normA0 , b2 * normA0, a1 * normA0, a2 * normA0);
}
@ -284,12 +284,12 @@ public:
//
void updateKernel() {
const float a = _gain;
const float omega = TWO_PI * _frequency / _sampleRate;
const float cosOmega = cosf(omega);
const float alpha = 0.5f * sinf(omega) / _slope;
const float alphaMulA = alpha * a;
const float alphaDivA = alpha / a;
const float32_t a = _gain;
const float32_t omega = TWO_PI * _frequency / _sampleRate;
const float32_t cosOmega = cosf(omega);
const float32_t alpha = 0.5f * sinf(omega) / _slope;
const float32_t alphaMulA = alpha * a;
const float32_t alphaDivA = alpha / a;
/*
b0 = 1 + alpha*A
b1 = -2*cos(w0)
@ -298,14 +298,14 @@ public:
a1 = -2*cos(w0)
a2 = 1 - alpha/A
*/
const float b0 = +1.0f + alphaMulA;
const float b1 = -2.0f * cosOmega;
const float b2 = +1.0f - alphaMulA;
const float a0 = +1.0f + alphaDivA;
const float a1 = -2.0f * cosOmega;
const float a2 = +1.0f - alphaDivA;
const float32_t b0 = +1.0f + alphaMulA;
const float32_t b1 = -2.0f * cosOmega;
const float32_t b2 = +1.0f - alphaMulA;
const float32_t a0 = +1.0f + alphaDivA;
const float32_t a1 = -2.0f * cosOmega;
const float32_t a2 = +1.0f - alphaDivA;
const float normA0 = 1.0f / a0;
const float32_t normA0 = 1.0f / a0;
_kernel.setParameters(b0 * normA0, b1 * normA0 , b2 * normA0, a1 * normA0, a2 * normA0);
}

View file

@ -15,24 +15,24 @@
//
// Helper/convenience class that implements a bank of Filter objects
//
template< typename T, const int N, const int C >
template< typename T, const uint32_t N, const uint32_t C >
class AudioFilterBank {
//
// types
//
struct FilterParameter {
float _p1;
float _p2;
float _p3;
float32_t _p1;
float32_t _p2;
float32_t _p3;
};
//
// private static data
//
static const int _filterCount = N;
static const int _channelCount = C;
static const int _profileCount = 4;
static const uint32_t _filterCount = N;
static const uint32_t _channelCount = C;
static const uint32_t _profileCount = 4;
static FilterParameter _profiles[ _profileCount ][ _filterCount ];
@ -40,9 +40,9 @@ class AudioFilterBank {
// private data
//
T _filters[ _filterCount ][ _channelCount ];
float* _buffer[ _channelCount ];
float _sampleRate;
uint16_t _frameCount;
float32_t* _buffer[ _channelCount ];
float32_t _sampleRate;
uint32_t _frameCount;
public:
@ -64,11 +64,11 @@ public:
//
// public interface
//
void initialize(const float sampleRate, const int frameCount = 0) {
void initialize(const float32_t sampleRate, const uint32_t frameCount = 0) {
finalize();
for (int i = 0; i < _channelCount; ++i) {
_buffer[i] = (float*)malloc(frameCount * sizeof(float));
for (uint32_t i = 0; i < _channelCount; ++i) {
_buffer[i] = (float32_t*)malloc(frameCount * sizeof(float32_t));
}
_sampleRate = sampleRate;
@ -79,7 +79,7 @@ public:
}
void finalize() {
for (int i = 0; i < _channelCount; ++i) {
for (uint32_t i = 0; i < _channelCount; ++i) {
if (_buffer[i]) {
free (_buffer[i]);
_buffer[i] = NULL;
@ -90,52 +90,53 @@ public:
void loadProfile(int profileIndex) {
if (profileIndex >= 0 && profileIndex < _profileCount) {
for (int i = 0; i < _filterCount; ++i) {
for (uint32_t i = 0; i < _filterCount; ++i) {
FilterParameter p = _profiles[profileIndex][i];
for (int j = 0; j < _channelCount; ++j) {
for (uint32_t j = 0; j < _channelCount; ++j) {
_filters[i][j].setParameters(_sampleRate,p._p1,p._p2,p._p3);
}
}
}
}
void setParameters(int filterStage, int filterChannel, const float sampleRate, const float frequency, const float gain,
const float slope) {
void setParameters(uint32_t filterStage, uint32_t filterChannel, const float32_t sampleRate, const float32_t frequency,
const float32_t gain, const float32_t slope) {
if (filterStage >= 0 && filterStage < _filterCount && filterChannel >= 0 && filterChannel < _channelCount) {
_filters[filterStage][filterChannel].setParameters(sampleRate,frequency,gain,slope);
}
}
void getParameters(int filterStage, int filterChannel, float& sampleRate, float& frequency, float& gain, float& slope) {
void getParameters(uint32_t filterStage, uint32_t filterChannel, float32_t& sampleRate, float32_t& frequency,
float32_t& gain, float32_t& slope) {
if (filterStage >= 0 && filterStage < _filterCount && filterChannel >= 0 && filterChannel < _channelCount) {
_filters[filterStage][filterChannel].getParameters(sampleRate,frequency,gain,slope);
}
}
void render(const int16_t* in, int16_t* out, const int frameCount) {
void render(const int16_t* in, int16_t* out, const uint32_t frameCount) {
if (!_buffer || (frameCount > _frameCount))
return;
const int scale = (2 << ((8 * sizeof(int16_t)) - 1));
// de-interleave and convert int16_t to float32 (normalized to -1. ... 1.)
for (int i = 0; i < frameCount; ++i) {
for (int j = 0; j < _channelCount; ++j) {
for (uint32_t i = 0; i < frameCount; ++i) {
for (uint32_t j = 0; j < _channelCount; ++j) {
_buffer[j][i] = ((float)(*in++)) / scale;
}
}
// now step through each filter
for (int i = 0; i < _channelCount; ++i) {
for (int j = 0; j < _filterCount; ++j) {
for (uint32_t i = 0; i < _channelCount; ++i) {
for (uint32_t j = 0; j < _filterCount; ++j) {
_filters[j][i].render( &_buffer[i][0], &_buffer[i][0], frameCount );
}
}
// convert float32 to int16_t and interleave
for (int i = 0; i < frameCount; ++i) {
for (int j = 0; j < _channelCount; ++j) {
for (uint32_t i = 0; i < frameCount; ++i) {
for (uint32_t j = 0; j < _channelCount; ++j) {
*out++ = (int16_t)(_buffer[j][i] * scale);
}
}
@ -144,16 +145,16 @@ public:
void render(AudioBufferFloat32& frameBuffer) {
float32_t** samples = frameBuffer.getFrameData();
for (uint16_t j = 0; j < frameBuffer.getChannelCount(); ++j) {
for (int i = 0; i < _filterCount; ++i) {
for (uint32_t j = 0; j < frameBuffer.getChannelCount(); ++j) {
for (uint32_t i = 0; i < _filterCount; ++i) {
_filters[i][j].render( samples[j], samples[j], frameBuffer.getFrameCount() );
}
}
}
void reset() {
for (int i = 0; i < _filterCount; ++i) {
for (int j = 0; j < _channelCount; ++j) {
for (uint32_t i = 0; i < _filterCount; ++i) {
for (uint32_t j = 0; j < _channelCount; ++j) {
_filters[i][j].reset();
}
}

View file

@ -61,7 +61,7 @@ public:
if (frameBuffer.getChannelCount() == 1) {
for (uint16_t i = 0; i < frameBuffer.getFrameCount(); i += 16) {
for (uint32_t i = 0; i < frameBuffer.getFrameCount(); i += 16) {
samples[0][i + 0] *= _gain;
samples[0][i + 1] *= _gain;
samples[0][i + 2] *= _gain;
@ -82,7 +82,7 @@ public:
}
else if (frameBuffer.getChannelCount() == 2) {
for (uint16_t i = 0; i < frameBuffer.getFrameCount(); i += 16) {
for (uint32_t i = 0; i < frameBuffer.getFrameCount(); i += 16) {
samples[0][i + 0] *= _gain;
samples[0][i + 1] *= _gain;
samples[0][i + 2] *= _gain;
@ -123,8 +123,8 @@ public:
}
else {
for (uint16_t j = 0; j < frameBuffer.getChannelCount(); ++j) {
for (uint16_t i = 0; i < frameBuffer.getFrameCount(); i += 1) {
for (uint32_t j = 0; j < frameBuffer.getChannelCount(); ++j) {
for (uint32_t i = 0; i < frameBuffer.getFrameCount(); i += 1) {
samples[j][i] *= _gain;
}
}

View file

@ -88,7 +88,7 @@ public:
if (frameBuffer.getChannelCount() == 2) {
for (uint16_t i = 0; i < frameBuffer.getFrameCount(); i += 16) {
for (uint32_t i = 0; i < frameBuffer.getFrameCount(); i += 16) {
samples[0][i + 0] *= _gainLeft;
samples[0][i + 1] *= _gainLeft;
samples[0][i + 2] *= _gainLeft;
@ -128,7 +128,7 @@ public:
}
}
else {
for (uint16_t i = 0; i < frameBuffer.getFrameCount(); i += 1) {
for (uint32_t i = 0; i < frameBuffer.getFrameCount(); i += 1) {
samples[0][i] *= _gainLeft;
samples[1][i] *= _gainRight;
}

View file

@ -70,8 +70,8 @@ public:
uint32_t randomNumber;
float32_t** samples = frameBuffer.getFrameData();
for (uint16_t i = 0; i < frameBuffer.getFrameCount(); ++i) {
for (uint16_t j = 0; j < frameBuffer.getChannelCount(); ++j) {
for (uint32_t i = 0; i < frameBuffer.getFrameCount(); ++i) {
for (uint32_t j = 0; j < frameBuffer.getChannelCount(); ++j) {
_index = (_index + 1) & _indexMask; // increment and mask index.
if (_index != 0) { // if index is zero, don't update any random values.

View file

@ -44,7 +44,7 @@ inline void AudioSourceTone::render(AudioBufferFloat32& frameBuffer) {
float32_t** samples = frameBuffer.getFrameData();
float32_t yq;
float32_t y;
for (uint16_t i = 0; i < frameBuffer.getFrameCount(); ++i) {
for (uint32_t i = 0; i < frameBuffer.getFrameCount(); ++i) {
yq = _yq1 - (_epsilon * _y1);
y = _y1 + (_epsilon * yq);
@ -53,7 +53,7 @@ inline void AudioSourceTone::render(AudioBufferFloat32& frameBuffer) {
_yq1 = yq;
_y1 = y;
for (uint16_t j = 0; j < frameBuffer.getChannelCount(); ++j) {
for (uint32_t j = 0; j < frameBuffer.getChannelCount(); ++j) {
samples[j][i] = _amplitude * y;
}
}