mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
reviewed ALL non-external files to follow raylib's convention of no spaces around / or * (#5153)
This commit is contained in:
@ -30,13 +30,13 @@ void ProcessAudio(void *buffer, unsigned int frames)
|
||||
|
||||
for (unsigned int frame = 0; frame < frames; frame++)
|
||||
{
|
||||
float *left = &samples[frame * 2 + 0], *right = &samples[frame * 2 + 1];
|
||||
float *left = &samples[frame*2 + 0], *right = &samples[frame*2 + 1];
|
||||
|
||||
*left = powf(fabsf(*left), exponent) * ( (*left < 0.0f)? -1.0f : 1.0f );
|
||||
*right = powf(fabsf(*right), exponent) * ( (*right < 0.0f)? -1.0f : 1.0f );
|
||||
*left = powf(fabsf(*left), exponent)*( (*left < 0.0f)? -1.0f : 1.0f );
|
||||
*right = powf(fabsf(*right), exponent)*( (*right < 0.0f)? -1.0f : 1.0f );
|
||||
|
||||
average += fabsf(*left) / frames; // accumulating average volume
|
||||
average += fabsf(*right) / frames;
|
||||
average += fabsf(*left)/frames; // accumulating average volume
|
||||
average += fabsf(*right)/frames;
|
||||
}
|
||||
|
||||
// Moving history to the left
|
||||
@ -99,7 +99,7 @@ int main(void)
|
||||
DrawRectangle(199, 199, 402, 34, LIGHTGRAY);
|
||||
for (int i = 0; i < 400; i++)
|
||||
{
|
||||
DrawLine(201 + i, 232 - (int)(averageVolume[i] * 32), 201 + i, 232, MAROON);
|
||||
DrawLine(201 + i, 232 - (int)(averageVolume[i]*32), 201 + i, 232, MAROON);
|
||||
}
|
||||
DrawRectangleLines(199, 199, 402, 34, GRAY);
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ int main(void)
|
||||
float fp = (float)(mousePosition.y);
|
||||
frequency = 40.0f + (float)(fp);
|
||||
|
||||
float pan = (float)(mousePosition.x) / (float)screenWidth;
|
||||
float pan = (float)(mousePosition.x)/(float)screenWidth;
|
||||
SetAudioStreamPan(stream, pan);
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ int main(void)
|
||||
}
|
||||
|
||||
// Scale read cursor's position to minimize transition artifacts
|
||||
//readCursor = (int)(readCursor * ((float)waveLength / (float)oldWavelength));
|
||||
//readCursor = (int)(readCursor*((float)waveLength/(float)oldWavelength));
|
||||
oldFrequency = frequency;
|
||||
}
|
||||
|
||||
|
||||
@ -148,8 +148,8 @@ int main(void)
|
||||
static void AudioProcessEffectLPF(void *buffer, unsigned int frames)
|
||||
{
|
||||
static float low[2] = { 0.0f, 0.0f };
|
||||
static const float cutoff = 70.0f / 44100.0f; // 70 Hz lowpass filter
|
||||
const float k = cutoff / (cutoff + 0.1591549431f); // RC filter formula
|
||||
static const float cutoff = 70.0f/44100.0f; // 70 Hz lowpass filter
|
||||
const float k = cutoff/(cutoff + 0.1591549431f); // RC filter formula
|
||||
|
||||
// Converts the buffer data before using it
|
||||
float *bufferData = (float *)buffer;
|
||||
@ -158,8 +158,8 @@ static void AudioProcessEffectLPF(void *buffer, unsigned int frames)
|
||||
const float l = bufferData[i];
|
||||
const float r = bufferData[i + 1];
|
||||
|
||||
low[0] += k * (l - low[0]);
|
||||
low[1] += k * (r - low[1]);
|
||||
low[0] += k*(l - low[0]);
|
||||
low[1] += k*(r - low[1]);
|
||||
bufferData[i] = low[0];
|
||||
bufferData[i + 1] = low[1];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user