Fix append -> append + copy

This commit is contained in:
DataHoarder 2022-01-26 13:52:19 +01:00
parent f3afd2eca0
commit 01e4b00ac7

View file

@ -119,7 +119,8 @@ func (g *Gaborator) gaborTransform(audioData []float32) {
// keep the new maximum
g.mostRecentCoefficentIndex = coefficientIndex
// copy the oldest data to the history
g.fixedCoefficents = append(g.fixedCoefficents, g.coefficients[circularIndex])
g.fixedCoefficents = append(g.fixedCoefficents, make([]float32, len(g.coefficients[circularIndex])))
copy(g.fixedCoefficents[len(g.fixedCoefficents)-1], g.coefficients[circularIndex])
// fill the oldest with zeros
for j := range g.coefficients[circularIndex] {