mirror of
https://github.com/lubosz/overte.git
synced 2025-04-26 06:55:39 +02:00
addresses more coding-standard spacing issues
This commit is contained in:
parent
bf6d34b6f3
commit
4f346bfe62
5 changed files with 36 additions and 35 deletions
assignment-client/src/audio
examples
libraries/audio/src
|
@ -284,7 +284,7 @@ void AudioMixer::addStreamToMixForListeningNodeWithStream(PositionalAudioStream*
|
|||
// normalize penumbra angle
|
||||
float normalizedHeadPenumbraAngle = headPenumbraAngle / PI_OVER_TWO;
|
||||
|
||||
if ( normalizedHeadPenumbraAngle < EPSILON ) {
|
||||
if (normalizedHeadPenumbraAngle < EPSILON) {
|
||||
normalizedHeadPenumbraAngle = EPSILON;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ function playSound() {
|
|||
|
||||
var soundOffset = { x:s, y:0, z:c };
|
||||
|
||||
if( debug ) {
|
||||
if (debug) {
|
||||
print("t=" + currentTime + "offset=" + soundOffset.x + "," + soundOffset.y + "," + soundOffset.z);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,15 +51,15 @@ public:
|
|||
//
|
||||
// public interface
|
||||
//
|
||||
void setParameters( const float a0, const float a1, const float a2, const float b1, const float b2 ) {
|
||||
void setParameters(const float a0, const float a1, const float a2, const float b1, const float 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(float& a0, float& a1, float& a2, float& b1, float& b2) {
|
||||
a0 = _a0; a1 = _a1; a2 = _a2; b1 = _b1; b2 = _b2;
|
||||
}
|
||||
|
||||
void render( const float* in, float* out, const int frames) {
|
||||
void render(const float* in, float* out, const int frames) {
|
||||
|
||||
float x;
|
||||
float y;
|
||||
|
@ -129,21 +129,21 @@ public:
|
|||
//
|
||||
// public interface
|
||||
//
|
||||
void setParameters( const float sampleRate, const float frequency, const float gain, const float slope ) {
|
||||
void setParameters(const float sampleRate, const float frequency, const float gain, const float slope) {
|
||||
|
||||
_sampleRate = std::max(sampleRate,1.0f);
|
||||
_frequency = std::max(frequency,2.0f);
|
||||
_gain = std::max(gain,0.0f);
|
||||
_slope = std::max(slope,0.00001f);
|
||||
_sampleRate = std::max(sampleRate, 1.0f);
|
||||
_frequency = std::max(frequency, 2.0f);
|
||||
_gain = std::max(gain, 0.0f);
|
||||
_slope = std::max(slope, 0.00001f);
|
||||
|
||||
updateKernel();
|
||||
}
|
||||
|
||||
void getParameters( float& sampleRate, float& frequency, float& gain, float& slope ) {
|
||||
void getParameters(float& sampleRate, float& frequency, float& gain, float& slope) {
|
||||
sampleRate = _sampleRate; frequency = _frequency; gain = _gain; slope = _slope;
|
||||
}
|
||||
|
||||
void render(const float* in, float* out, const int frames ) {
|
||||
void render(const float* in, float* out, const int frames) {
|
||||
_kernel.render(in,out,frames);
|
||||
}
|
||||
|
||||
|
@ -208,15 +208,15 @@ public:
|
|||
b1 = -2*cos(w0)
|
||||
b2 = 1 - alpha/A
|
||||
*/
|
||||
const float a0 = 1.0f + (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 a2 = 1.0f - (alpha * a);
|
||||
const float b1 = a1;
|
||||
const float b2 = 1.0f - (alpha/a);
|
||||
const float b2 = 1.0f - (alpha / a);
|
||||
|
||||
const float scale = 1.0f / ( 1.0f + (alpha/a) );
|
||||
const float scale = 1.0f / (1.0f + (alpha / a));
|
||||
|
||||
_kernel.setParameters( a0*scale,a1*scale,a2*scale,b1*scale,b2*scale );
|
||||
_kernel.setParameters(a0 * scale, a1 * scale, a2 * scale, b1 * scale, b2 * scale);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class AudioFilterBank {
|
|||
static const int _channelCount = C;
|
||||
static const int _profileCount = 4;
|
||||
|
||||
static FilterParameter _profiles[_profileCount][_filterCount];
|
||||
static FilterParameter _profiles[ _profileCount ][ _filterCount ];
|
||||
|
||||
//
|
||||
// private data
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
AudioFilterBank()
|
||||
: _sampleRate(0.)
|
||||
, _frameCount(0) {
|
||||
for (int i = 0; i < _channelCount; ++i ) {
|
||||
for (int i = 0; i < _channelCount; ++i) {
|
||||
_buffer[ i ] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -64,11 +64,11 @@ public:
|
|||
//
|
||||
// public interface
|
||||
//
|
||||
void initialize( const float sampleRate, const int frameCount ) {
|
||||
void initialize(const float sampleRate, const int frameCount) {
|
||||
finalize();
|
||||
|
||||
for (int i = 0; i < _channelCount; ++i ) {
|
||||
_buffer[i] = (float*)malloc( frameCount * sizeof( float ) );
|
||||
for (int i = 0; i < _channelCount; ++i) {
|
||||
_buffer[i] = (float*)malloc(frameCount * sizeof(float));
|
||||
}
|
||||
|
||||
_sampleRate = sampleRate;
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
}
|
||||
|
||||
void finalize() {
|
||||
for (int i = 0; i < _channelCount; ++i ) {
|
||||
for (int i = 0; i < _channelCount; ++i) {
|
||||
if (_buffer[i]) {
|
||||
free (_buffer[i]);
|
||||
_buffer[i] = NULL;
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void loadProfile( int profileIndex ) {
|
||||
void loadProfile(int profileIndex) {
|
||||
if (profileIndex >= 0 && profileIndex < _profileCount) {
|
||||
|
||||
for (int i = 0; i < _filterCount; ++i) {
|
||||
|
@ -100,23 +100,24 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void setParameters( int filterStage, int filterChannel, const float sampleRate, const float frequency, const float gain, const float slope ) {
|
||||
if ( filterStage >= 0 && filterStage < _filterCount && filterChannel >= 0 && filterChannel < _channelCount ) {
|
||||
void setParameters(int filterStage, int filterChannel, const float sampleRate, const float frequency, const float gain,
|
||||
const float 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 ) {
|
||||
if ( filterStage >= 0 && filterStage < _filterCount && filterChannel >= 0 && filterChannel < _channelCount ) {
|
||||
void getParameters(int filterStage, int filterChannel, float& sampleRate, float& frequency, float& gain, float& 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 ) {
|
||||
if (!_buffer || ( frameCount > _frameCount ))
|
||||
void render(const int16_t* in, int16_t* out, const int frameCount) {
|
||||
if (!_buffer || (frameCount > _frameCount))
|
||||
return;
|
||||
|
||||
const int scale = (2 << ((8*sizeof(int16_t))-1));
|
||||
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) {
|
||||
|
@ -127,7 +128,7 @@ public:
|
|||
|
||||
// now step through each filter
|
||||
for (int i = 0; i < _channelCount; ++i) {
|
||||
for (int j = 0; j < _filterCount; ++j ) {
|
||||
for (int j = 0; j < _filterCount; ++j) {
|
||||
_filters[j][i].render( &_buffer[i][0], &_buffer[i][0], frameCount );
|
||||
}
|
||||
}
|
||||
|
@ -141,8 +142,8 @@ public:
|
|||
}
|
||||
|
||||
void reset() {
|
||||
for (int i = 0; i < _filterCount; ++i ) {
|
||||
for (int j = 0; j < _channelCount; ++j ) {
|
||||
for (int i = 0; i < _filterCount; ++i) {
|
||||
for (int j = 0; j < _channelCount; ++j) {
|
||||
_filters[i][j].reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ PositionalAudioStream::PositionalAudioStream(PositionalAudioStream::Type type, b
|
|||
{
|
||||
// constant defined in AudioMixer.h. However, we don't want to include this here, since we will soon find a better common home for these audio-related constants
|
||||
const int SAMPLE_PHASE_DELAY_AT_90 = 20;
|
||||
_filter.initialize( SAMPLE_RATE, ( NETWORK_BUFFER_LENGTH_SAMPLES_STEREO + (SAMPLE_PHASE_DELAY_AT_90 * 2) ) / 2);
|
||||
_filter.initialize(SAMPLE_RATE, (NETWORK_BUFFER_LENGTH_SAMPLES_STEREO + (SAMPLE_PHASE_DELAY_AT_90 * 2)) / 2);
|
||||
}
|
||||
|
||||
void PositionalAudioStream::updateLastPopOutputTrailingLoudness() {
|
||||
|
|
Loading…
Reference in a new issue