might be more efficient

This commit is contained in:
Louis Dalibard 2025-01-16 23:12:14 +01:00
parent 195aaa6a78
commit b7dda87082
2 changed files with 3 additions and 1 deletions

View File

@ -38,6 +38,7 @@ type ConfigS struct {
ParticleDrag float32
DefaultToSingleChannel bool
PeakDetectSeparator int
SingleChannelWindow uint32
}
var DefaultConfig = ConfigS{
@ -65,6 +66,7 @@ var DefaultConfig = ConfigS{
ParticleDrag: 5.0,
DefaultToSingleChannel: false,
PeakDetectSeparator: 100,
SingleChannelWindow: 1000,
}
var Config ConfigS

View File

@ -105,7 +105,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
for i := uint32(0); i < numSamples-1; i++ {
fAX := float32(FFTBuffer[(i+offset)%numSamples]) * config.Config.Gain * float32(scale)
fBX := float32(FFTBuffer[(i+1+offset)%numSamples]) * config.Config.Gain * float32(scale)
vector.StrokeLine(screen, float32(config.Config.WindowWidth)*float32(i)/float32(numSamples), float32(config.Config.WindowHeight/2)+fAX, float32(config.Config.WindowWidth)*float32(i+1)/float32(numSamples), float32(config.Config.WindowHeight/2)+fBX, config.Config.LineThickness, config.ThirdColorAdj, true)
vector.StrokeLine(screen, float32(config.Config.WindowWidth)*float32(i%config.Config.SingleChannelWindow)/float32(config.Config.SingleChannelWindow), float32(config.Config.WindowHeight/2)+fAX, float32(config.Config.WindowWidth)*float32(i%config.Config.SingleChannelWindow+1)/float32(config.Config.SingleChannelWindow), float32(config.Config.WindowHeight/2)+fBX, config.Config.LineThickness, config.ThirdColorAdj, true)
}
}