mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
added apache licensing/removed implicit double<->float conversions/addressed style guide issues
This commit is contained in:
parent
481108ecd1
commit
3d95f28fb9
2 changed files with 18 additions and 12 deletions
|
@ -3,7 +3,10 @@
|
|||
// hifi
|
||||
//
|
||||
// Created by Craig Hansen-Sturm on 8/10/14.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
|
@ -15,9 +18,9 @@
|
|||
template<>
|
||||
AudioFilterPEQ3::FilterParameter AudioFilterPEQ3::_profiles[ AudioFilterPEQ3::_profileCount ][ AudioFilterPEQ3::_filterCount ] = {
|
||||
|
||||
{ { 300., 1., 1. }, { 1000., 1., 1. }, { 4000., 1., 1. } }, // flat response (default)
|
||||
{ { 300., 1., 1. }, { 1000., 1., 1. }, { 4000., .1, 1. } }, // treble cut
|
||||
{ { 300., .1, 1. }, { 1000., 1., 1. }, { 4000., 1., 1. } }, // bass cut
|
||||
{ { 300., 1.5, 0.71 }, { 1000., .5, 1. }, { 4000., 1.5, 0.71 } } // smiley curve
|
||||
// Freq Gain Q Freq Gain Q Freq Gain Q
|
||||
{ { 300.0f, 1.0f, 1.0f }, { 1000.0f, 1.0f, 1.0f }, { 4000.0f, 1.0f, 1.0f } }, // flat response (default)
|
||||
{ { 300.0f, 1.0f, 1.0f }, { 1000.0f, 1.0f, 1.0f }, { 4000.0f, 0.1f, 1.0f } }, // treble cut
|
||||
{ { 300.0f, 0.1f, 1.0f }, { 1000.0f, 1.0f, 1.0f }, { 4000.0f, 1.0f, 1.0f } }, // bass cut
|
||||
{ { 300.0f, 1.5f, 0.71f }, { 1000.0f, 0.5f, 1.0f }, { 4000.0f, 1.50f, 0.71f } } // smiley curve
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
// hifi
|
||||
//
|
||||
// Created by Craig Hansen-Sturm on 8/9/14.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_AudioFilter_h
|
||||
|
@ -117,14 +120,14 @@ class AudioParametricEQ {
|
|||
|
||||
const float a = _gain;
|
||||
const float omega = TWO_PI * _frequency / _sampleRate;
|
||||
const float alpha = 0.5 * sinf(omega) / _slope;
|
||||
const float gamma = 1.0 / ( 1.0 + (alpha/a) );
|
||||
const float alpha = 0.5f * sinf(omega) / _slope;
|
||||
const float gamma = 1.0f / ( 1.0f + (alpha/a) );
|
||||
|
||||
const float a0 = 1.0 + (alpha*a);
|
||||
const float a1 = -2.0 * cosf(omega);
|
||||
const float a2 = 1.0 - (alpha*a);
|
||||
const float a0 = 1.0f + (alpha*a);
|
||||
const float a1 = -2.0f * cosf(omega);
|
||||
const float a2 = 1.0f - (alpha*a);
|
||||
const float b1 = a1;
|
||||
const float b2 = 1.0 - (alpha/a);
|
||||
const float b2 = 1.0f - (alpha/a);
|
||||
|
||||
_kernel.setParameters( a0*gamma,a1*gamma,a2*gamma,b1*gamma,b2*gamma );
|
||||
}
|
||||
|
@ -257,7 +260,7 @@ public:
|
|||
}
|
||||
|
||||
void render( const int16_t* in, int16_t* out, const int frameCount ) {
|
||||
if( !_buffer || ( frameCount > _frameCount ) )
|
||||
if (!_buffer || ( frameCount > _frameCount ))
|
||||
return;
|
||||
|
||||
const int scale = (2 << ((8*sizeof(int16_t))-1));
|
||||
|
|
Loading…
Reference in a new issue