rename f t frequency

This commit is contained in:
Zachary Bednarke 2024-05-07 19:51:43 -07:00
parent 95c2f5679a
commit 65392e706d

View file

@ -12,7 +12,7 @@ const (
maxSamples = 6000 maxSamples = 6000
sampleRate = 6000 sampleRate = 6000
maxSamplesPerUpdate = 1600 maxSamplesPerUpdate = 1600
f = 440 frequency = 440
targetFPS = 240 targetFPS = 240
) )
@ -29,7 +29,7 @@ func main() {
for i := 0; i < maxSamples; i++ { for i := 0; i < maxSamples; i++ {
t := float32(i) / float32(maxSamples) t := float32(i) / float32(maxSamples)
data[i] = float32(math.Sin(float64((2 * rl.Pi * f * t)))) data[i] = float32(math.Sin(float64((2 * rl.Pi * frequency * t))))
} }
// NOTE: The buffer can only be updated when it has been processed. Time between buffer processing and next load and causes clipping // NOTE: The buffer can only be updated when it has been processed. Time between buffer processing and next load and causes clipping
@ -55,7 +55,7 @@ func main() {
rl.BeginDrawing() rl.BeginDrawing()
rl.ClearBackground(rl.RayWhite) rl.ClearBackground(rl.RayWhite)
rl.DrawText(fmt.Sprintf("%d Hz SINE WAVE SHOULD BE PLAYING!", f), 200, 140, 20, rl.LightGray) rl.DrawText(fmt.Sprintf("%d Hz SINE WAVE SHOULD BE PLAYING!", frequency), 200, 140, 20, rl.LightGray)
// NOTE: Draw a part of the sine wave (only screen width) // NOTE: Draw a part of the sine wave (only screen width)
for i := 0; i < int(rl.GetScreenWidth()); i++ { for i := 0; i < int(rl.GetScreenWidth()); i++ {