mirror of
https://github.com/make-42/xyosc
synced 2025-01-18 18:57:10 +01:00
might be more efficient
This commit is contained in:
parent
921803d066
commit
cd917dc81f
2
main.go
2
main.go
@ -6,6 +6,7 @@ import (
|
|||||||
"image/color"
|
"image/color"
|
||||||
"log"
|
"log"
|
||||||
"math/rand/v2"
|
"math/rand/v2"
|
||||||
|
"sort"
|
||||||
"xyosc/audio"
|
"xyosc/audio"
|
||||||
"xyosc/config"
|
"xyosc/config"
|
||||||
"xyosc/fastsqrt"
|
"xyosc/fastsqrt"
|
||||||
@ -99,6 +100,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
indices := peaks.Get(FFTBuffer, config.Config.PeakDetectSeparator)
|
indices := peaks.Get(FFTBuffer, config.Config.PeakDetectSeparator)
|
||||||
|
sort.Ints(indices)
|
||||||
offset := uint32(indices[0])
|
offset := uint32(indices[0])
|
||||||
for i := uint32(0); i < numSamples-1; i++ {
|
for i := uint32(0); i < numSamples-1; i++ {
|
||||||
fAX := float32(FFTBuffer[(i+offset)%numSamples]) * config.Config.Gain * float32(scale)
|
fAX := float32(FFTBuffer[(i+offset)%numSamples]) * config.Config.Gain * float32(scale)
|
||||||
|
Loading…
Reference in New Issue
Block a user