Update audio_raw_stream.c to more closely follow raylib coding conventions
I accidentally put the file in the wrong folder.
This commit is contained in:
parent
55ed7492fc
commit
4876d703f5
|
|
@ -62,35 +62,27 @@ int main(void)
|
||||||
if (IsKeyDown(KEY_UP))
|
if (IsKeyDown(KEY_UP))
|
||||||
{
|
{
|
||||||
newSineFrequency += 10;
|
newSineFrequency += 10;
|
||||||
|
if (newSineFrequency > 12500) newSineFrequency = 12500;
|
||||||
if (newSineFrequency > 12500)
|
|
||||||
newSineFrequency = 12500;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsKeyDown(KEY_DOWN))
|
if (IsKeyDown(KEY_DOWN))
|
||||||
{
|
{
|
||||||
newSineFrequency -= 10;
|
newSineFrequency -= 10;
|
||||||
|
if (newSineFrequency < 20) newSineFrequency = 20;
|
||||||
if (newSineFrequency < 20)
|
|
||||||
newSineFrequency = 20;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsKeyDown(KEY_LEFT))
|
if (IsKeyDown(KEY_LEFT))
|
||||||
{
|
{
|
||||||
pan -= 0.01f;
|
pan -= 0.01f;
|
||||||
|
if (pan < -1.0f) pan = -1.0f;
|
||||||
SetAudioStreamPan(stream, pan);
|
SetAudioStreamPan(stream, pan);
|
||||||
|
|
||||||
if (pan < -1.0f)
|
|
||||||
pan = -1.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsKeyDown(KEY_RIGHT))
|
if (IsKeyDown(KEY_RIGHT))
|
||||||
{
|
{
|
||||||
pan += 0.01f;
|
pan += 0.01f;
|
||||||
|
if (pan > 1.0f) pan = 1.0f;
|
||||||
SetAudioStreamPan(stream, pan);
|
SetAudioStreamPan(stream, pan);
|
||||||
|
|
||||||
if (pan > 1.0f)
|
|
||||||
pan = 1.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsAudioStreamProcessed(stream))
|
if (IsAudioStreamProcessed(stream))
|
||||||
|
|
@ -129,7 +121,8 @@ int main(void)
|
||||||
int wavelength = SAMPLE_RATE/sineFrequency;
|
int wavelength = SAMPLE_RATE/sineFrequency;
|
||||||
|
|
||||||
// Draw a sine wave with the same frequency as the one being sent to the audio stream
|
// Draw a sine wave with the same frequency as the one being sent to the audio stream
|
||||||
for (int i = 0; i < screenWidth; i++) {
|
for (int i = 0; i < screenWidth; i++)
|
||||||
|
{
|
||||||
int t0 = windowStart + i*windowSize/screenWidth;
|
int t0 = windowStart + i*windowSize/screenWidth;
|
||||||
int t1 = windowStart + (i + 1)*windowSize/screenWidth;
|
int t1 = windowStart + (i + 1)*windowSize/screenWidth;
|
||||||
Vector2 startPos = { i, 250 + 50*sin(2*PI*t0/wavelength) };
|
Vector2 startPos = { i, 250 + 50*sin(2*PI*t0/wavelength) };
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user