mirror of
https://github.com/make-42/xyosc
synced 2025-01-18 10:47:10 +01:00
might be more efficient
This commit is contained in:
parent
195aaa6a78
commit
b7dda87082
@ -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
|
||||
|
2
main.go
2
main.go
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user